Compare commits
No commits in common. "master" and "6b27dacfee798192a035781415f547703b409419" have entirely different histories.
master
...
6b27dacfee
|
@ -13,14 +13,14 @@ platform = espressif32
|
|||
board = nodemcu-32s
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
monitor_port = /dev/ttyACM0
|
||||
monitor_port = COM3
|
||||
monitor_filters = time
|
||||
upload_port = /dev/ttyACM0
|
||||
upload_port = COM3
|
||||
lib_deps =
|
||||
knolleary/PubSubClient @ 2.8
|
||||
adafruit/Adafruit GFX Library @ 1.11.3
|
||||
2dom/PxMatrix LED MATRIX library @ 1.8.2
|
||||
adafruit/Adafruit BusIO @ 1.16.1
|
||||
adafruit/Adafruit BusIO @ 1.7.2
|
||||
|
||||
build_flags =
|
||||
-DSCAN=32
|
||||
|
@ -29,7 +29,7 @@ build_flags =
|
|||
[env:debug] ; Entwicklungssystem
|
||||
build_flags = ${env.build_flags}
|
||||
-DDEBUG=1
|
||||
-DGRENZWERT=3.70
|
||||
-DGRENZWERT=3.60
|
||||
-DSTASSID=\"MagentaWLAN-RGDO\"
|
||||
-DSTAPSK=\"93329248424922704583\"
|
||||
-DGATEWAY=\"192.168.127.1\"
|
||||
|
@ -40,8 +40,7 @@ build_flags = ${env.build_flags}
|
|||
-Dmqtt_server=\"hjkmqtt.dedyn.io\"
|
||||
-Dmqtt_port=61883
|
||||
-DINNEN=\"hjk/devices/TEMPWOHNZIM/telemetry/temperature\"
|
||||
-DHUNIDITY=\"hjk/devices/TEMPWOHNZIM/telemetry/humidity\"
|
||||
;-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\"
|
||||
|
@ -68,4 +67,3 @@ build_flags = ${env.build_flags}
|
|||
-DLUFTDRUCK=\"hjk/devices/WETTERSTATIONBORIS/telemetry/pressure\"
|
||||
-DFEUCHTIGKEIT=\"hjk/devices/WETTERSTATIONBORIS/telemetry/humity\"
|
||||
-DHELLIGKEIT=\"hjk/devices/WETTERSTATIONBORIS/telemetry/Lux\"
|
||||
-DHUNIDITY=\"hjk/devices/TEMPWOHNZIM/telemetry/humidity\"
|
||||
|
|
113
src/main.cpp
113
src/main.cpp
|
@ -1,3 +1,4 @@
|
|||
|
||||
#include <Arduino.h>
|
||||
|
||||
// This is how many color levels the display shows - the more the slower the update
|
||||
|
@ -47,7 +48,7 @@ Ticker display_ticker;
|
|||
#endif
|
||||
|
||||
#define MaxErrCount 30
|
||||
const unsigned long stoerung = 1 * 60000000UL; // Minuten * Mikrosekunden für Sleep Mode
|
||||
const unsigned long stoerung = 15 * 60000000UL; // Minuten * Mikrosekunden für Sleep Mode
|
||||
unsigned long startTime;
|
||||
unsigned long endTime;
|
||||
#include <Wire.h>
|
||||
|
@ -99,7 +100,7 @@ IPAddress gateway;
|
|||
IPAddress subnet;
|
||||
IPAddress dns; // DNS-Server
|
||||
IPAddress secondarDNS;
|
||||
String hostname = "GROSSZEICHBORIS";
|
||||
String hostname = "GROSSZEICHENDISPLAY";
|
||||
int status = WL_IDLE_STATUS;
|
||||
const char* NTP_SERVER = "de.pool.ntp.org";
|
||||
const char* TZ_INFO = "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00"; // enter your time zone (https://remotemonitoringsystems.ca/time-zone-abbreviations.php)
|
||||
|
@ -115,7 +116,7 @@ const int TimeX = 1;
|
|||
const int WetterY = 32;
|
||||
const int WetterX = 18;
|
||||
|
||||
const int CoY = 41;
|
||||
const int CoY = 43;
|
||||
|
||||
|
||||
|
||||
|
@ -126,7 +127,6 @@ int Pressure = 0;
|
|||
float TempWohn = -99.90;
|
||||
float TempFlur = -99.99;
|
||||
float Luftfeuchtigkeit = 0.00;
|
||||
float LuftfeuchtigkeitWohnug = 0.00;
|
||||
float Akku = -99.00;
|
||||
int Helligkeit = 255;
|
||||
|
||||
|
@ -150,7 +150,6 @@ const char* topic_Wetter = WETTER;
|
|||
const char* topic_Pressure = LUFTDRUCK;
|
||||
const char* topic_Luftfeuchtigkeit = FEUCHTIGKEIT;
|
||||
const char* topic_Helligkeit = HELLIGKEIT;
|
||||
const char* topic_Humidity = HUNIDITY;
|
||||
#ifdef FLUR
|
||||
const char* topic_Flur = FLUR;
|
||||
#endif
|
||||
|
@ -163,6 +162,7 @@ void scroll_text2(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t
|
|||
void scroll_Grad(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB, boolean blink);
|
||||
bool getNTPtime(int sec);
|
||||
void showTime(tm localTime);
|
||||
void writeLinie();
|
||||
static uint32_t lastTime = 0; // millis() memory
|
||||
static void setup_wifi();
|
||||
|
||||
|
@ -293,12 +293,6 @@ void callback(char* topic1, byte* payload, unsigned int length) {
|
|||
Serial.println(" %");
|
||||
Luftfeuchtigkeit = atof(msg);
|
||||
}
|
||||
if(strcmp(topic1, topic_Humidity)== 0){
|
||||
Serial.print("Luftfeuchtigkeit Wohnung: ");
|
||||
Serial.print(msg);
|
||||
Serial.println(" %");
|
||||
LuftfeuchtigkeitWohnug = atof(msg);
|
||||
}
|
||||
if(strcmp(topic1, topic_Akku)== 0){
|
||||
Serial.print("Wetterstation Akku: ");
|
||||
Serial.print(msg);
|
||||
|
@ -334,15 +328,15 @@ void reconnect() {
|
|||
client.subscribe(topic_Flur);
|
||||
#endif
|
||||
client.subscribe(topic_Luftfeuchtigkeit);
|
||||
client.subscribe(topic_Humidity);
|
||||
client.subscribe(topic_Akku);
|
||||
client.subscribe(topic_Helligkeit);
|
||||
//client.subscribe("hjk/devices/WETTERSTATIONBORIS/telemetry/#");
|
||||
//client.subscribe("hjk/devices/MESSUNITTEMPBORIS/telemetry/#");
|
||||
} else {
|
||||
Serial.print("failed, rc=");
|
||||
Serial.print(client.state());
|
||||
Serial.println(" try again in 5 seconds");
|
||||
display.setCursor(1,56);
|
||||
display.print("ERROR: MQTT!!!");
|
||||
// Wait 5 seconds before retrying
|
||||
delay(5000);
|
||||
}
|
||||
}
|
||||
|
@ -468,57 +462,6 @@ void ZeigeWetter(double Wetter1, int yPos = 2, int xPos = 1)
|
|||
display.print("C");
|
||||
}
|
||||
}
|
||||
void ZeigeFeuchtigkeit(double Wetter1, int yPos = 2, int xPos = 1)
|
||||
{
|
||||
if (xPos < 2) xPos = 2;
|
||||
if (yPos < 0) yPos = 0;
|
||||
if (Wetter1 > -99.9){
|
||||
char szWetter[10];
|
||||
//Serial.print("Aussentemperatur: "); Serial.println(Wetter1,3);
|
||||
dtostrf(Wetter1, 4, 1, szWetter);
|
||||
display.setCursor(xPos, yPos);
|
||||
display.fillRect(xPos, yPos-2, 64-xPos, 8+2, (myBLACK));
|
||||
display.setTextColor(myBLUE);
|
||||
display.print(szWetter);
|
||||
display.print(" %");
|
||||
|
||||
}
|
||||
}
|
||||
void ZeigeTemperatur(float temperatur, uint16_t Color){
|
||||
char szWetter[15];
|
||||
if (temperatur > -99)
|
||||
{
|
||||
dtostrf(temperatur, 5, 1, szWetter);
|
||||
display.setFont();
|
||||
display.setCursor(1, 30);
|
||||
display.setTextColor(Color);
|
||||
display.fillRect(0, 29, 40, 9, myBLACK);
|
||||
display.print(szWetter);
|
||||
display.setCursor(31, 25);
|
||||
display.setFont(&Picopixel);
|
||||
display.print("o");
|
||||
display.setCursor(34, 36);
|
||||
display.setFont();
|
||||
display.print("C");
|
||||
display.setFont(0);
|
||||
}
|
||||
}
|
||||
void ZeigeInnenFeuchtigkeit(float Luftfeuchtigkeit){
|
||||
char szWetter[15];
|
||||
if (Luftfeuchtigkeit > 0)
|
||||
{
|
||||
dtostrf(Luftfeuchtigkeit, 2, 0, szWetter);
|
||||
display.setFont();
|
||||
display.setCursor(45, 30);
|
||||
display.setTextColor(myWHITE);
|
||||
display.fillRect(45, 30, 64, 7, myBLACK);
|
||||
display.print(szWetter);
|
||||
display.print("%");
|
||||
display.setFont(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Test()
|
||||
{
|
||||
display.setCursor(1, 40);
|
||||
|
@ -528,6 +471,17 @@ void Test()
|
|||
display.setFont();
|
||||
}
|
||||
|
||||
void writeLinie()
|
||||
{
|
||||
for (int i=0; i <= 63; i++){
|
||||
display.fillRect(0, i, 60, 1, (myGREEN));
|
||||
Serial.println(i);
|
||||
delay(1000);
|
||||
display.fillRect(1, i, 60, 1, (myBLACK));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
startTime = millis();
|
||||
Serial.begin(115200);
|
||||
|
@ -544,7 +498,7 @@ void setup() {
|
|||
// Define multiplex implemention here {BINARY, STRAIGHT} (default is BINARY)
|
||||
display.setMuxPattern(BINARY);
|
||||
|
||||
// Set the multiplex pattern {LINE, ZIGZAG,ZZAGG, ZAGGIZ, WZAGZIG, VZAG, ZAGZIG} (default is LINE)
|
||||
// Set the multiplex pattern {LINE, ZIGZAG,ZZAGG, ZZAGG, WZAGZIG, VZAG, ZAGZIG} (default is LINE)
|
||||
display.setScanPattern(LINE);
|
||||
|
||||
|
||||
|
@ -565,7 +519,7 @@ void setup() {
|
|||
|
||||
// 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)
|
||||
//display.setMuxDelay(0,1,0,0,0);
|
||||
display.setMuxDelay(0,0,0,0,0);
|
||||
|
||||
// Set the number of panels that make up the display area width (default is 1)
|
||||
//display.setPanelsWidth(2);
|
||||
|
@ -770,7 +724,6 @@ static void setup_wifi() {
|
|||
Serial.print(".");
|
||||
ErrCount ++;
|
||||
if (ErrCount >= MaxErrCount){
|
||||
Serial.print("\tKeine Kontakt zum WLAN !!!");
|
||||
endTime = millis();
|
||||
unsigned long Pause = stoerung -((endTime - startTime) * 1000); // Pause
|
||||
ESP.deepSleep(Pause); // Pause
|
||||
|
@ -792,6 +745,7 @@ void loop() {
|
|||
reconnect();
|
||||
}
|
||||
client.loop();
|
||||
//writeLinie();
|
||||
|
||||
if (millis() - lastTime >= 1000)
|
||||
{
|
||||
|
@ -799,11 +753,8 @@ void loop() {
|
|||
blinkSek = !blinkSek;
|
||||
ZeigeDatum(timeinfo, 1, 1);
|
||||
ZeigeZeit(timeinfo, TimeX, TimeY);
|
||||
ZeigeTemperatur(TempWohn, myWHITE);
|
||||
ZeigeInnenFeuchtigkeit(LuftfeuchtigkeitWohnug);
|
||||
|
||||
//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);
|
||||
|
@ -835,22 +786,17 @@ 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); */
|
||||
|
||||
/* if (timeinfo.tm_min %2 != 0){
|
||||
ZeigeWetter(double(TempWohn), WetterY,WetterX);
|
||||
}else {
|
||||
ZeigeFeuchtigkeit(double(LuftfeuchtigkeitWohnug), WetterY,WetterX);
|
||||
} */
|
||||
//ZeigeWetter(double(TempWohn), WetterY,WetterX);
|
||||
//Serial.println("START");
|
||||
if (Aussentemp > -99.9){
|
||||
char szWetter[10];
|
||||
dtostrf(TempFlur, 4, 1, szWetter);
|
||||
//dtostrf(TempFlur, 4, 1, szWetter);
|
||||
//Serial.print(Aussentemp); Serial.print(" "); Serial.println(szWetter);
|
||||
#ifdef FLUR
|
||||
scroll_Grad(matrix_height-8,30," Flur: " + String(szWetter), 64,64,64, true);
|
||||
#endif
|
||||
//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);
|
||||
|
@ -871,10 +817,15 @@ void loop() {
|
|||
einen Socket Fehler !!!! */
|
||||
dtostrf(Luftfeuchtigkeit, 4, 1, szWetter);
|
||||
scroll_text(matrix_height-8,30,"Luftfeuchtigkeit: " + String(szWetter) + " %", 64,64,64, true);
|
||||
|
||||
}
|
||||
if ((Akku <= GRENZWERT) && (Akku > 0)){
|
||||
client.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);
|
||||
} else{
|
||||
client.loop();
|
||||
scroll_text(matrix_height-8,30,"Akku: " + String(Akku) + " Volt", 0, 64, 0, true);
|
||||
}
|
||||
//Serial.println("STOP");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user