mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
formatting
This commit is contained in:
@@ -303,7 +303,9 @@ void WebSchedulerService::publish(const bool force) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ha_registered_ = ha_created;
|
ha_registered_ = ha_created;
|
||||||
|
|
||||||
if (doc.size() > 0) {
|
if (doc.size() > 0) {
|
||||||
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||||
snprintf(topic, sizeof(topic), "%s_data", F_(scheduler));
|
snprintf(topic, sizeof(topic), "%s_data", F_(scheduler));
|
||||||
@@ -339,6 +341,9 @@ bool WebSchedulerService::command(const char * cmd, const char * data) {
|
|||||||
// prefix "api/" to command string
|
// prefix "api/" to command string
|
||||||
char command_str[COMMAND_MAX_LENGTH];
|
char command_str[COMMAND_MAX_LENGTH];
|
||||||
snprintf(command_str, sizeof(command_str), "/api/%s", cmd);
|
snprintf(command_str, sizeof(command_str), "/api/%s", cmd);
|
||||||
|
|
||||||
|
EMSESP::logger().debug("** command: %s", command_str); //TODO remove
|
||||||
|
|
||||||
uint8_t return_code = Command::process(command_str, true, input, output); // admin set
|
uint8_t return_code = Command::process(command_str, true, input, output); // admin set
|
||||||
|
|
||||||
if (return_code == CommandRet::OK) {
|
if (return_code == CommandRet::OK) {
|
||||||
@@ -470,6 +475,8 @@ void WebSchedulerService::loop() {
|
|||||||
// hard coded tests
|
// hard coded tests
|
||||||
#if defined(EMSESP_TEST)
|
#if defined(EMSESP_TEST)
|
||||||
void WebSchedulerService::test() {
|
void WebSchedulerService::test() {
|
||||||
|
static bool already_added = false;
|
||||||
|
if (!already_added) {
|
||||||
update([&](WebScheduler & webScheduler) {
|
update([&](WebScheduler & webScheduler) {
|
||||||
// webScheduler.scheduleItems.clear();
|
// webScheduler.scheduleItems.clear();
|
||||||
// test 1
|
// test 1
|
||||||
@@ -484,10 +491,27 @@ void WebSchedulerService::test() {
|
|||||||
si.retry_cnt = 0xFF; // no startup retries
|
si.retry_cnt = 0xFF; // no startup retries
|
||||||
|
|
||||||
webScheduler.scheduleItems.push_back(si);
|
webScheduler.scheduleItems.push_back(si);
|
||||||
|
already_added = true;
|
||||||
|
|
||||||
return StateUpdateResult::CHANGED; // persist the changes
|
return StateUpdateResult::CHANGED; // persist the changes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test shunting yard
|
||||||
|
std::string test_value;
|
||||||
|
|
||||||
|
test_value = "1+2*3";
|
||||||
|
EMSESP::logger().warning("Shunting yard test 1: %s = %s", test_value.c_str(), compute(test_value).c_str());
|
||||||
|
|
||||||
|
test_value = "system/settings/locale";
|
||||||
|
EMSESP::logger().warning("Shunting yard test 2: %s = %s", test_value.c_str(), compute(test_value).c_str());
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
Reference in New Issue
Block a user