Heat all the way to the setpoint.
This commit is contained in:
parent
c98aebc716
commit
9be0cabfe3
@ -14,6 +14,7 @@ thermoControl::thermoControl(double* current_temp, double* setpoint, double* pow
|
||||
actual_temp = current_temp;
|
||||
hysteresis = 1.0;
|
||||
max_pwr_threshold = 5.0;
|
||||
isheating=false;
|
||||
Serial.println("Controller Started");
|
||||
}
|
||||
|
||||
@ -26,12 +27,14 @@ bool thermoControl::Compute() {
|
||||
|
||||
if (error >= max_pwr_threshold) {
|
||||
*output_pwm = outMax;
|
||||
} else if (error > hysteresis) {
|
||||
isheating=true;
|
||||
} else if (error > hysteresis || (error <= hysteresis && error > 0 && isheating)) {
|
||||
*output_pwm = 100 * error / max_pwr_threshold;
|
||||
if (*output_pwm > 100) *output_pwm = 100;
|
||||
if (*output_pwm < 0) *output_pwm = 0;
|
||||
isheating=true;
|
||||
} else {
|
||||
*output_pwm = 0;
|
||||
isheating=false;
|
||||
}
|
||||
|
||||
lastTime = now;
|
||||
|
@ -17,6 +17,7 @@ class thermoControl {
|
||||
int outMin;
|
||||
int SampleInterval;
|
||||
unsigned long lastTime;
|
||||
bool isheating;
|
||||
modes OpMode;
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user