From 4b52be6a5e9ee37395ca6bfbd45295ff4ad7247f Mon Sep 17 00:00:00 2001 From: joba-1 Date: Sun, 20 Nov 2022 16:28:59 +0100 Subject: [PATCH] don't touch AP_STA mode only if Rgx is up --- tasmota/tasmota_support/support_wifi.ino | 2 +- tasmota/tasmota_xdrv_driver/xdrv_58_range_extender.ino | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index 692822384..c294c4c48 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -218,7 +218,7 @@ void WifiBegin(uint8_t flag, uint8_t channel) WifiSetMode(WIFI_STA); // Disable AP mode */ #ifdef USE_WIFI_RANGE_EXTENDER - if (WiFi.getMode() != WIFI_AP_STA) { // Preserve range extender connections (#17103) + if (WiFi.getMode() != WIFI_AP_STA || !RgxApUp()) { // Preserve range extender connections (#17103) WiFi.disconnect(true); // Delete SDK wifi config delay(200); WifiSetMode(WIFI_STA); // Disable AP mode diff --git a/tasmota/tasmota_xdrv_driver/xdrv_58_range_extender.ino b/tasmota/tasmota_xdrv_driver/xdrv_58_range_extender.ino index 88631bb27..3868dde46 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_58_range_extender.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_58_range_extender.ino @@ -149,6 +149,12 @@ typedef struct TRgxSettings RgxSettings; +// externalize to be able to protect Rgx AP from teardown +bool RgxApUp() +{ + return RgxSettings.status == RGX_CONFIGURED || RgxSettings.status == RGX_SETUP_NAPT; +} + // Check the current configuration is complete, updating RgxSettings.status void RgxCheckConfig(void) {