From e7c8f481183821cd7332ec472a17a7508c1297b4 Mon Sep 17 00:00:00 2001 From: hans-jurgen Date: Wed, 4 Jun 2025 19:51:46 +0200 Subject: [PATCH] 2025-05-0400 --- platformio.ini | 2 +- src/main.cpp | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/platformio.ini b/platformio.ini index bc0ed5e..326c66b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,4 +1,4 @@ -; PlatformIO Project Configuration File + ; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags diff --git a/src/main.cpp b/src/main.cpp index 4c9e640..6cd451a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -105,12 +105,19 @@ u_int16_t StartderAbdunklung = 20; u_int16_t EndederAbdunklung = 7; // Wifi -char ssid[] = "MagentaWLAN-RGDO"; // your network SSID (name) +/* char ssid[] = "MagentaWLAN-RGDO"; // your network SSID (name) char pass[] = "93329248424922704583"; // your network password IPAddress ip( 192, 168, 127, 52); IPAddress gateway( 192, 168, 127, 1 ); IPAddress subnet( 255, 255, 255, 0 ); -IPAddress dns(192, 168, 127, 1); // DNS-Server +IPAddress dns(192, 168, 127, 1); // DNS-Server */ + +char ssid[] = "Vodafone-3EAC"; // your network SSID (name) +char pass[] = "K7arbc4gGFC6tbY3"; // your network password +IPAddress ip( 192, 168, 0, 52); +IPAddress gateway( 192, 0, 127, 1 ); +IPAddress subnet( 255, 255, 255, 0 ); +IPAddress dns(192, 168, 0, 1); // DNS-Server String hostname = "DISPLAY"; int status = WL_IDLE_STATUS; const char* NTP_SERVER = "de.pool.ntp.org"; @@ -757,7 +764,7 @@ void setup() { // See https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv for Timezone codes for your region setenv("TZ", TZ_INFO, 1); - if (getNTPtime(10)) { // wait up to 10sec to sync + if (getNTPtime(100)) { // wait up to 10sec to sync } else { Serial.println("Time not set"); delay(5000); @@ -898,12 +905,12 @@ static void setup_wifi() { Serial.print(ssid); Serial.print(" "); - // WiFi.forceSleepWake(); + //WiFi.forceSleepWake(); delay( 1 ); - WiFi.persistent( false ); + /* WiFi.persistent( false ); WiFi.setHostname(hostname.c_str()); //define hostname - WiFi.mode( WIFI_STA ); - WiFi.config( ip, gateway, subnet, dns, dns ); + WiFi.mode( WIFI_STA ); */ + //WiFi.config( ip, gateway, subnet, dns); WiFi.begin(ssid, pass); @@ -912,7 +919,7 @@ static void setup_wifi() { Serial.print("."); ErrCount ++; if (ErrCount >= MaxErrCount){ - delay(100); + delay(500); ESP.restart(); } } @@ -921,6 +928,20 @@ static void setup_wifi() { client.setCallback(callback); Serial.print("IP address: \t"); Serial.println(WiFi.localIP()); + + /* Serial.begin(115200); + Serial.print("Connecting to: "); + Serial.println(ssid); + WiFi.begin(ssid, pass); + + while(WiFi.status() != WL_CONNECTED){ + delay(500); + Serial.print("."); + } + Serial.println(""); + Serial.println("WiFi connected"); + Serial.print("IP-Address of ESP8266 module: "); + Serial.println(WiFi.localIP()); */ }