diff options
author | midopple <mdoppler@gmx.at> | 2012-06-02 10:19:53 -0700 |
---|---|---|
committer | midopple <mdoppler@gmx.at> | 2012-06-02 10:19:53 -0700 |
commit | 648b25444db930e95de7306cb7542a8d6a969075 (patch) | |
tree | 36e3b2c08478b2739479e9ecef117610ddcabce8 /Sprinter | |
parent | 87cf8e280d40fd1299797f41d8010b43e241b48e (diff) | |
parent | e998ed8fdb4e800a284991b5ea2bda16f8c0aa46 (diff) |
Merge pull request #179 from kliment/master
Thermistor type 3, disconnecting thermistor yields temp -20, and hotend gets switched to full power
Diffstat (limited to 'Sprinter')
-rw-r--r-- | Sprinter/heater.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Sprinter/heater.cpp b/Sprinter/heater.cpp index 69e9e86..7682516 100644 --- a/Sprinter/heater.cpp +++ b/Sprinter/heater.cpp @@ -661,12 +661,21 @@ void PID_autotune(int PIDAT_test_temp) heater_duty = constrain(heater_duty, 0, HEATER_CURRENT); #ifdef PID_SOFT_PWM - g_heater_pwm_val = (unsigned char)heater_duty; + if(target_raw != 0) + g_heater_pwm_val = (unsigned char)heater_duty; + else + g_heater_pwm_val = 0; #else - analogWrite(HEATER_0_PIN, heater_duty); + if(target_raw != 0) + analogWrite(HEATER_0_PIN, heater_duty); + else + analogWrite(HEATER_0_PIN, 0); #if LED_PIN>-1 - analogWrite(LED_PIN, constrain(LED_PWM_FOR_BRIGHTNESS(heater_duty),0,255)); + if(target_raw != 0) + analogWrite(LED_PIN, constrain(LED_PWM_FOR_BRIGHTNESS(heater_duty),0,255)); + else + analogWrite(LED_PIN, 0); #endif #endif @@ -681,10 +690,13 @@ void PID_autotune(int PIDAT_test_temp) } else { - WRITE(HEATER_0_PIN,HIGH); - #if LED_PIN > -1 - WRITE(LED_PIN,HIGH); - #endif + if(target_raw != 0) + { + WRITE(HEATER_0_PIN,HIGH); + #if LED_PIN > -1 + WRITE(LED_PIN,HIGH); + #endif + } } #endif #endif |