diff --git a/README.md b/README.md index 46c76619f68f..805c68d84276 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute! ### Development [![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota) -Current version is **6.1.0a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **6.1.0b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. ### Disclaimer :warning: **DANGER OF ELECTROCUTION** :warning: diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index e5c92d8e820f..a06fc3dcb367 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,10 @@ -/* 6.1.0a +/* 6.1.0b + * Add user selection of WPS as define USE_WPS in user_config.h in preparation for core v2.4.2 (#3221) + * Change default Wifi config option from WPS to Wifi Manager if WPS is disabled (or Wifi Smartconfig if webserver is disabled) + * Remove WPS from sonoff-minimal saving 33k code space + * Revert wifi changes implemented in v6.0.0a due to possible bad initial wifi connections + * + * 6.1.0a * Fix TM1638 compile error (#3212) * Add TM1638 switch support (#2226) * Fix invalid response using more than 4 switches and domoticz diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index d27951a80bdb..03a459a4e88e 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -111,6 +111,8 @@ typedef unsigned long power_t; // Power (Relay) type #define SERIAL_POLLING 100 // Serial receive polling in ms #define MAX_STATUS 11 // Max number of status lines +#define NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions) + /* // Removed from esp8266 core since 20171105 #define min(a,b) ((a)<(b)?(a):(b)) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 01051db1fa62..fcbe4937b0ab 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,7 +25,7 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x06010001 // 6.1.0a +#define VERSION 0x06010002 // 6.1.0b // Location specific includes #include // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0) diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 9c9aab0f6b76..4f8f9a19db93 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -167,6 +167,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_ENERGY_SENSOR // Disable energy sensors #undef USE_ARDUINO_OTA // Disable support for Arduino OTA +#undef USE_WPS // Disable support for WPS as initial wifi configuration tool #undef USE_DOMOTICZ // Disable Domoticz #undef USE_HOME_ASSISTANT // Disable Home Assistant #undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set @@ -207,6 +208,10 @@ void KNX_CB_Action(message_t const &msg, void *arg); * Mandatory defines satisfying possible disabled defines \*********************************************************************************************/ +#ifndef USE_WPS // See https://github.com/esp8266/Arduino/pull/4889 +#undef NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions) +#endif + #ifndef SWITCH_MODE #define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state) #endif diff --git a/sonoff/support.ino b/sonoff/support.ino index f1d260bf260e..70ece6fca251 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -980,6 +980,16 @@ void WifiConfig(uint8_t type) #endif // USE_EMULATION WiFi.disconnect(); // Solve possible Wifi hangs wifi_config_type = type; +#ifndef USE_WPS + if (WIFI_WPSCONFIG == wifi_config_type) { + wifi_config_type = WIFI_MANAGER; + } +#endif // USE_WPS +#ifndef USE_WEBSERVER + if (WIFI_MANAGER == wifi_config_type) { + wifi_config_type = WIFI_SMARTCONFIG; + } +#endif // USE_WPS wifi_config_counter = WIFI_CONFIG_SEC; // Allow up to WIFI_CONFIG_SECS seconds for phone to provide ssid/pswd wifi_counter = wifi_config_counter +5; blinks = 1999; @@ -990,6 +1000,7 @@ void WifiConfig(uint8_t type) AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_1_SMARTCONFIG " " D_ACTIVE_FOR_3_MINUTES)); WiFi.beginSmartConfig(); } +#ifdef USE_WPS else if (WIFI_WPSCONFIG == wifi_config_type) { if (WifiWpsConfigBegin()) { AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG " " D_ACTIVE_FOR_3_MINUTES)); @@ -998,6 +1009,7 @@ void WifiConfig(uint8_t type) wifi_config_counter = 3; } } +#endif // USE_WPS #ifdef USE_WEBSERVER else if (WIFI_MANAGER == wifi_config_type) { AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); @@ -1142,9 +1154,11 @@ void WifiCheck(uint8_t param) if ((WIFI_SMARTCONFIG == wifi_config_type) && WiFi.smartConfigDone()) { wifi_config_counter = 0; } +#ifdef USE_WPS if ((WIFI_WPSCONFIG == wifi_config_type) && WifiWpsConfigDone()) { wifi_config_counter = 0; } +#endif // USE_WPS if (!wifi_config_counter) { if (strlen(WiFi.SSID().c_str())) { strlcpy(Settings.sta_ssid[0], WiFi.SSID().c_str(), sizeof(Settings.sta_ssid[0])); @@ -1161,7 +1175,7 @@ void WifiCheck(uint8_t param) if (WIFI_SMARTCONFIG == wifi_config_type) { WiFi.stopSmartConfig(); } - SettingsSdkErase(); +// SettingsSdkErase(); // Disabled v6.1.0b due to possible bad wifi connects restart_flag = 2; } } else { @@ -1244,6 +1258,8 @@ void WifiConnect() wifi_counter = 1; } +/* +// Enable from 6.0.0a until 6.1.0a - disabled due to possible cause of bad wifi connect on core 2.3.0 void WifiDisconnect() { // Courtesy of EspEasy @@ -1256,10 +1272,17 @@ void WifiDisconnect() void EspRestart() { - delay(100); // Allow time for message xfer + // This results in exception 3 on restarts + delay(100); // Allow time for message xfer - disabled v6.1.0b WifiDisconnect(); ESP.restart(); } +*/ + +void EspRestart() +{ + ESP.restart(); +} #ifdef USE_DISCOVERY /*********************************************************************************************\ diff --git a/sonoff/user_config.h b/sonoff/user_config.h index f54cf865f010..c9575b126dbf 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -65,6 +65,7 @@ #define STA_PASS2 "" // [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_WAIT) + // *** NOTE: When WPS is disabled by USE_WPS below, WIFI_WPSCONFIG will execute WIFI_MANAGER *** // -- Syslog -------------------------------------- #define SYS_LOG_HOST "" // [LogHost] (Linux) syslog host @@ -178,8 +179,6 @@ * - Disable a feature by preceding it with // \*********************************************************************************************/ -//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code) - // -- Localization -------------------------------- // If non selected the default en-GB will be used //#define MY_LANGUAGE bg-BG // Bulgarian in Bulgaria @@ -200,6 +199,12 @@ //#define MY_LANGUAGE zh-CN // Chinese (Simplified) in China //#define MY_LANGUAGE zh-TW // Chinese (Traditional) in Taiwan +// -- WPS ----------------------------------------- +//#define USE_WPS // Add support for WPS as initial wifi configuration tool (+33k code, 1k mem (5k mem with core v2.4.2+)) + +// -- OTA ----------------------------------------- +//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code) + /*-------------------------------------------------------------------------------------------*\ * Select ONE of possible three MQTT library types below \*-------------------------------------------------------------------------------------------*/ @@ -314,7 +319,7 @@ //#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code) -#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB +#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code) /*********************************************************************************************\ * Debug features are only supported in development branch