Increase wifi retry time (#14394)

- Increase wifi retry time (#14394)
- Remove 1 second system hang on wifi re-connect (retry)
- Try to limit the number of seconds unresponsiveness due to wifi reconnect
This commit is contained in:
Theo Arends 2022-06-10 14:49:35 +02:00
parent e73828cade
commit 3a22874124
5 changed files with 12 additions and 8 deletions

View File

@ -7,7 +7,8 @@ All notable changes to this project will be documented in this file.
### Added
- Support for HYTxxx temperature and humidity sensor (#15715)
- Support for Sensirion SHT4X using define USE_SHT3X (#15349)
- Command ``SSerialSend9 0/1`` to enable Serial Bridge console Tee for debugging purposes
- Command ``SSerialSend9 1`` to enable Serial Bridge console Tee for debugging purposes
- Command ``SetOption142 1`` to wait 1 second for wifi connection solving some FRITZ!Box modem issues (#14985)
### Changed
- Restructured tasmota source directories taking benefit from PlatformIO Core v6.0.2

View File

@ -112,6 +112,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Command ``SetOption139 0/1`` to switch between pressure unit "mmHg" (0) or "inHg" (1) when ``SO24 1`` [#15350](https://github.com/arendst/Tasmota/issues/15350)
- Command ``SetOption140 0/1`` to switch between MQTT Clean Session (0) or Persistent Session (1) [#15530](https://github.com/arendst/Tasmota/issues/15530)
- Command ``SetOption141 1`` to disable display of module name in GUI header
- Command ``SetOption142 1`` to wait 1 second for wifi connection solving some FRITZ!Box modem issues [#14985](https://github.com/arendst/Tasmota/issues/14985)
- Command ``EnergyExportActive<phase>`` to (p)reset energy export active for supported devices. Currently ADE7880 only [#13515](https://github.com/arendst/Tasmota/issues/13515)
- Command ``IfxRp ""|<policy>`` adds optional InfluxDb Retention Policy [#15513](https://github.com/arendst/Tasmota/issues/15513)
- Command ``SspmDisplay 2`` to display Sonoff SPM energy data in GUI for user tab-selected relay modules [#13447](https://github.com/arendst/Tasmota/issues/13447)

View File

@ -169,7 +169,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t mm_vs_inch : 1; // bit 25 (v11.1.0.1) - SetOption139 - (Pressure) Switch between mmHg (0) or inHg (1) when SO24 1
uint32_t mqtt_persistent : 1; // bit 26 (v11.1.0.1) - SetOption140 - (MQTT) MQTT clean session (0 = default) or persistent session (1)
uint32_t gui_module_name : 1; // bit 27 (v11.1.0.3) - SetOption141 - (GUI) Disable display of GUI module name (1)
uint32_t spare28 : 1; // bit 28
uint32_t wait_for_wifi_result : 1; // bit 28 (v11.1.0.4) - SetOption142 - (Wifi) Wait 1 second for wifi connection solving some FRITZ!Box modem issues (1)
uint32_t spare29 : 1; // bit 29
uint32_t spare30 : 1; // bit 30
uint32_t spare31 : 1; // bit 31

View File

@ -33,7 +33,7 @@
#define WIFI_RESCAN_MINUTES 44 // Number of minutes between wifi network rescan
#endif
#ifndef WIFI_RETRY_SECONDS
#define WIFI_RETRY_SECONDS 12 // Number of seconds connection to wifi network will retry
#define WIFI_RETRY_SECONDS 20 // Number of seconds connection to wifi network will retry
#endif
const uint8_t WIFI_CONFIG_SEC = 180; // seconds before restart
@ -237,7 +237,9 @@ void WifiBegin(uint8_t flag, uint8_t channel)
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s%s " D_IN_MODE " 11%c " D_AS " %s..."),
Settings->sta_active +1, SettingsText(SET_STASSID1 + Settings->sta_active), stemp, pgm_read_byte(&kWifiPhyMode[WiFi.getPhyMode() & 0x3]), TasmotaGlobal.hostname);
WiFi.waitForConnectResult(1000);
if (Settings->flag5.wait_for_wifi_result) { // SetOption142 - (Wifi) Wait 1 second for wifi connection solving some FRITZ!Box modem issues (1)
WiFi.waitForConnectResult(1000); // https://github.com/arendst/Tasmota/issues/14985
}
#if LWIP_IPV6
for (bool configured = false; !configured;) {
@ -421,7 +423,7 @@ void WifiCheckIp(void) {
} else {
WifiSetState(0);
uint8_t wifi_config_tool = Settings->sta_config;
Wifi.status = WiFi.status();
Wifi.status = (Wifi.retry &1) ? WiFi.status() : 0; // Skip every second to reset result WiFi.status()
switch (Wifi.status) {
case WL_CONNECTED:
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECT_FAILED_NO_IP_ADDRESS));
@ -483,13 +485,12 @@ void WifiCheckIp(void) {
WifiBegin(2, 0); // Select alternate SSID
}
}
Wifi.counter = 1;
Wifi.retry--;
} else {
WifiConfig(wifi_config_tool);
Wifi.counter = 1;
Wifi.retry = Wifi.retry_init;
}
Wifi.counter = 1; // Re-check in 1 second
}
}

View File

@ -196,7 +196,8 @@ a_setoption = [[
"(Pressure) Switch between mmHg (0) or inHg (1) when SO24 1",
"(MQTT) MQTT clean session (0 = default) or persistent session (1)",
"(GUI) Disable display of GUI module name (1)",
"","","",""
"(Wifi) Wait 1 second for wifi connection solving some FRITZ!Box modem issues (1)",
"","",""
],[
"","","","",
"","","","",