2025-05-2500
This commit is contained in:
@ -40,7 +40,7 @@ build_flags = ${env.build_flags}
|
||||
-Dmqtt_server=\"hjkmqtt.dedyn.io\"
|
||||
-Dmqtt_port=61883
|
||||
-DINNEN=\"hjk/devices/TEMPWOHNZIM/telemetry/temperature\"
|
||||
-DFLUR=\"hjk/devices/TEMPFLUR/telemetry/temperature\"
|
||||
;-DFLUR=\"hjk/devices/TEMPFLUR/telemetry/temperature\"
|
||||
-DCO2=\"hjk/devices/257923/telemetry/co2\"
|
||||
-DAKKU=\"hjk/devices/WETTERSTATION/telemetry/battery\"
|
||||
-DWETTER=\"hjk/devices/WETTERSTATION/telemetry/temperature_Htu_21\"
|
||||
|
28
src/main.cpp
28
src/main.cpp
@ -65,7 +65,7 @@ PubSubClient client(espClient);
|
||||
#define CO2_CRITICAL_PPM 1850
|
||||
|
||||
#define matrix_width 64
|
||||
#define matrix_height 64
|
||||
#define matrix_height 32
|
||||
|
||||
// This defines the 'on' time of the display is us. The larger this number,
|
||||
// the brighter the display. If too large the ESP will crash
|
||||
@ -84,7 +84,7 @@ uint16_t myYELLOW = display.color565(255, 255, 0);
|
||||
uint16_t myCYAN = display.color565(0, 255, 255);
|
||||
uint16_t myMAGENTA = display.color565(255, 0, 255);
|
||||
uint16_t myBLACK = display.color565(0, 0, 0);
|
||||
uint16_t myDATUM = display.color565(64, 64, 64);
|
||||
uint16_t myDATUM = display.color565(128, 128, 128);
|
||||
uint16_t myTEMP = display.color565(255, 255, 255);
|
||||
uint16_t myCo = display.color565(0, 64, 0);
|
||||
|
||||
@ -110,7 +110,7 @@ time_t now;
|
||||
long unsigned lastNTPtime;
|
||||
unsigned long lastEntryTime;
|
||||
|
||||
const int TimeY = 20;
|
||||
const int TimeY = 16;
|
||||
const int TimeX = 1;
|
||||
|
||||
const int WetterY = 32;
|
||||
@ -149,7 +149,9 @@ const char* topic_Co2 = CO2;
|
||||
const char* topic_Wetter = WETTER;
|
||||
const char* topic_Pressure = LUFTDRUCK;
|
||||
const char* topic_Luftfeuchtigkeit = FEUCHTIGKEIT;
|
||||
#ifdef HELLIGKEIT
|
||||
const char* topic_Helligkeit = HELLIGKEIT;
|
||||
#endif
|
||||
#ifdef FLUR
|
||||
const char* topic_Flur = FLUR;
|
||||
#endif
|
||||
@ -298,6 +300,7 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
||||
Serial.println(" V");
|
||||
Akku = atof(msg);
|
||||
}
|
||||
#ifdef HELLIGKEIT
|
||||
if(strcmp(topic1, topic_Helligkeit)== 0){
|
||||
Serial.print("Helligkeit: ");
|
||||
Serial.print(msg);
|
||||
@ -307,6 +310,7 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
||||
if (Helligkeit < 0) Helligkeit = 0;
|
||||
display.setBrightness(Helligkeit);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void reconnect() {
|
||||
sprintf(clientName, "%s%s", "Uhr", "Zentrale4" );
|
||||
@ -328,7 +332,9 @@ void reconnect() {
|
||||
#endif
|
||||
client.subscribe(topic_Luftfeuchtigkeit);
|
||||
client.subscribe(topic_Akku);
|
||||
#ifdef HELLIGKEIT
|
||||
client.subscribe(topic_Helligkeit);
|
||||
#endif
|
||||
//client.subscribe("hjk/devices/WETTERSTATIONBORIS/telemetry/#");
|
||||
//client.subscribe("hjk/devices/MESSUNITTEMPBORIS/telemetry/#");
|
||||
} else {
|
||||
@ -503,7 +509,7 @@ void setup() {
|
||||
display.setMuxPattern(BINARY);
|
||||
|
||||
// Set the color order {RRGGBB, RRBBGG, GGRRBB, GGBBRR, BBRRGG, BBGGRR} (default is RRGGBB)
|
||||
display.setColorOrder(BBRRGG);
|
||||
display.setColorOrder(RRBBGG);
|
||||
|
||||
// Set the time in microseconds that we pause after selecting each mux channel
|
||||
// (May help if some rows are missing / the mux chip is too slow)
|
||||
@ -525,10 +531,10 @@ void setup() {
|
||||
display.print("Time");
|
||||
//----------------------
|
||||
display.setTextColor(myBLUE);
|
||||
display.setCursor(2,50);
|
||||
display.setCursor(2,matrix_height-8);
|
||||
display.print("Pixel");
|
||||
display.setTextColor(myYELLOW);
|
||||
display.setCursor(30,50);
|
||||
display.setCursor(30,matrix_height-8);
|
||||
display.print("1234");
|
||||
//--------------------------------------------------
|
||||
//--------------------------------------------------
|
||||
@ -738,7 +744,7 @@ void loop() {
|
||||
{
|
||||
lastTime = millis();
|
||||
blinkSek = !blinkSek;
|
||||
ZeigeDatum(timeinfo, 1, 1);
|
||||
ZeigeDatum(timeinfo, 1, 0);
|
||||
ZeigeZeit(timeinfo, TimeX, TimeY);
|
||||
//ZeigeZeit(timeinfo, 1,40);
|
||||
ZeigeCO(1,CoY);
|
||||
@ -777,6 +783,7 @@ void loop() {
|
||||
//Serial.println("START");
|
||||
if (Aussentemp > -99.9){
|
||||
char szWetter[10];
|
||||
#ifdef FLUR
|
||||
dtostrf(TempFlur, 4, 1, szWetter);
|
||||
//Serial.print(Aussentemp); Serial.print(" "); Serial.println(szWetter);
|
||||
scroll_Grad(matrix_height-8,30," Flur: " + String(szWetter), 64,64,64, true);
|
||||
@ -784,9 +791,10 @@ void loop() {
|
||||
wenn das gesamt Laufschrift mehr
|
||||
als 30 Sekunden Dauert muss ein .... */
|
||||
client.loop();
|
||||
#endif
|
||||
/* eingeführt werden, sonst kommt es zu
|
||||
einen Socket Fehler !!!! */
|
||||
scroll_text(matrix_height-8,30,"Luftdruck: " + String(Pressure) + " hPa", 255,255,255, true);
|
||||
scroll_text(matrix_height-8,30,"Luftdruck: " + String(Pressure) + " hPa", 0,0,255, true);
|
||||
dtostrf(Aussentemp, 4, 1, szWetter);
|
||||
//Serial.print(Aussentemp); Serial.print(" "); Serial.println(szWetter);
|
||||
/* Achtung sehr wichtig,
|
||||
@ -795,7 +803,7 @@ void loop() {
|
||||
client.loop();
|
||||
/* eingeführt werden, sonst kommt es zu
|
||||
einen Socket Fehler !!!! */
|
||||
scroll_Grad(matrix_height-8,30,"Aussentemperatur: " + String(szWetter), 64,64,64, true);
|
||||
scroll_Grad(matrix_height-8,30,"Aussentemperatur: " + String(szWetter), 0,0,64, true);
|
||||
/* Achtung sehr wichtig,
|
||||
wenn das gesamt Laufschrift mehr
|
||||
als 30 Sekunden Dauert muss ein .... */
|
||||
@ -803,7 +811,7 @@ void loop() {
|
||||
/* eingeführt werden, sonst kommt es zu
|
||||
einen Socket Fehler !!!! */
|
||||
dtostrf(Luftfeuchtigkeit, 4, 1, szWetter);
|
||||
scroll_text(matrix_height-8,30,"Luftfeuchtigkeit: " + String(szWetter) + " %", 64,64,64, true);
|
||||
scroll_text(matrix_height-8,30,"Luftfeuchtigkeit: " + String(szWetter) + " %", 0,0,64, true);
|
||||
}
|
||||
if ((Akku <= GRENZWERT) && (Akku > 0)){
|
||||
scroll_text(matrix_height-8,40,"Akku: " + String(Akku) + " Volt", 255, 0, 0, true);
|
||||
|
Reference in New Issue
Block a user