diff --git a/RELEASENOTES.md b/RELEASENOTES.md index ba5980add1d6..31b4b116441f 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -52,7 +52,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c ## Changelog -### Version 8.3.1.5 +### Version 8.3.1.6 - Change IRremoteESP8266 library updated to v2.7.7 - Change Adafruit_SGP30 library from v1.0.3 to v1.2.0 (#8519) @@ -62,6 +62,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add command ``Rule0`` to change global rule parameters - Add command ``Time 4`` to display timestamp using milliseconds (#8537) - Add command ``SetOption94 0/1`` to select MAX31855 or MAX6675 thermocouple support (#8616) +- Add command ``Module2`` to configure fallback module on fast reboot (#8464) - Add commands ``LedPwmOn 0..255``, ``LedPwmOff 0..255`` and ``LedPwmMode1 0/1`` to control led brightness by George (#8491) - Add ESP32 ethernet commands ``EthType 0/1``, ``EthAddress 0..31`` and ``EthClockMode 0..3`` - Add support for unique MQTTClient (and inherited fallback topic) by full Mac address using ``mqttclient DVES_%12X`` (#8300) diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index ec18a5d9680e..ed8f2a37d827 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased (development) +### 8.3.1.6 20200617 + +- Add command ``Module2`` to configure fallback module on fast reboot (#8464) + ### 8.3.1.5 20200616 - Add ESP32 ethernet commands ``EthType 0/1``, ``EthAddress 0..31`` and ``EthClockMode 0..3`` diff --git a/tasmota/settings.h b/tasmota/settings.h index 80507e97be56..0704f426f7d6 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -567,11 +567,12 @@ struct { uint16_t windmeter_pulse_debounce; // F3A int16_t windmeter_speed_factor; // F3C uint8_t windmeter_tele_pchange; // F3E - uint8_t ledpwm_on; // F3F - uint8_t ledpwm_off; // F40 + uint8_t ledpwm_on; // F3F + uint8_t ledpwm_off; // F40 uint8_t tcp_baudrate; // F41 + uint8_t fallback_module; // F42 - uint8_t free_f42[118]; // F42 - Decrement if adding new Setting variables just above and below + uint8_t free_f43[117]; // F43 - Decrement if adding new Setting variables just above and below // Only 32 bit boundary variables below uint16_t pulse_counter_debounce_low; // FB8 diff --git a/tasmota/settings.ino b/tasmota/settings.ino index a294e2813f41..dffd27964aa6 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -768,6 +768,12 @@ void SettingsDefaultSet2(void) // flag.interlock |= 0; Settings.interlock[0] = 0xFF; // Legacy support using all relays in one interlock group Settings.module = MODULE; +#ifdef ESP8266 + Settings.fallback_module = SONOFF_BASIC; +#else // ESP32 + Settings.fallback_module = WEMOS; +#endif // ESP8266 - ESP32 + Settings.fallback_module = MODULE; ModuleDefault(WEMOS); // for (uint32_t i = 0; i < ARRAY_SIZE(Settings.my_gp.io); i++) { Settings.my_gp.io[i] = GPIO_NONE; } SettingsUpdateText(SET_FRIENDLYNAME1, PSTR(FRIENDLY_NAME)); @@ -1452,12 +1458,19 @@ void SettingsDelta(void) Settings.flag4.network_wifi = 1; Settings.flag4.network_ethernet = 1; } - if (Settings.version < 0x08030105) { #ifdef ESP32 + if (Settings.version < 0x08030105) { Settings.eth_type = ETH_TYPE; Settings.eth_clk_mode = ETH_CLKMODE; Settings.eth_address = ETH_ADDR; + } #endif + if (Settings.version < 0x08030106) { +#ifdef ESP8266 + Settings.fallback_module = SONOFF_BASIC; +#else // ESP32 + Settings.fallback_module = WEMOS; +#endif // ESP8266 - ESP32 } Settings.version = VERSION; diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 5d0180005647..a901b380d995 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -1018,18 +1018,29 @@ void CmndModule(void) present = ValidTemplateModule(XdrvMailbox.payload); } if (present) { - Settings.last_module = Settings.module; - Settings.module = XdrvMailbox.payload; - SetModuleType(); - if (Settings.last_module != XdrvMailbox.payload) { - for (uint32_t i = 0; i < ARRAY_SIZE(Settings.my_gp.io); i++) { - Settings.my_gp.io[i] = GPIO_NONE; + if (XdrvMailbox.index == 2) { + Settings.fallback_module = XdrvMailbox.payload; + } else { + Settings.last_module = Settings.module; + Settings.module = XdrvMailbox.payload; + SetModuleType(); + if (Settings.last_module != XdrvMailbox.payload) { + for (uint32_t i = 0; i < ARRAY_SIZE(Settings.my_gp.io); i++) { + Settings.my_gp.io[i] = GPIO_NONE; + } } + restart_flag = 2; } - restart_flag = 2; } } - Response_P(S_JSON_COMMAND_NVALUE_SVALUE, XdrvMailbox.command, ModuleNr(), ModuleName().c_str()); + uint8_t module_real = Settings.module; + uint8_t module_number = ModuleNr(); + if (XdrvMailbox.index == 2) { + module_real = Settings.fallback_module; + module_number = (USER_MODULE == Settings.fallback_module) ? 0 : Settings.fallback_module +1; + strcat(XdrvMailbox.command, "2"); + } + Response_P(S_JSON_COMMAND_NVALUE_SVALUE, XdrvMailbox.command, module_number, AnyModuleName(module_real).c_str()); } void CmndModules(void) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 2c93f1b8846c..abc95d5d988e 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -278,12 +278,8 @@ void setup(void) { #endif } if (RtcReboot.fast_reboot_count > Settings.param[P_BOOT_LOOP_OFFSET] +4) { // Restarted 6 times -#ifdef ESP8266 - Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic - // Settings.last_module = SONOFF_BASIC; -#else // ESP32 - Settings.module = WEMOS; // Reset module to Wemos -#endif // ESP8266 - ESP32 + Settings.module = Settings.fallback_module; // Reset module to fallback module +// Settings.last_module = Settings.fallback_module; } AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count); } diff --git a/tasmota/tasmota_version.h b/tasmota/tasmota_version.h index 69146852cc8d..6b64471b0f8d 100644 --- a/tasmota/tasmota_version.h +++ b/tasmota/tasmota_version.h @@ -20,7 +20,7 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t VERSION = 0x08030105; +const uint32_t VERSION = 0x08030106; // Lowest compatible version const uint32_t VERSION_COMPATIBLE = 0x07010006;