Keep webserver enabled on command `upload`

This commit is contained in:
Theo Arends 2023-01-07 15:37:52 +01:00
parent 7465ff0c7f
commit 2e7496a052
10 changed files with 53 additions and 47 deletions

View File

@ -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

View File

@ -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)

View File

@ -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,

View File

@ -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
\*********************************************************************************************/

View File

@ -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
}

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {

View File

@ -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;