This commit is contained in:
Mark Finn 2012-09-17 14:23:49 -05:00
parent 04631d2250
commit eb06a886c4

View File

@ -173,8 +173,8 @@ void PID_autotune(float temp, int extruder, int ncycles)
if (extruder<0) if (extruder<0)
{ {
soft_pwm_bed = (PID_MAX_BED)/2; soft_pwm_bed = (MAX_BED_POWER)/2;
bias = d = (PID_MAX_BED)/2; bias = d = (MAX_BED_POWER)/2;
} }
else else
{ {
@ -214,8 +214,8 @@ void PID_autotune(float temp, int extruder, int ncycles)
t_low=t2 - t1; t_low=t2 - t1;
if(cycles > 0) { if(cycles > 0) {
bias += (d*(t_high - t_low))/(t_low + t_high); bias += (d*(t_high - t_low))/(t_low + t_high);
bias = constrain(bias, 20 ,(extruder<0?(PID_MAX_BED):(PID_MAX))-20); bias = constrain(bias, 20 ,(extruder<0?(MAX_BED_POWER):(PID_MAX))-20);
if(bias > (extruder<0?(PID_MAX_BED):(PID_MAX))/2) d = (extruder<0?(PID_MAX_BED):(PID_MAX)) - 1 - bias; if(bias > (extruder<0?(MAX_BED_POWER):(PID_MAX))/2) d = (extruder<0?(MAX_BED_POWER):(PID_MAX)) - 1 - bias;
else d = bias; else d = bias;
SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias); SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);
@ -299,6 +299,8 @@ void updatePID()
for(int e = 0; e < EXTRUDERS; e++) { for(int e = 0; e < EXTRUDERS; e++) {
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki; temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
} }
#endif
#ifdef PIDTEMPBED
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi; temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
#endif #endif
} }
@ -419,10 +421,10 @@ void manage_heater()
dTerm_bed= (bedKd * (pid_input - temp_dState_bed))*K2 + (K1 * dTerm_bed); dTerm_bed= (bedKd * (pid_input - temp_dState_bed))*K2 + (K1 * dTerm_bed);
temp_dState_bed = pid_input; temp_dState_bed = pid_input;
pid_output = constrain(pTerm_bed + iTerm_bed - dTerm_bed, 0, PID_MAX_BED); pid_output = constrain(pTerm_bed + iTerm_bed - dTerm_bed, 0, MAX_BED_POWER);
#else #else
pid_output = constrain(pid_setpoint_bed, 0, PID_MAX_BED); pid_output = constrain(pid_setpoint_bed, 0, MAX_BED_POWER);
#endif //PID_OPENLOOP #endif //PID_OPENLOOP
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp))
@ -442,7 +444,7 @@ void manage_heater()
} }
else else
{ {
soft_pwm_bed = PID_MAX_BED>>1; soft_pwm_bed = MAX_BED_POWER>>1;
} }
} }
else { else {
@ -459,7 +461,7 @@ void manage_heater()
else else
if(current_raw_bed <= target_bed_low_temp) if(current_raw_bed <= target_bed_low_temp)
{ {
soft_pwm_bed = PID_MAX_BED>>1; soft_pwm_bed = MAX_BED_POWER>>1;
} }
} }
else { else {