Skip to content

Commit 7214126

Browse files
committed
[Bugfix] Calculation of functions remove unneeded value duplication, small debug-code optimization
1 parent 398e1e9 commit 7214126

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/src/Helpers/Rules_calculate.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,12 @@ CalculateReturnCode RulesCalculate_t::doCalculate(const char *input, ESPEASY_RUL
540540
*(TokenPos) = 0; // Mark end of token string
541541
// addLog(LOG_LEVEL_INFO, strformat(F("doCalculate popping stack sl: %u token: %s sc: %d"), sl, token, sc));
542542
if (sc == '(') {
543-
const ESPEASY_RULES_FLOAT_TYPE first = pop(); // Get last value from stack
544-
push(first); // push back
545-
error = push(first); // Push as a result of ()
546-
// addLog(LOG_LEVEL_INFO, strformat(F("doCalculate pop&push 2x last value: %.4f sl: %u"), first, sl));
543+
// const auto first = pop(); // Get last value from stack
544+
// push(first); // push back
545+
// addLog(LOG_LEVEL_INFO, strformat(F("doCalculate at ( last value: %.4f sl: %u"), first, sl));
547546
} else {
548547
error = RPNCalculate(token);
549-
// const ESPEASY_RULES_FLOAT_TYPE first = pop(); // Get last value from stack
548+
// const auto first = pop(); // Get last value from stack
550549
// push(first); // push back
551550
// addLog(LOG_LEVEL_INFO, strformat(F("doCalculate last value on stack: %.4f sl: %u"), first, sl));
552551
}
@@ -627,7 +626,7 @@ CalculateReturnCode RulesCalculate_t::doCalculate(const char *input, ESPEASY_RUL
627626
// addLog(LOG_LEVEL_INFO, strformat(F("doCalculate closing up stack sl: %u token: %s sc: %d"), sl, token, sc));
628627
error = RPNCalculate(token);
629628
TokenPos = token;
630-
// const ESPEASY_RULES_FLOAT_TYPE first = pop(); // Get last value from stack
629+
// const auto first = pop(); // Get last value from stack
631630
// push(first); // push back
632631
// addLog(LOG_LEVEL_INFO, strformat(F("doCalculate closing, last value on stack: %.4f sl: %u"), first, sl));
633632

@@ -640,7 +639,7 @@ CalculateReturnCode RulesCalculate_t::doCalculate(const char *input, ESPEASY_RUL
640639
*(TokenPos) = 0; // Mark end of token string
641640
error = RPNCalculate(token);
642641
TokenPos = token;
643-
// const ESPEASY_RULES_FLOAT_TYPE first = pop(); // Get last value from stack
642+
// const auto first = pop(); // Get last value from stack
644643
// push(first); // push back
645644
// addLog(LOG_LEVEL_INFO, strformat(F("doCalculate final value on stack: %.4f sl: %u"), first, sl));
646645

0 commit comments

Comments
 (0)