From 620fade73c902352574aa9675c7a438764c18f19 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:34:43 +0100 Subject: [PATCH] Fix ESP32 rules operation priority regression from v13.3.0.4 (#22636) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68aaa45da..f9d00dc85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. ### Changed ### Fixed +- ESP32 rules operation priority regression from v13.3.0.4 (#22636) ### Removed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 6e3180a07..7433735df 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -123,5 +123,6 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ### Changed ### Fixed +- ESP32 rules operation priority regression from v13.3.0.4 [#22636](https://github.com/arendst/Tasmota/issues/22636) ### Removed diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino index d43b93aaf..dae5cfd95 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino @@ -1687,14 +1687,19 @@ float evaluateExpression(const char * expression, unsigned int len) { while (index < operators_size) { if (priority == pgm_read_byte(kExpressionOperatorsPriorities + operators[index])) { // Need to calculate the operator first // Get current object value and remove the next object with current operator + +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: index %d, v1 '%4_f', v2 '%4_f', op %d"), index, &object_values[index], &object_values[index + 1], operators[index]); + va = calculateTwoValues(object_values[index], object_values[index + 1], operators[index]); uint32_t i = index; while (i <= operators_size) { - operators[i++] = operators[i]; // operators.remove(index) +// operators[i++] = operators[i]; // operators.remove(index) - Fails on ESP32 (#22636) + operators[i] = operators[i +1]; // operators.remove(index) + i++; object_values[i] = object_values[i +1]; // object_values.remove(index + 1) } operators_size--; - object_values[index] = va; // Replace the current value with the result + object_values[index] = va; // Replace the current value with the result // AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Intermediate '%4_f'"), &object_values[index]);