Ver Fonte

Automaton changes. Keep heater ON during probing only if pwm is high

leptun há 5 anos atrás
pai
commit
dde61bb444
1 ficheiros alterados com 9 adições e 7 exclusões
  1. 9 7
      Firmware/heatbed_pwm.cpp

+ 9 - 7
Firmware/heatbed_pwm.cpp

@@ -140,14 +140,16 @@ ISR(TIMER0_OVF_vect)          // timer compare interrupt service routine
 	case States::ONE:             // state ONE - we'll either stay in ONE or change to FALL
 		OCR0B = 255;
 		slowCounter += slowInc;   // this does software timer_clk/256 or less
-		if( slowCounter < pwm ){
-			return;
-		}
-		if( (soft_pwm_bed << 1) >= (255 - slowInc - 1) ){  //@@TODO simplify & explain
-			// if slowInc==2, soft_pwm == 251 will be the first to do short drops to zero. 252 will keep full heating
-			return;           // want full duty for the next ONE cycle again - so keep on heating and just wait for the next timer ovf
+		if (!bedPWMDisabled){ //disable heating as soon as possible
+			if( slowCounter < pwm ){
+				return;
+			}
+			if( (soft_pwm_bed << 1) >= (255 - slowInc - 1) ){  //@@TODO simplify & explain
+				// if slowInc==2, soft_pwm == 251 will be the first to do short drops to zero. 252 will keep full heating
+				return;           // want full duty for the next ONE cycle again - so keep on heating and just wait for the next timer ovf
+			}
 		}
-		if (bedPWMDisabled){
+		else if (pwm > 200){ //if duty cycle is high and BED PWM is disabled keep heater on. Prevents overcooling
 			return;
 		}
 		// otherwise moving towards FALL