PID evolve 2

This commit is contained in:
Patrick Haßel 2024-04-12 00:27:01 +02:00
parent d5f86fe472
commit 05f32f34c7

View File

@ -65,9 +65,9 @@ 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: %f | i: %f | d: %f | current: %4.1f | target: %4.1f | heater: %3d%%", proportional, integral, derivative, temperatureCurrent, temperatureTarget, heaterPercent); debug("p: %.10f | i: %.10f | d: %.10f | current: %5.2f | target: %5.2f | heater: %3d%%", proportional, integral, derivative, temperatureCurrent, temperatureTarget, heaterPercent);
if (emergencyCutOff) { if (emergencyCutOff) {
error("[EMERGENCY CUTOFF] temperatureCurrent (=%4.1f) > temperatureTarget + %4.1f (=%4.1f) [EMERGENCY CUTOFF]", temperatureCurrent, temperatureMaxOvershoot, temperatureTarget); error("[EMERGENCY CUTOFF] temperatureCurrent (=%5.2f) > temperatureTarget + %5.2f (=%5.2f) [EMERGENCY CUTOFF]", temperatureCurrent, temperatureMaxOvershoot, temperatureTarget);
} }
} }
} }
@ -117,8 +117,8 @@ bool patrix_command(char *first) {
} }
void configLoad() { void configLoad() {
proportional = configGetDouble("p", 200); proportional = configGetDouble("p", 3000);
integral = configGetDouble("i", 0); integral = configGetDouble("i", 10);
derivative = configGetDouble("d", 0); derivative = configGetDouble("d", 0);
temperatureTarget = configGetDouble("target", 31); temperatureTarget = configGetDouble("target", 31);
temperatureMaxOvershoot = configGetDouble("over", 5); temperatureMaxOvershoot = configGetDouble("over", 5);