mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
more minor changes to clean up messaging
This commit is contained in:
@@ -1297,8 +1297,18 @@ bool System::get_value_info(JsonObject root, const char * command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// cmd is lower case of the command
|
||||
char cmd[COMMAND_MAX_LENGTH];
|
||||
strlcpy(cmd, Helpers::toLower(command).c_str(), sizeof(cmd));
|
||||
|
||||
// fetch all the data from the system
|
||||
(void)command_info("", 0, root);
|
||||
|
||||
// check for hardcoded "info"
|
||||
if (!strcmp(cmd, F_(info))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char * val = strstr(cmd, "/value");
|
||||
if (val) {
|
||||
val[0] = '\0';
|
||||
@@ -1310,14 +1320,6 @@ bool System::get_value_info(JsonObject root, const char * command) {
|
||||
slash++;
|
||||
}
|
||||
|
||||
// fetch all the data from the system
|
||||
(void)command_info("", 0, root);
|
||||
|
||||
// check for hardcoded "info"
|
||||
if (Helpers::toLower(cmd) == F_(info)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string s;
|
||||
// Loop through all the key-value pairs in root to find the key, case independent
|
||||
if (slash) { // search the top level first
|
||||
@@ -1340,7 +1342,7 @@ bool System::get_value_info(JsonObject root, const char * command) {
|
||||
}
|
||||
}
|
||||
|
||||
root.clear(); // empty json output, as it may have the default output from an info command earlier
|
||||
root.clear(); // clear json, we only one a single value
|
||||
|
||||
if (!s.empty()) {
|
||||
if (val) {
|
||||
|
||||
Reference in New Issue
Block a user