logging cleanup
This commit is contained in:
parent
7345b125ee
commit
3470681342
@ -30,7 +30,7 @@ protected:
|
|||||||
void _write(const bool state) {
|
void _write(const bool state) {
|
||||||
if (state != get()) {
|
if (state != get()) {
|
||||||
if (logState) {
|
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();
|
stateMillis = millis();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void doLog(const String &path, const String &value, const bool isPassword, const
|
|||||||
"[CONFIG] %-20s = %-30s [%s]\n",
|
"[CONFIG] %-20s = %-30s [%s]\n",
|
||||||
path.c_str(),
|
path.c_str(),
|
||||||
isPassword ? "*" : value.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" : ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,10 +29,8 @@ void httpRelay(const int index, Output &relay) {
|
|||||||
if (server.hasArg(stateKey)) {
|
if (server.hasArg(stateKey)) {
|
||||||
const auto state = server.arg(stateKey);
|
const auto state = server.arg(stateKey);
|
||||||
if (state == "true") {
|
if (state == "true") {
|
||||||
Serial.printf("[HTTP] %s = %s\n", stateKey.c_str(), state.c_str());
|
|
||||||
relay.set(true);
|
relay.set(true);
|
||||||
} else if (state == "false") {
|
} else if (state == "false") {
|
||||||
Serial.printf("[HTTP] %s = %s\n", stateKey.c_str(), state.c_str());
|
|
||||||
relay.set(false);
|
relay.set(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,13 +39,10 @@ void httpRelay(const int index, Output &relay) {
|
|||||||
if (server.hasArg(initialKey)) {
|
if (server.hasArg(initialKey)) {
|
||||||
const auto initial = server.arg(initialKey);
|
const auto initial = server.arg(initialKey);
|
||||||
if (initial == "OFF") {
|
if (initial == "OFF") {
|
||||||
Serial.printf("[HTTP] %s = %s\n", initialKey.c_str(), initial.c_str());
|
|
||||||
relay.setInitial(INITIAL_OFF);
|
relay.setInitial(INITIAL_OFF);
|
||||||
} else if (initial == "ON") {
|
} else if (initial == "ON") {
|
||||||
Serial.printf("[HTTP] %s = %s\n", initialKey.c_str(), initial.c_str());
|
|
||||||
relay.setInitial(INITIAL_ON);
|
relay.setInitial(INITIAL_ON);
|
||||||
} else if (initial == "CYCLE") {
|
} else if (initial == "CYCLE") {
|
||||||
Serial.printf("[HTTP] %s = %s\n", initialKey.c_str(), initial.c_str());
|
|
||||||
relay.setInitial(INITIAL_CYCLE);
|
relay.setInitial(INITIAL_CYCLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,21 +50,18 @@ void httpRelay(const int index, Output &relay) {
|
|||||||
const auto onCountKey = String("onCount") + index;
|
const auto onCountKey = String("onCount") + index;
|
||||||
if (server.hasArg(onCountKey)) {
|
if (server.hasArg(onCountKey)) {
|
||||||
const auto value = server.arg(onCountKey).toInt();
|
const auto value = server.arg(onCountKey).toInt();
|
||||||
Serial.printf("[HTTP] %s = %ld\n", onCountKey.c_str(), value);
|
|
||||||
relay.setOnCount(value);
|
relay.setOnCount(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto onMillisKey = String("onMillis") + index;
|
const auto onMillisKey = String("onMillis") + index;
|
||||||
if (server.hasArg(onMillisKey)) {
|
if (server.hasArg(onMillisKey)) {
|
||||||
const auto value = server.arg(onMillisKey).toInt();
|
const auto value = server.arg(onMillisKey).toInt();
|
||||||
Serial.printf("[HTTP] %s = %ld\n", onMillisKey.c_str(), value);
|
|
||||||
relay.setOnMillis(value);
|
relay.setOnMillis(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto offMillisKey = String("offMillis") + index;
|
const auto offMillisKey = String("offMillis") + index;
|
||||||
if (server.hasArg(offMillisKey)) {
|
if (server.hasArg(offMillisKey)) {
|
||||||
const auto value = server.arg(offMillisKey).toInt();
|
const auto value = server.arg(offMillisKey).toInt();
|
||||||
Serial.printf("[HTTP] %s = %ld\n", offMillisKey.c_str(), value);
|
|
||||||
relay.setOffMillis(value);
|
relay.setOffMillis(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user