lower Wifi tx strength to see if it helps with connectivity

This commit is contained in:
Paul
2019-11-05 23:57:48 +01:00
parent f2682bfe04
commit 1df8a3d920

View File

@@ -201,10 +201,6 @@ uint32_t MyESP::_getInitialFreeHeap() {
// called when WiFi is connected, and used to start OTA, MQTT // called when WiFi is connected, and used to start OTA, MQTT
void MyESP::_wifiCallback(justwifi_messages_t code, char * parameter) { void MyESP::_wifiCallback(justwifi_messages_t code, char * parameter) {
if (code == MESSAGE_CONNECTED) { if (code == MESSAGE_CONNECTED) {
#if defined(ESP8266)
WiFi.setSleepMode(WIFI_NONE_SLEEP); // added to possibly fix wifi dropouts in arduino core 2.5.0
#endif
_wifi_connected = true; _wifi_connected = true;
jw.enableAPFallback(false); // Disable AP mode after initial connect was successful - test for https://github.com/proddy/EMS-ESP/issues/187 jw.enableAPFallback(false); // Disable AP mode after initial connect was successful - test for https://github.com/proddy/EMS-ESP/issues/187
@@ -514,10 +510,19 @@ void MyESP::_mqtt_setup() {
// WiFI setup // WiFI setup
void MyESP::_wifi_setup() { void MyESP::_wifi_setup() {
jw.setHostname(_general_hostname); // Set WIFI hostname jw.setHostname(_general_hostname); // Set WIFI hostname
jw.subscribe([this](justwifi_messages_t code, char * parameter) { _wifiCallback(code, parameter); });
jw.setConnectTimeout(MYESP_WIFI_CONNECT_TIMEOUT); jw.setConnectTimeout(MYESP_WIFI_CONNECT_TIMEOUT);
jw.setReconnectTimeout(MYESP_WIFI_RECONNECT_INTERVAL); jw.setReconnectTimeout(MYESP_WIFI_RECONNECT_INTERVAL);
#if defined(ESP8266)
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, slighly lowering from 20.5 to 20.0 may help stability
WiFi.setOutputPower(20.0); // in DBM
#endif
jw.subscribe([this](justwifi_messages_t code, char * parameter) { _wifiCallback(code, parameter); });
/// wmode 1 is AP, 0 is client /// wmode 1 is AP, 0 is client
if (_network_wmode == 1) { if (_network_wmode == 1) {
jw.enableAP(true); jw.enableAP(true);