more minor changes to clean up messaging

This commit is contained in:
proddy
2024-07-24 13:22:34 +02:00
parent 0054a89c38
commit fa54cb6a48
11 changed files with 85 additions and 63 deletions

View File

@@ -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) {