configPrint FIX
This commit is contained in:
parent
8b80a0e8e1
commit
05d2b22c9f
@ -68,11 +68,27 @@ void configPutDouble(const char *name, double value) {
|
|||||||
void configPrint() {
|
void configPrint() {
|
||||||
info("Config:");
|
info("Config:");
|
||||||
for (JsonPair pair: config.as<JsonObject>()) {
|
for (JsonPair pair: config.as<JsonObject>()) {
|
||||||
const char *value = pair.value().as<const char *>();
|
const char *key = pair.key().c_str();
|
||||||
if (strcmp(pair.key().c_str(), "WIFI_PKEY") == 0) {
|
const JsonVariant &value = pair.value();
|
||||||
value = "[***]";
|
|
||||||
|
char valueStr[64];
|
||||||
|
if (strcmp(key, "WIFI_PKEY") == 0) {
|
||||||
|
snprintf(valueStr, sizeof valueStr, "[PASSWORD REDACTED]");
|
||||||
|
} else {
|
||||||
|
if (value.is<const char *>()) {
|
||||||
|
snprintf(valueStr, sizeof valueStr, "%s", value.as<const char *>());
|
||||||
|
} else if (value.is<double>()) {
|
||||||
|
snprintf(valueStr, sizeof valueStr, "%f", value.as<double>());
|
||||||
|
} else if (value.is<int>()) {
|
||||||
|
snprintf(valueStr, sizeof valueStr, "%d", value.as<int>());
|
||||||
|
} else if (value.is<bool>()) {
|
||||||
|
snprintf(valueStr, sizeof valueStr, "%s", value.as<bool>() ? "true" : "false");
|
||||||
|
} else {
|
||||||
|
snprintf(valueStr, sizeof valueStr, "[UNKNOWN TYPE]");
|
||||||
}
|
}
|
||||||
info(" - %s: \"%s\"", pair.key().c_str(), value);
|
}
|
||||||
|
|
||||||
|
info(" -%-15s = %s", key, valueStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,10 @@ void configLoaded() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool patrix_command(char *first) {
|
bool patrix_command(char *first) {
|
||||||
|
if (strcmp(first, "test") == 0 || strcmp(first, "t") == 0) {
|
||||||
|
configPutDouble("test", millis());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user