diff --git a/platformio.ini b/platformio.ini index dd9bb0bc..15440660 100644 --- a/platformio.ini +++ b/platformio.ini @@ -129,7 +129,7 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP [env:d1_mini] board = d1_mini @@ -143,7 +143,7 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP [env:esp01_1m] board = esp01_1m @@ -159,7 +159,7 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP [env:esp01] board = esp01 @@ -174,7 +174,7 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP [env:esp07] board = esp07 @@ -188,7 +188,7 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP # see: http://docs.platformio.org/en/latest/platforms/espressif32.html [env:esp32dev] @@ -220,7 +220,7 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP [env:esp8285_4CH_H801] board = esp8285 @@ -237,7 +237,7 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP [env:esp8285_5CH_H801] board = esp8285 @@ -255,5 +255,5 @@ build_flags = lib_deps = ${common.lib_deps_external} lib_compat_mode = strict -lib_ignore = AsynTCP +lib_ignore = AsyncTCP diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 07e49cea..a3ba54a2 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -62,7 +62,12 @@ AP opens:
-AP IP: Not active
+AP IP: Not active
+

Experimental

+Disable WiFi sleep:
+Can help with connectivity issues.
+Do not enable if WiFi is working correctly, increases power consumption.
+
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 0a38a37a..746f98d0 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -38,6 +38,9 @@ #include #include #include + extern "C" { + #include + } #else #include #include "esp_wifi.h" @@ -120,6 +123,8 @@ byte apBehavior = AP_BEHAVIOR_BOOT_NO_CONN; //access point opens when no conne IPAddress staticIP(0, 0, 0, 0); //static IP of ESP IPAddress staticGateway(0, 0, 0, 0); //gateway (router) IP IPAddress staticSubnet(255, 255, 255, 0); //most common subnet in home networks +bool noWifiSleep = false; //disabling modem sleep modes will increase heat output and power usage, but may help with connection issues + //LED CONFIG uint16_t ledCount = 30; //overcurrent prevented by ABL diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index bc19bd1d..40b01ae5 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -6,7 +6,7 @@ #define EEPSIZE 2560 //eeprom Version code, enables default settings instead of 0 init on update -#define EEPVER 15 +#define EEPVER 16 //0 -> old version, default //1 -> 0.4p 1711272 and up //2 -> 0.4p 1711302 and up @@ -23,6 +23,7 @@ //13-> 0.9.0-dev //14-> 0.9.0-b1 //15-> 0.9.0-b3 +//16-> 0.9.1 void commit() { @@ -131,6 +132,8 @@ void saveSettingsToEEPROM() EEPROM.write(368, abs(arlsOffset)); EEPROM.write(369, turnOnAtBoot); + EEPROM.write(370, noWifiSleep); + EEPROM.write(372, useRGBW); EEPROM.write(374, strip.paletteFade); EEPROM.write(375, strip.milliampsPerLed); //was apWaitTimeSecs up to 0.8.5 @@ -484,6 +487,11 @@ void loadSettingsFromEEPROM(bool first) DMXMode = DMX_MODE_MULTIPLE_RGB; } + //if (lastEEPROMversion > 15) + //{ + noWifiSleep = EEPROM.read(370); + //} + receiveDirect = !EEPROM.read(2200); notifyMacro = EEPROM.read(2201); diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index 731d71ac..3a7e12ba 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -194,6 +194,8 @@ void getSettingsJS(byte subPage, char* dest) sappends('s',"AP",fapass); sappend('v',"AC",apChannel); + sappend('c',"WS",noWifiSleep); + if (WiFi.localIP()[0] != 0) //is connected { diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 8ee395c3..6655dafd 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -46,6 +46,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) if (passlen == 0 || (passlen > 7 && !isAsterisksOnly(request->arg("AP").c_str(), 65))) strlcpy(apPass, request->arg("AP").c_str(), 65); int t = request->arg("AC").toInt(); if (t > 0 && t < 14) apChannel = t; + noWifiSleep = request->hasArg("WS"); + char k[3]; k[2] = 0; for (int i = 0; i<4; i++) { diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index b26358cb..8d41756b 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -190,9 +190,14 @@ void initConnection() #ifdef ESP8266 WiFi.hostname(serverDescription); #endif + WiFi.begin(clientSSID, clientPass); + #ifdef ARDUINO_ARCH_ESP32 + if (noWifiSleep) WiFi.setSleep(false); WiFi.setHostname(serverDescription); + #else + if (noWifiSleep) wifi_set_sleep_type(NONE_SLEEP_T); #endif } diff --git a/wled00/wled17_mqtt.ino b/wled00/wled17_mqtt.ino index efc308a9..aa72b9e1 100644 --- a/wled00/wled17_mqtt.ino +++ b/wled00/wled17_mqtt.ino @@ -129,6 +129,7 @@ bool initMqtt() strcpy(mqttStatusTopic, mqttDeviceTopic); strcat(mqttStatusTopic, "/status"); mqtt->setWill(mqttStatusTopic, 0, true, "offline"); + mqtt->setKeepAlive(60); mqtt->connect(); return true; }