Fehler wegen Laufschrift beseitigt.
This commit is contained in:
parent
4e9c46f4b3
commit
d42bbd9e63
|
@ -13,9 +13,9 @@ platform = espressif32
|
|||
board = nodemcu-32s
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
monitor_port = /dev/ttyUSB0
|
||||
monitor_port = COM3
|
||||
monitor_filters = time
|
||||
upload_port = /dev/ttyUSB0
|
||||
upload_port = COM3
|
||||
lib_deps =
|
||||
knolleary/PubSubClient @ 2.8
|
||||
adafruit/Adafruit GFX Library @ 1.11.3
|
||||
|
@ -29,7 +29,7 @@ build_flags =
|
|||
[env:debug] ; Entwicklungssystem
|
||||
build_flags = ${env.build_flags}
|
||||
-DDEBUG=1
|
||||
-DGRENZWERT=3.80
|
||||
-DGRENZWERT=3.70
|
||||
-DSTASSID=\"St.-Peters-Gasse\"
|
||||
-DSTAPSK=\"1952994784599317\"
|
||||
-DGATEWAY=\"192.168.127.1\"
|
||||
|
@ -39,8 +39,9 @@ build_flags = ${env.build_flags}
|
|||
-DSUBNET=\"255.255.255.0\"
|
||||
-Dmqtt_server=\"hjkmqtt.dedyn.io\"
|
||||
-Dmqtt_port=61883
|
||||
-DINNEN=\"hjk/devices/MESSUNITTEMPBORIS/telemetry/temperature_Htu_21\"
|
||||
-DCO2=\"hjk/devices/WETTERSTATION/telemetry/co2\"
|
||||
-DINNEN=\"hjk/devices/TEMPWOHNZIM/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\"
|
||||
-DLUFTDRUCK=\"hjk/devices/WETTERSTATION/telemetry/pressure\"
|
||||
|
@ -61,7 +62,6 @@ build_flags = ${env.build_flags}
|
|||
-Dmqtt_server=\"hjkmqtt.dedyn.io\"
|
||||
-Dmqtt_port=61883
|
||||
-DINNEN=\"hjk/devices/MESSUNITTEMPBORIS/telemetry/temperature_Htu_21\"
|
||||
-DCO2=\"hjk/devices/WETTERSTATIONBORIS/telemetry/co2\"
|
||||
-DAKKU=\"hjk/devices/WETTERSTATIONBORIS/telemetry/battery\"
|
||||
-DWETTER=\"hjk/devices/WETTERSTATIONBORIS/telemetry/temperature_Htu_21\"
|
||||
-DLUFTDRUCK=\"hjk/devices/WETTERSTATIONBORIS/telemetry/pressure\"
|
||||
|
|
81
src/main.cpp
81
src/main.cpp
|
@ -123,7 +123,8 @@ int Co2 = 0.00;
|
|||
float Covid19 = 0.00;
|
||||
float Aussentemp = -99.90;
|
||||
int Pressure = 0;
|
||||
float FlurTemp = -99.90;
|
||||
float TempWohn = -99.90;
|
||||
float TempFlur = -99.99;
|
||||
float Luftfeuchtigkeit = 0.00;
|
||||
float Akku = -99.00;
|
||||
int Helligkeit = 255;
|
||||
|
@ -141,11 +142,17 @@ char clientName[30];
|
|||
|
||||
const char* topic_Innen = INNEN;
|
||||
const char* topic_Akku = AKKU;
|
||||
#ifdef CO2
|
||||
const char* topic_Co2 = CO2;
|
||||
#endif
|
||||
const char* topic_Wetter = WETTER;
|
||||
const char* topic_Pressure = LUFTDRUCK;
|
||||
const char* topic_Luftfeuchtigkeit = FEUCHTIGKEIT;
|
||||
const char* topic_Helligkeit = HELLIGKEIT;
|
||||
#ifdef FLUR
|
||||
const char* topic_Flur = FLUR;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void callback(char* topic1, byte* payload, unsigned int length);
|
||||
|
@ -233,7 +240,7 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||
msg[length] = '\0';
|
||||
//Serial.println(msg);
|
||||
|
||||
|
||||
#ifdef CO2
|
||||
// CO2 Wert vom Sensor
|
||||
if(strcmp(topic1, topic_Co2)== 0){
|
||||
Serial.print("Co2 Sensor: ");
|
||||
|
@ -241,9 +248,10 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||
Serial.println();
|
||||
Co2 = atoi(msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Covid19 Wert
|
||||
/* if(strcmp(topic1, topic_Covid)== 0){
|
||||
/* if(strcmp(topic1, topic_Covid)== 0){
|
||||
Serial.print("Covid: ");
|
||||
Serial.print(msg);
|
||||
Serial.println();
|
||||
|
@ -267,8 +275,16 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||
Serial.print("Temperatur Innen: ");
|
||||
Serial.print(msg);
|
||||
Serial.println(" °C");
|
||||
FlurTemp = atof(msg);
|
||||
TempWohn = atof(msg);
|
||||
}
|
||||
#ifdef FLUR
|
||||
if(strcmp(topic1, topic_Flur)== 0){
|
||||
Serial.print("Temperatur Flur: ");
|
||||
Serial.print(msg);
|
||||
Serial.println(" °C");
|
||||
TempFlur = atof(msg);
|
||||
}
|
||||
#endif
|
||||
if(strcmp(topic1, topic_Luftfeuchtigkeit)== 0){
|
||||
Serial.print("Luftfeuchtigkeit: ");
|
||||
Serial.print(msg);
|
||||
|
@ -292,18 +308,23 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||
}
|
||||
}
|
||||
void reconnect() {
|
||||
sprintf(clientName, "%s%s", "Uhr", "_Zentrale3" );
|
||||
sprintf(clientName, "%s%s", "Uhr", "Zentrale4" );
|
||||
// Loop until we're reconnected
|
||||
while (!client.connected()) {
|
||||
Serial.print("Attempting MQTT connection...");
|
||||
if (client.connect(clientName)) {
|
||||
/* MQTTStatus.setPic(3); */
|
||||
Serial.println("connected");
|
||||
//client.subscribe(topic_Co2);
|
||||
#ifdef CO2
|
||||
client.subscribe(topic_Co2);
|
||||
#endif
|
||||
//client.subscribe(topic_Covid);Ja
|
||||
client.subscribe(topic_Wetter);
|
||||
client.subscribe(topic_Pressure);
|
||||
client.subscribe(topic_Innen);
|
||||
#ifdef FLUR
|
||||
client.subscribe(topic_Flur);
|
||||
#endif
|
||||
client.subscribe(topic_Luftfeuchtigkeit);
|
||||
client.subscribe(topic_Akku);
|
||||
client.subscribe(topic_Helligkeit);
|
||||
|
@ -349,7 +370,7 @@ void ZeigeZeit(tm localTime, int xPos = 2, int yPos = 8)
|
|||
display.setFont();
|
||||
}
|
||||
|
||||
/* void ZeigeCO(int xPos = 1, int yPos = 19)
|
||||
void ZeigeCO(int xPos = 1, int yPos = 19)
|
||||
{
|
||||
if (xPos < 1) xPos = 1;
|
||||
if (yPos < 19) yPos = 19;
|
||||
|
@ -390,7 +411,7 @@ void ZeigeZeit(tm localTime, int xPos = 2, int yPos = 8)
|
|||
display.print("ppm");
|
||||
display.setFont();
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
void ZeigeDatum(tm localTime, int xPos = 2, int yPos = 1)
|
||||
{
|
||||
|
@ -427,7 +448,7 @@ void ZeigeWetter(double Wetter1, int yPos = 2, int xPos = 1)
|
|||
dtostrf(Wetter1, 4, 1, szWetter);
|
||||
display.setCursor(xPos, yPos);
|
||||
display.fillRect(xPos, yPos-2, 64-xPos, 8+2, (myBLACK));
|
||||
display.setTextColor(myBLUE);
|
||||
display.setTextColor(myWHITE);
|
||||
display.print(szWetter);
|
||||
// Erzeuge Grad Zeichen ......
|
||||
display.setCursor(xPos+24, yPos-5);
|
||||
|
@ -481,7 +502,7 @@ void setup() {
|
|||
display.setMuxPattern(BINARY);
|
||||
|
||||
// Set the color order {RRGGBB, RRBBGG, GGRRBB, GGBBRR, BBRRGG, BBGGRR} (default is RRGGBB)
|
||||
display.setColorOrder(RRGGBB);
|
||||
display.setColorOrder(BBRRGG);
|
||||
|
||||
// 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)
|
||||
|
@ -507,11 +528,11 @@ void setup() {
|
|||
display.print("Pixel");
|
||||
display.setTextColor(myYELLOW);
|
||||
display.setCursor(30,50);
|
||||
display.print("Time");
|
||||
display.print("1234");
|
||||
//--------------------------------------------------
|
||||
//--------------------------------------------------
|
||||
|
||||
delay(5000);
|
||||
delay(1000);
|
||||
print_wifi_status();
|
||||
configTime(0, 0, NTP_SERVER);
|
||||
// See https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv for Timezone codes for your region
|
||||
|
@ -706,10 +727,12 @@ static void setup_wifi() {
|
|||
|
||||
void loop() {
|
||||
|
||||
getNTPtime(10);
|
||||
if (!client.connected()) {
|
||||
reconnect();
|
||||
}
|
||||
getNTPtime(10);
|
||||
client.loop();
|
||||
|
||||
if (millis() - lastTime >= 1000)
|
||||
{
|
||||
lastTime = millis();
|
||||
|
@ -717,7 +740,7 @@ void loop() {
|
|||
ZeigeDatum(timeinfo, 1, 1);
|
||||
ZeigeZeit(timeinfo, TimeX, TimeY);
|
||||
//ZeigeZeit(timeinfo, 1,40);
|
||||
//ZeigeCO(1,CoY);
|
||||
ZeigeCO(1,CoY);
|
||||
/* if ((timeinfo.tm_min % 10) == 0){
|
||||
/* if (Covid19 != 0){
|
||||
scroll_text(matrix_height-8,20,"Landkreis Heilbronn", 30,30,30, true);
|
||||
|
@ -749,13 +772,35 @@ void loop() {
|
|||
scroll_text2(matrix_height-24,20,"ich w\201nsche Euch allen ein", 128,128,0, true);
|
||||
scroll_text2(matrix_height-24,20,"Frohes neues Jahr 2022.", 128,255,0, true); */
|
||||
|
||||
ZeigeWetter(double(FlurTemp), WetterY,WetterX);
|
||||
ZeigeWetter(double(TempWohn), WetterY,WetterX);
|
||||
//Serial.println("START");
|
||||
if (Aussentemp > -99.9){
|
||||
scroll_text(matrix_height-8,30,"Luftdruck: " + String(Pressure) + " hPa", 255,255,255, true);
|
||||
char szWetter[10];
|
||||
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);
|
||||
/* Achtung sehr wichtig,
|
||||
wenn das gesamt Laufschrift mehr
|
||||
als 30 Sekunden Dauert muss ein .... */
|
||||
client.loop();
|
||||
/* eingeführt werden, sonst kommt es zu
|
||||
einen Socket Fehler !!!! */
|
||||
scroll_text(matrix_height-8,30,"Luftdruck: " + String(Pressure) + " hPa", 255,255,255, true);
|
||||
dtostrf(Aussentemp, 4, 1, szWetter);
|
||||
//Serial.print(Aussentemp); Serial.print(" "); Serial.println(szWetter);
|
||||
/* Achtung sehr wichtig,
|
||||
wenn das gesamt Laufschrift mehr
|
||||
als 30 Sekunden Dauert muss ein .... */
|
||||
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);
|
||||
/* Achtung sehr wichtig,
|
||||
wenn das gesamt Laufschrift mehr
|
||||
als 30 Sekunden Dauert muss ein .... */
|
||||
client.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);
|
||||
}
|
||||
|
@ -763,8 +808,8 @@ void loop() {
|
|||
scroll_text(matrix_height-8,40,"Akku: " + String(Akku) + " Volt", 255, 0, 0, true);
|
||||
scroll_text(matrix_height-8,40,"Akku aufladen!", 255, 0, 0, true);
|
||||
}
|
||||
//Serial.println("STOP");
|
||||
}
|
||||
client.loop();
|
||||
}
|
||||
|
||||
bool getNTPtime(int sec) {
|
||||
|
@ -782,7 +827,7 @@ bool getNTPtime(int sec) {
|
|||
/* char time_output[30];
|
||||
strftime(time_output, 30, "%a %d-%m-%y %T", localtime(&now));
|
||||
Serial.println(time_output);
|
||||
Serial.println(); */
|
||||
Serial.println(12); */
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user