From 4a2036d588f2a19d62b14b1b17384d9ea93f0b17 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 10 Jul 2024 13:12:18 +0200 Subject: [PATCH] no need to append space, as strings can be quoted --- src/web/WebSchedulerService.cpp | 11 ++++++++--- src/web/shuntingYard.hpp | 5 +---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/web/WebSchedulerService.cpp b/src/web/WebSchedulerService.cpp index c4f7c1acc..413a4763b 100644 --- a/src/web/WebSchedulerService.cpp +++ b/src/web/WebSchedulerService.cpp @@ -508,12 +508,17 @@ void WebSchedulerService::test() { test_value = "hello"; EMSESP::logger().warning("Shunting yard test 3: %s = %s", test_value.c_str(), compute(test_value).c_str()); - test_value = "locale is system/settings/locale"; - EMSESP::logger().warning("Shunting yard test 4: %s = %s", test_value.c_str(), compute(test_value).c_str()); + // should output 'locale is en' + test_value = "\"locale is \"system/settings/locale"; command(test_cmd.c_str(), compute(test_value).c_str()); // test with negative value - test_value = "rssi is 0+system/network/rssi"; + // should output 'rssi is -23' + test_value = "\"rssi is \"0+system/network/rssi"; + command(test_cmd.c_str(), compute(test_value).c_str()); + + // should output 'rssi is -23 dbm' + test_value = "\"rssi is \"(system/network/rssi)\" dBm\""; command(test_cmd.c_str(), compute(test_value).c_str()); } #endif diff --git a/src/web/shuntingYard.hpp b/src/web/shuntingYard.hpp index ab1363d2d..d4f3a7e25 100644 --- a/src/web/shuntingYard.hpp +++ b/src/web/shuntingYard.hpp @@ -571,12 +571,9 @@ std::string calculate(const std::string & expr) { std::string result = ""; for (const auto & s : stack) { result += s; - if (s != stack.back()) { - result += " "; - } } - return result; + // return stack.back(); }