logging cleanup

This commit is contained in:
Patrick Haßel 2025-08-29 10:10:46 +02:00
parent 7345b125ee
commit 3470681342
3 changed files with 2 additions and 10 deletions

View File

@ -30,7 +30,7 @@ protected:
void _write(const bool state) {
if (state != get()) {
if (logState) {
Serial.printf("%s: %s\n", name.c_str(), state ? "ON" : "OFF");
Serial.printf("[RELAY] \"%s\" = %s\n", name.c_str(), state ? "ON" : "OFF");
}
stateMillis = millis();
}

View File

@ -60,7 +60,7 @@ void doLog(const String &path, const String &value, const bool isPassword, const
"[CONFIG] %-20s = %-30s [%s]\n",
path.c_str(),
isPassword ? "*" : value.c_str(),
type == CONFIG_LOG_FALLBACK ? "FALLBACK" : type == CONFIG_LOG_READ ? "READ" : type == CONFIG_LOG_UNCHANGED ? "UNCHANGED" : type == CONFIG_LOG_WRITE ? "WRITE" : ""
type == CONFIG_LOG_FALLBACK ? "fallback" : type == CONFIG_LOG_READ ? "READ" : type == CONFIG_LOG_UNCHANGED ? "UNCHANGED" : type == CONFIG_LOG_WRITE ? "WRITE" : ""
);
}

View File

@ -29,10 +29,8 @@ void httpRelay(const int index, Output &relay) {
if (server.hasArg(stateKey)) {
const auto state = server.arg(stateKey);
if (state == "true") {
Serial.printf("[HTTP] %s = %s\n", stateKey.c_str(), state.c_str());
relay.set(true);
} else if (state == "false") {
Serial.printf("[HTTP] %s = %s\n", stateKey.c_str(), state.c_str());
relay.set(false);
}
}
@ -41,13 +39,10 @@ void httpRelay(const int index, Output &relay) {
if (server.hasArg(initialKey)) {
const auto initial = server.arg(initialKey);
if (initial == "OFF") {
Serial.printf("[HTTP] %s = %s\n", initialKey.c_str(), initial.c_str());
relay.setInitial(INITIAL_OFF);
} else if (initial == "ON") {
Serial.printf("[HTTP] %s = %s\n", initialKey.c_str(), initial.c_str());
relay.setInitial(INITIAL_ON);
} else if (initial == "CYCLE") {
Serial.printf("[HTTP] %s = %s\n", initialKey.c_str(), initial.c_str());
relay.setInitial(INITIAL_CYCLE);
}
}
@ -55,21 +50,18 @@ void httpRelay(const int index, Output &relay) {
const auto onCountKey = String("onCount") + index;
if (server.hasArg(onCountKey)) {
const auto value = server.arg(onCountKey).toInt();
Serial.printf("[HTTP] %s = %ld\n", onCountKey.c_str(), value);
relay.setOnCount(value);
}
const auto onMillisKey = String("onMillis") + index;
if (server.hasArg(onMillisKey)) {
const auto value = server.arg(onMillisKey).toInt();
Serial.printf("[HTTP] %s = %ld\n", onMillisKey.c_str(), value);
relay.setOnMillis(value);
}
const auto offMillisKey = String("offMillis") + index;
if (server.hasArg(offMillisKey)) {
const auto value = server.arg(offMillisKey).toInt();
Serial.printf("[HTTP] %s = %ld\n", offMillisKey.c_str(), value);
relay.setOffMillis(value);
}
}