diff --git a/CHANGELOG.md b/CHANGELOG.md index 92614722a..2dcebb4ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. - Removed delays in TasmotaSerial and TasmotaModbus Tx enable switching - Increase rule event buffer from 100 to 256 characters (#16943) - All calls to atof() into CharToFloat() reducing code size by 8k +- Keep webserver enabled on command ``upload`` ### Fixed - Energy dummy switched voltage and power regression from v12.2.0.2 diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 5a621fc88..7d1a23e47 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -126,6 +126,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - ESP32 Framework (Core) from v2.0.5.3 to v2.0.6 (IPv6 support) - Energy totals max supported value from +/-21474.83647 to +/-2147483.647 kWh - Removed delays in TasmotaSerial and TasmotaModbus Tx enable switching +- Keep webserver enabled on command ``upload`` - Increase rule event buffer from 100 to 256 characters [#16943](https://github.com/arendst/Tasmota/issues/16943) - TuyaMcu rewrite by btsimonh [#17051](https://github.com/arendst/Tasmota/issues/17051) - Tasmota OTA scripts now support both unzipped and gzipped file uploads [#17378](https://github.com/arendst/Tasmota/issues/17378) diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index 911df0171..fdc87cc1d 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -388,7 +388,7 @@ enum LightTypes { LT_BASIC, LT_PWM1, LT_PWM2, LT_PWM3, LT_PWM4, LT enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_PIN_STATE, FUNC_I2C_INIT, FUNC_MODULE_INIT, FUNC_PRE_INIT, FUNC_INIT, FUNC_LOOP, FUNC_SLEEP_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_100_MSECOND, FUNC_EVERY_200_MSECOND, FUNC_EVERY_250_MSECOND, FUNC_EVERY_SECOND, - FUNC_SAVE_SETTINGS, FUNC_SAVE_AT_MIDNIGHT, FUNC_SAVE_BEFORE_RESTART, + FUNC_SAVE_SETTINGS, FUNC_SAVE_AT_MIDNIGHT, FUNC_SAVE_BEFORE_RESTART, FUNC_INTERRUPT_STOP, FUNC_INTERRUPT_START, FUNC_AFTER_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_SENSOR, FUNC_WEB_COL_SENSOR, FUNC_COMMAND, FUNC_COMMAND_SENSOR, FUNC_COMMAND_DRIVER, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY, FUNC_LED_LINK, diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index 716e578bc..489961737 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -1029,7 +1029,7 @@ const char kOptions[] PROGMEM = "OFF|" D_OFF "|FALSE|" D_FALSE "|STOP|" D_STOP " "TOGGLE|" D_TOGGLE "|" D_ADMIN "|" // 2 "BLINK|" D_BLINK "|" // 3 "BLINKOFF|" D_BLINKOFF "|" // 4 - "UP|" D_OPEN "|" // 100 + "UP|" D_OPEN "|" // 100 "ALL" ; // 255 const uint8_t sNumbers[] PROGMEM = { 0,0,0,0,0,0,0,0,0, @@ -1128,6 +1128,22 @@ uint32_t WebColor(uint32_t i) return tcolor; } +void AllowInterrupts(bool state) { + if (!state) { // Stop interrupts + XdrvXsnsCall(FUNC_INTERRUPT_STOP); + +#ifdef USE_EMULATION + UdpDisconnect(); +#endif // USE_EMULATION + } else { // Start interrupts +#ifdef USE_EMULATION + UdpConnect(); +#endif // USE_EMULATION + + XdrvXsnsCall(FUNC_INTERRUPT_START); + } +} + /*********************************************************************************************\ * Response data handling \*********************************************************************************************/ diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index f5da6c033..f33390e97 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -1219,11 +1219,6 @@ void Every100mSeconds(void) * Every 0.25 second \*-------------------------------------------------------------------------------------------*/ -#ifdef USE_BLE_ESP32 - // declare the fn - int ExtStopBLE(); -#endif // USE_BLE_ESP32 - bool CommandsReady(void) { bool ready = BACKLOG_EMPTY ; #ifdef USE_UFILESYS @@ -1303,18 +1298,11 @@ void Every250mSeconds(void) SettingsSave(1); // Free flash for OTA update } if (TasmotaGlobal.ota_state_flag <= 0) { -#ifdef USE_BLE_ESP32 - ExtStopBLE(); -#endif // USE_BLE_ESP32 -#ifdef USE_COUNTER - CounterInterruptDisable(true); // Prevent OTA failures on 100Hz counter interrupts -#endif // USE_COUNTER + AllowInterrupts(0); #ifdef USE_WEBSERVER - if (Settings->webserver) StopWebserver(); +// if (Settings->webserver) StopWebserver(); // 20230107 No more need for disabling webserver during OTA #endif // USE_WEBSERVER -#ifdef USE_ARILUX_RF - AriluxRfDisable(); // Prevent restart exception on Arilux Interrupt routine -#endif // USE_ARILUX_RF + TasmotaGlobal.ota_state_flag = 92; ota_result = 0; char full_ota_url[200]; @@ -1440,9 +1428,12 @@ void Every250mSeconds(void) ResponseAppend_P(PSTR("\"}")); // TasmotaGlobal.restart_flag = 2; // Restart anyway to keep memory clean webserver MqttPublishPrefixTopicRulesProcess_P(STAT, PSTR(D_CMND_UPGRADE)); + AllowInterrupts(1); +/* #ifdef USE_COUNTER CounterInterruptDisable(false); #endif // USE_COUNTER +*/ } } break; @@ -1642,9 +1633,7 @@ void ArduinoOTAInit(void) #ifdef USE_WEBSERVER if (Settings->webserver) { StopWebserver(); } #endif // USE_WEBSERVER -#ifdef USE_ARILUX_RF - AriluxRfDisable(); // Prevent restart exception on Arilux Interrupt routine -#endif // USE_ARILUX_RF + AllowInterrupts(0); if (Settings->flag.mqtt_enabled) { MqttDisconnect(); // SetOption3 - Enable MQTT } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index f1a85b69b..91b140e48 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -2670,11 +2670,6 @@ void HandleUploadDone(void) { WSContentStop(); } -#if defined(USE_BLE_ESP32) || defined(USE_MI_ESP32) - // declare the fn - int ExtStopBLE(); -#endif - void UploadServices(uint32_t start_service) { if (Web.upload_services_stopped != start_service) { return; } Web.upload_services_stopped = !start_service; @@ -2685,31 +2680,11 @@ void UploadServices(uint32_t start_service) { /* MqttRetryCounter(0); */ -#ifdef USE_ARILUX_RF - AriluxRfInit(); -#endif // USE_ARILUX_RF -#ifdef USE_COUNTER - CounterInterruptDisable(false); -#endif // USE_COUNTER -#ifdef USE_EMULATION - UdpConnect(); -#endif // USE_EMULATION - + AllowInterrupts(1); } else { // AddLog(LOG_LEVEL_DEBUG, PSTR("UPL: Services disabled")); -#ifdef USE_BLE_ESP32 - ExtStopBLE(); -#endif -#ifdef USE_EMULATION - UdpDisconnect(); -#endif // USE_EMULATION -#ifdef USE_COUNTER - CounterInterruptDisable(true); // Prevent OTA failures on 100Hz counter interrupts -#endif // USE_COUNTER -#ifdef USE_ARILUX_RF - AriluxRfDisable(); // Prevent restart exception on Arilux Interrupt routine -#endif // USE_ARILUX_RF + AllowInterrupts(0); /* MqttRetryCounter(60); if (Settings->flag.mqtt_enabled) { // SetOption3 - Enable MQTT diff --git a/tasmota/tasmota_xdrv_driver/xdrv_26_ariluxrf.ino b/tasmota/tasmota_xdrv_driver/xdrv_26_ariluxrf.ino index 8cad4cf56..ede03b44c 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_26_ariluxrf.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_26_ariluxrf.ino @@ -181,6 +181,12 @@ bool Xdrv26(uint32_t function) case FUNC_EVERY_SECOND: if (10 == TasmotaGlobal.uptime) { AriluxRfInit(); } // Needs rest before enabling RF interrupts break; + case FUNC_INTERRUPT_STOP: + AriluxRfDisable(); + break; + case FUNC_INTERRUPT_START: + AriluxRfInit(); + break; } return result; } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino index 7060671a6..fabcf916e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino @@ -3619,6 +3619,13 @@ bool Xdrv79(uint32_t function) BLE_ESP32::BLEPublishDevices = 1; // mqtt publish as 'TELE' break; + case FUNC_INTERRUPT_STOP: + ExtStopBLE(); + break; +/* + case FUNC_INTERRUPT_START: + break; +*/ #ifdef USE_WEBSERVER case FUNC_WEB_ADD_BUTTON: WSContentSend_P(BLE_ESP32::HTTP_BTN_MENU_BLE); diff --git a/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino b/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino index 42ac79295..d427cc7db 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_01_counter.ino @@ -423,6 +423,12 @@ bool Xsns01(uint32_t function) case FUNC_COMMAND: result = DecodeCommand(kCounterCommands, CounterCommand); break; + case FUNC_INTERRUPT_STOP: + CounterInterruptDisable(true); + break; + case FUNC_INTERRUPT_START: + CounterInterruptDisable(false); + break; } } else { switch (function) { diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino index 0b8c2eb26..9a85c149b 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino @@ -2357,11 +2357,16 @@ bool Xsns62(uint32_t function) MI32EverySecond(false); break; case FUNC_SAVE_BEFORE_RESTART: + case FUNC_INTERRUPT_STOP: ExtStopBLE(); break; case FUNC_COMMAND: result = DecodeCommand(kMI32_Commands, MI32_Commands); break; +/* + case FUNC_INTERRUPT_START: + break; +*/ case FUNC_JSON_APPEND: MI32Show(1); break;