lower Tx Wifi power to support USB powered gateway - https://github.com/proddy/EMS-ESP/issues/398

This commit is contained in:
proddy
2020-07-17 16:53:52 +02:00
parent b2081aec93
commit a0c878a4c4
2 changed files with 10 additions and 1 deletions

View File

@@ -23,6 +23,14 @@ WiFiSettingsService::WiFiSettingsService(AsyncWebServer* server, FS* fs, Securit
WiFi.onEvent(std::bind(&WiFiSettingsService::onStationModeStop, this, std::placeholders::_1, std::placeholders::_2),
WiFiEvent_t::SYSTEM_EVENT_STA_STOP);
#elif defined(ESP8266)
// proddy added
WiFi.setSleepMode(WIFI_NONE_SLEEP); // added to possibly fix wifi dropouts in arduino core 2.5.0
// ref: https://github.com/esp8266/Arduino/issues/6471
// ref: https://github.com/esp8266/Arduino/issues/6366
// high tx power causing weird behavior, slightly lowering from 20.5 to 20.0 may help stability
WiFi.setOutputPower(20.0f); // in DBM
_onStationModeDisconnectedHandler = WiFi.onStationModeDisconnected(
std::bind(&WiFiSettingsService::onStationModeDisconnected, this, std::placeholders::_1));
#endif