mirror of https://github.com/arendst/Tasmota.git
v5.7.1g - Add wificonfig option 5 (WIFI_WAIT)
5.7.1g * Add option WIFI_WAIT (5) to command WifiConfig to allow connection retry to same AP without restart or update flash (#772, #869)
This commit is contained in:
parent
cb0410a5dc
commit
e015b574e6
|
@ -1,7 +1,7 @@
|
|||
## Sonoff-Tasmota
|
||||
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
|
||||
|
||||
Current version is **5.7.1f** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
Current version is **5.7.1g** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
|
||||
### ATTENTION All versions
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
/* 5.7.1f
|
||||
/* 5.7.1g
|
||||
* Add option WIFI_WAIT (5) to command WifiConfig to allow connection retry to same AP without restart or update flash (#772, #869)
|
||||
*
|
||||
* 5.7.1f
|
||||
* Reduce code and string length for output of commands Modules and GPIOs
|
||||
* Add optional dimmer parameter to command Wakeup (#867)
|
||||
* Add optional dimmer parameter to command Wakeup for AiLight, Sonoff B1, Led and BN-SZ01 (#867)
|
||||
*
|
||||
* 5.7.1e
|
||||
* Add Sonoff SC debug information
|
||||
|
|
|
@ -44,12 +44,13 @@ const char commands[MAX_BUTTON_COMMANDS][14] PROGMEM = {
|
|||
D_CMND_WIFICONFIG " 3", // Press button five times
|
||||
D_CMND_RESTART " 1", // Press button six times
|
||||
D_CMND_UPGRADE " 1" }; // Press button seven times
|
||||
const char wificfg[5][WCFG_MAX_STRING_LENGTH] PROGMEM = {
|
||||
const char wificfg[MAX_WIFI_OPTION][WCFG_MAX_STRING_LENGTH] PROGMEM = {
|
||||
D_WCFG_0_RESTART,
|
||||
D_WCFG_1_SMARTCONFIG,
|
||||
D_WCFG_2_WIFIMANAGER,
|
||||
D_WCFG_3_WPSCONFIG,
|
||||
D_WCFG_4_RETRY };
|
||||
D_WCFG_4_RETRY,
|
||||
D_WCFG_5_WAIT };
|
||||
const char PREFIXES[3][PRFX_MAX_STRING_LENGTH] PROGMEM = {
|
||||
D_CMND,
|
||||
D_STAT,
|
||||
|
|
|
@ -589,6 +589,7 @@
|
|||
#define D_WCFG_2_WIFIMANAGER "WifiManager"
|
||||
#define D_WCFG_3_WPSCONFIG "WPSConfig"
|
||||
#define D_WCFG_4_RETRY "Retry"
|
||||
#define D_WCFG_5_WAIT "Wait"
|
||||
#define D_CMND_FRIENDLYNAME "FriendlyName"
|
||||
#define D_CMND_SWITCHMODE "SwitchMode"
|
||||
#define D_CMND_WEBSERVER "Webserver"
|
||||
|
|
|
@ -589,6 +589,7 @@
|
|||
#define D_WCFG_2_WIFIMANAGER "WifiManager"
|
||||
#define D_WCFG_3_WPSCONFIG "WPSConfig"
|
||||
#define D_WCFG_4_RETRY "Opnieuw"
|
||||
#define D_WCFG_5_WAIT "Wacht"
|
||||
#define D_CMND_FRIENDLYNAME "FriendlyName"
|
||||
#define D_CMND_SWITCHMODE "SwitchMode"
|
||||
#define D_CMND_WEBSERVER "Webserver"
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
|
||||
====================================================*/
|
||||
|
||||
#define VERSION 0x05070106 // 5.7.1f
|
||||
#define VERSION 0x05070107 // 5.7.1g
|
||||
|
||||
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
|
||||
enum week_t {Last, First, Second, Third, Fourth};
|
||||
enum dow_t {Sun=1, Mon, Tue, Wed, Thu, Fri, Sat};
|
||||
enum month_t {Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec};
|
||||
enum wifi_t {WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, MAX_WIFI_OPTION};
|
||||
enum wifi_t {WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT, MAX_WIFI_OPTION};
|
||||
enum swtch_t {TOGGLE, FOLLOW, FOLLOW_INV, PUSHBUTTON, PUSHBUTTON_INV, PUSHBUTTONHOLD, PUSHBUTTONHOLD_INV, MAX_SWITCH_OPTION};
|
||||
enum led_t {LED_OFF, LED_POWER, LED_MQTTSUB, LED_POWER_MQTTSUB, LED_MQTTPUB, LED_POWER_MQTTPUB, LED_MQTT, LED_POWER_MQTT, MAX_LED_OPTION};
|
||||
enum emul_t {EMUL_NONE, EMUL_WEMO, EMUL_HUE, EMUL_MAX};
|
||||
|
@ -1375,7 +1375,7 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
|
|||
else if (!strcasecmp_P(type, PSTR(D_CMND_SSID)) && (index > 0) && (index <= 2)) {
|
||||
if ((data_len > 0) && (data_len < sizeof(sysCfg.sta_ssid[0]))) {
|
||||
strlcpy(sysCfg.sta_ssid[index -1], (1 == payload) ? (1 == index) ? STA_SSID1 : STA_SSID2 : dataBuf, sizeof(sysCfg.sta_ssid[0]));
|
||||
sysCfg.sta_active = 0;
|
||||
sysCfg.sta_active = index -1;
|
||||
restartflag = 2;
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_SSID "%d\":\"%s\"}"), index, sysCfg.sta_ssid[index -1]);
|
||||
|
@ -1383,7 +1383,7 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
|
|||
else if (!strcasecmp_P(type, PSTR(D_CMND_PASSWORD)) && (index > 0) && (index <= 2)) {
|
||||
if ((data_len > 0) && (data_len < sizeof(sysCfg.sta_pwd[0]))) {
|
||||
strlcpy(sysCfg.sta_pwd[index -1], (1 == payload) ? (1 == index) ? STA_PASS1 : STA_PASS2 : dataBuf, sizeof(sysCfg.sta_pwd[0]));
|
||||
sysCfg.sta_active = 0;
|
||||
sysCfg.sta_active = index -1;
|
||||
restartflag = 2;
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_PASSWORD "%d\":\"%s\"}"), index, sysCfg.sta_pwd[index -1]);
|
||||
|
|
|
@ -416,7 +416,7 @@ boolean WIFI_beginWPSConfig(void)
|
|||
void WIFI_config(uint8_t type)
|
||||
{
|
||||
if (!_wificonfigflag) {
|
||||
if (WIFI_RETRY == type) {
|
||||
if (type >= WIFI_RETRY) { // WIFI_RETRY and WIFI_WAIT
|
||||
return;
|
||||
}
|
||||
#ifdef USE_EMULATION
|
||||
|
@ -518,11 +518,15 @@ void WIFI_check_ip()
|
|||
break;
|
||||
case WL_NO_SSID_AVAIL:
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_NOT_REACHED));
|
||||
if (_wifiretry > (WIFI_RETRY_SEC / 2)) {
|
||||
_wifiretry = WIFI_RETRY_SEC / 2;
|
||||
}
|
||||
else if (_wifiretry) {
|
||||
_wifiretry = 0;
|
||||
if (WIFI_WAIT == sysCfg.sta_config) {
|
||||
_wifiretry = WIFI_RETRY_SEC;
|
||||
} else {
|
||||
if (_wifiretry > (WIFI_RETRY_SEC / 2)) {
|
||||
_wifiretry = WIFI_RETRY_SEC / 2;
|
||||
}
|
||||
else if (_wifiretry) {
|
||||
_wifiretry = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WL_CONNECT_FAILED:
|
||||
|
@ -543,9 +547,9 @@ void WIFI_check_ip()
|
|||
}
|
||||
if (_wifiretry) {
|
||||
if (WIFI_RETRY_SEC == _wifiretry) {
|
||||
WIFI_begin(3); // Select default SSID
|
||||
WIFI_begin(3); // Select default SSID
|
||||
}
|
||||
if ((WIFI_RETRY_SEC / 2) == _wifiretry) {
|
||||
if ((sysCfg.sta_config != WIFI_WAIT) && ((WIFI_RETRY_SEC / 2) == _wifiretry)) {
|
||||
WIFI_begin(2); // Select alternate SSID
|
||||
}
|
||||
_wificounter = 1;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#define STA_SSID2 "indebuurt2" // [Ssid2] Optional alternate AP Wifi SSID
|
||||
#define STA_PASS2 "VnsqrtnrsddbrN" // [Password2] Optional alternate AP Wifi password
|
||||
#define WIFI_CONFIG_TOOL WIFI_WPSCONFIG // [WifiConfig] Default tool if wifi fails to connect
|
||||
// (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY)
|
||||
// (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT)
|
||||
|
||||
// -- Syslog --------------------------------------
|
||||
#define SYS_LOG_HOST "domus1" // [LogHost] (Linux) syslog host
|
||||
|
|
Loading…
Reference in New Issue