From c2091d7082706d71f9c42f5ff54f591c2b733d66 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 8 Nov 2024 23:26:46 +0100 Subject: [PATCH] Fix FUNC_COMMAND linked list command buffer corruption by shutter driver --- CHANGELOG.md | 3 ++- RELEASENOTES.md | 2 ++ .../tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino | 8 ++++++-- tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino | 13 +++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a3d7f5f..277e197e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to this project will be documented in this file. - Support KNX for scripts (#22429) - Support deep sleep (standby) for VL53L0X (#22441) - Support for MS5837 pressure and temperature sensor (#22376) -- Berry add I2C read16/write16 supporting Little Endian +- Berry add I2C read16/write16 supporting Little Endian (#22448) ### Breaking Changed @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. ### Fixed - ESP32-S3 UART output mode for Tx (#22426) - Mitsubishi Electric HVAC Standby Stage for MiElHVAC (#22430) +- FUNC_COMMAND linked list command buffer corruption by shutter driver ### Removed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d8ced5db0..6384dfd72 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -137,6 +137,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Mitsubishi Electric HVAC Auto Clear Remote Temp for MiElHVAC [#22370](https://github.com/arendst/Tasmota/issues/22370) - SolaxX1 Meter mode [#22330](https://github.com/arendst/Tasmota/issues/22330) - BLE track devices with RPA [#22300](https://github.com/arendst/Tasmota/issues/22300) +- Berry add I2C read16/write16 supporting Little Endian [#22448](https://github.com/arendst/Tasmota/issues/22448) - HASPmota `haspmota.get_pages()` to get the sorted list of pages [#22358](https://github.com/arendst/Tasmota/issues/22358) ### Breaking Changed @@ -156,6 +157,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - HASPmota support for page delete and object updates [#22311](https://github.com/arendst/Tasmota/issues/22311) ### Fixed +- FUNC_COMMAND linked list command buffer corruption by shutter driver - Alexa Hue with multiple devices [#22383](https://github.com/arendst/Tasmota/issues/22383) - Mitsubishi Electric HVAC Standby Stage for MiElHVAC [#22430](https://github.com/arendst/Tasmota/issues/22430) - EQ3 TRV firmware version 1.46 fails if the default true is used in subscribe on the notify characteristic [#22328](https://github.com/arendst/Tasmota/issues/22328) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino index cff8dc1f8..3371ffe65 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino @@ -2293,6 +2293,7 @@ bool Xdrv27(uint32_t function) if (Settings->flag3.shutter_mode) { // SetOption80 - Enable shutter support uint8_t counter = XdrvMailbox.index == 0 ? 1 : XdrvMailbox.index; uint8_t counterend = XdrvMailbox.index == 0 ? TasmotaGlobal.shutters_present : XdrvMailbox.index; + uint32_t rescue_index = XdrvMailbox.index; int32_t rescue_payload = XdrvMailbox.payload; uint32_t rescue_data_len = XdrvMailbox.data_len; char stemp1[10]; @@ -2323,7 +2324,7 @@ bool Xdrv27(uint32_t function) XdrvMailbox.index = i; XdrvMailbox.payload = rescue_payload; XdrvMailbox.data_len = rescue_data_len; - if (!ShutterSettings.version) { + if (!ShutterSettings.version) { ShutterSettingsLoad(0); ShutterSettings.shutter_startrelay[0] = 1; ShutterInit(); @@ -2395,13 +2396,16 @@ bool Xdrv27(uint32_t function) break; #ifdef USE_WEBSERVER case FUNC_WEB_SENSOR: - ShutterShow(); +// ShutterShow(); break; #endif // USE_WEBSERVER case FUNC_ACTIVE: result = true; break; } + XdrvMailbox.index = rescue_index; + XdrvMailbox.payload = rescue_payload; + XdrvMailbox.data_len = rescue_data_len; } return result; } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino index e433134d5..3602b18d7 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino @@ -1899,6 +1899,7 @@ bool Xdrv27(uint32_t function) if (Settings->flag3.shutter_mode) { // SetOption80 - Enable shutter support uint8_t counter = XdrvMailbox.index==0?1:XdrvMailbox.index; uint8_t counterend = XdrvMailbox.index==0?TasmotaGlobal.shutters_present:XdrvMailbox.index; + uint32_t rescue_index = XdrvMailbox.index; int32_t rescue_payload = XdrvMailbox.payload; uint32_t rescue_data_len = XdrvMailbox.data_len; char stemp1[10]; @@ -1922,13 +1923,6 @@ bool Xdrv27(uint32_t function) result = DecodeCommand(kShutterCommands, ShutterCommand); } break; - for (uint8_t i = counter; i <= counterend; i++) { - XdrvMailbox.index = i; - XdrvMailbox.payload = rescue_payload; - XdrvMailbox.data_len = rescue_data_len; - result = DecodeCommand(kShutterCommands, ShutterCommand); - } - break; case FUNC_JSON_APPEND: if (!sensor_data_reported) { sensor_data_reported = true; @@ -1984,13 +1978,16 @@ bool Xdrv27(uint32_t function) break; #ifdef USE_WEBSERVER case FUNC_WEB_SENSOR: - ShutterShow(); +// ShutterShow(); break; #endif // USE_WEBSERVER case FUNC_ACTIVE: result = true; break; } + XdrvMailbox.index = rescue_index; + XdrvMailbox.payload = rescue_payload; + XdrvMailbox.data_len = rescue_data_len; } return result; }