Fix ESP32 rules operation priority regression from v13.3.0.4 (#22636)

This commit is contained in:
Theo Arends 2024-12-12 15:34:43 +01:00
parent 6268066bac
commit 620fade73c
3 changed files with 9 additions and 2 deletions

View File

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

View File

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

View File

@ -1687,10 +1687,15 @@ 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--;