From 1f44bf5790f26c4f4aebb1ddca98bc4924610a7c Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Fri, 20 Sep 2019 15:24:45 +0300 Subject: [PATCH] WiFi: Configure TX power (#1915) --- code/espurna/config/general.h | 9 +++++++++ code/espurna/wifi.ino | 3 +++ 2 files changed, 12 insertions(+) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 592ecc32..ef8742f8 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -578,6 +578,15 @@ #define WIFI_GRATUITOUS_ARP_INTERVAL_MAX 30000 #endif +// ref: https://github.com/esp8266/Arduino/issues/6471 +// ref: https://github.com/esp8266/Arduino/issues/6366 +// +// Issue #6366 turned out to be high tx power causing weird behavior. Lowering tx power achieved stability. +#ifndef WIFI_OUTPUT_POWER_DBM +#define WIFI_OUTPUT_POWER_DBM 20.0 +#endif + + // ----------------------------------------------------------------------------- // WEB // ----------------------------------------------------------------------------- diff --git a/code/espurna/wifi.ino b/code/espurna/wifi.ino index 355ce554..993e7bbf 100644 --- a/code/espurna/wifi.ino +++ b/code/espurna/wifi.ino @@ -104,6 +104,9 @@ void _wifiConfigure() { )).toInt(); #endif + const auto tx_power = getSetting("wifiTxPwr", WIFI_OUTPUT_POWER_DBM).toFloat(); + WiFi.setOutputPower(tx_power); + } void _wifiScan(uint32_t client_id = 0) {