Heater for threaded program
Dependents: LEX_Threaded_Programming_V3
Diff: Heater.cpp
- Revision:
- 50:ad9a1eb063b3
- Parent:
- 49:35fd40559960
diff -r 35fd40559960 -r ad9a1eb063b3 Heater.cpp --- a/Heater.cpp Mon Mar 09 15:26:53 2020 +0000 +++ b/Heater.cpp Mon Mar 30 16:31:33 2020 +0000 @@ -65,15 +65,13 @@ { //Get error - //error = R_ref - R; // use single reading R values error = R_ref - R_smooth; // use smoothed R values //Update PWM from setpoint and resistance double duty_cycle = thermal.pid_kp_mho * error; //Integral term (if used) - if (thermal.pid_integral_time_ms > 0) { // set integral time to zero to have no integral term - // if (abs(error) > thermal.pid_wind_up_limit_ohm) error = error * thermal.pid_wind_up_limit_ohm / abs(error); // don't use pid_wind_up_limit + if (thermal.pid_integral_time_ms > 0) { // set integral time to zero to have no integral term (== infinite integral time) error_integrated += error * (float) thermal.thermal_control_loop_interval_ms; duty_cycle += thermal.pid_kp_mho * error_integrated/thermal.pid_integral_time_ms; }