|
@@ -134,8 +134,8 @@ void PID_autotune(float temp)
|
134
|
134
|
long t_high;
|
135
|
135
|
long t_low;
|
136
|
136
|
|
137
|
|
- long bias=127;
|
138
|
|
- long d = 127;
|
|
137
|
+ long bias=PID_MAX/2;
|
|
138
|
+ long d = PID_MAX/2;
|
139
|
139
|
float Ku, Tu;
|
140
|
140
|
float Kp, Ki, Kd;
|
141
|
141
|
float max, min;
|
|
@@ -144,7 +144,7 @@ void PID_autotune(float temp)
|
144
|
144
|
|
145
|
145
|
disable_heater(); // switch off all heaters.
|
146
|
146
|
|
147
|
|
- soft_pwm[0] = 255>>1;
|
|
147
|
+ soft_pwm[0] = PID_MAX/2;
|
148
|
148
|
|
149
|
149
|
for(;;) {
|
150
|
150
|
|
|
@@ -172,8 +172,8 @@ void PID_autotune(float temp)
|
172
|
172
|
t_low=t2 - t1;
|
173
|
173
|
if(cycles > 0) {
|
174
|
174
|
bias += (d*(t_high - t_low))/(t_low + t_high);
|
175
|
|
- bias = constrain(bias, 20 ,235);
|
176
|
|
- if(bias > 127) d = 254 - bias;
|
|
175
|
+ bias = constrain(bias, 20 ,PID_MAX-20);
|
|
176
|
+ if(bias > PID_MAX/2) d = PID_MAX - 1 - bias;
|
177
|
177
|
else d = bias;
|
178
|
178
|
|
179
|
179
|
SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);
|