log clean
This commit is contained in:
parent
bf67e8b2b7
commit
db3c3d1ccd
@ -88,7 +88,7 @@ void configPrint() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info(" -%-15s = %s", key, valueStr);
|
info(" %-15s = %s", key, valueStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,12 +61,14 @@ void patrixLoop() {
|
|||||||
heaterPWM = 0;
|
heaterPWM = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool emergencyCutOff = heaterPWM > 0 && temperatureCurrent > temperatureTarget + temperatureOver;
|
const char *emergencyStr = "HEATING";
|
||||||
if (emergencyCutOff) {
|
if (heaterPWM > 0 && temperatureCurrent > temperatureTarget + temperatureOver) {
|
||||||
heaterPWM = 0;
|
heaterPWM = 0;
|
||||||
|
emergencyStr = "[EMERGENCY CUTOFF]";
|
||||||
|
} else if (heaterPWM == 0) {
|
||||||
|
emergencyStr = "---";
|
||||||
}
|
}
|
||||||
|
|
||||||
heaterPWM = min(CONTROL_PWM_MAX, max(0.0, heaterPWM));
|
|
||||||
analogWrite(CONTROL_GPIO, (int) round(heaterPWM));
|
analogWrite(CONTROL_GPIO, (int) round(heaterPWM));
|
||||||
|
|
||||||
static unsigned long lastDebug = 0;
|
static unsigned long lastDebug = 0;
|
||||||
@ -74,10 +76,16 @@ void patrixLoop() {
|
|||||||
if (now - lastDebug >= 1000) {
|
if (now - lastDebug >= 1000) {
|
||||||
lastDebug = now;
|
lastDebug = now;
|
||||||
int heaterPercent = (int) round(100.0 * heaterPWM / CONTROL_PWM_MAX);
|
int heaterPercent = (int) round(100.0 * heaterPWM / CONTROL_PWM_MAX);
|
||||||
debug("p: %.10f | i: %.10f | d: %.10f | current: %5.2f | target: %5.2f | heater: %3d%%", proportional, integral, derivative, temperatureCurrent, temperatureTarget, heaterPercent);
|
debug(
|
||||||
if (emergencyCutOff) {
|
"p: %.12f | i: %.12f | d: %.12f | current: %5.2f | target: %5.2f | heater: %3d%% | %s",
|
||||||
error("[EMERGENCY CUTOFF] temperatureCurrent (=%5.2f) > temperatureTarget + %5.2f (=%5.2f) [EMERGENCY CUTOFF]", temperatureCurrent, temperatureOver, temperatureTarget);
|
proportional == 0 ? NAN : proportional,
|
||||||
}
|
integral == 0 ? NAN : integral,
|
||||||
|
derivative == 0 ? NAN : derivative,
|
||||||
|
temperatureCurrent,
|
||||||
|
temperatureTarget,
|
||||||
|
heaterPercent,
|
||||||
|
emergencyStr
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user