Skip to content

Commit

Permalink
Fix ESP32 rules operation priority regression from v13.3.0.4 (#22636)
Browse files Browse the repository at this point in the history
  • Loading branch information
arendst committed Dec 12, 2024
1 parent 6268066 commit 620fade
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit 620fade

Please sign in to comment.