Merge pull request #2134 from AnHardt/preheat-all
Shift call of start_watching_heater() into setTargetHotend()
This commit is contained in:
		@@ -3367,10 +3367,6 @@ inline void gcode_M104() {
 | 
				
			|||||||
      if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
 | 
					      if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
 | 
				
			||||||
        setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
 | 
					        setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
 | 
				
			||||||
    #endif
 | 
					    #endif
 | 
				
			||||||
 | 
					 | 
				
			||||||
    #ifdef THERMAL_PROTECTION_HOTENDS
 | 
					 | 
				
			||||||
      start_watching_heater(target_extruder);
 | 
					 | 
				
			||||||
    #endif
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -3482,10 +3478,6 @@ inline void gcode_M109() {
 | 
				
			|||||||
    if (code_seen('B')) autotemp_max = code_value();
 | 
					    if (code_seen('B')) autotemp_max = code_value();
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #ifdef THERMAL_PROTECTION_HOTENDS
 | 
					 | 
				
			||||||
    start_watching_heater(target_extruder);
 | 
					 | 
				
			||||||
  #endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  millis_t temp_ms = millis();
 | 
					  millis_t temp_ms = millis();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* See if we are heating up or cooling down */
 | 
					  /* See if we are heating up or cooling down */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -278,11 +278,7 @@ void checkHitEndstops() {
 | 
				
			|||||||
        card.sdprinting = false;
 | 
					        card.sdprinting = false;
 | 
				
			||||||
        card.closefile();
 | 
					        card.closefile();
 | 
				
			||||||
        quickStop();
 | 
					        quickStop();
 | 
				
			||||||
        setTargetHotend0(0);
 | 
					        disable_all_heaters(); // switch off all heaters.
 | 
				
			||||||
        setTargetHotend1(0);
 | 
					 | 
				
			||||||
        setTargetHotend2(0);
 | 
					 | 
				
			||||||
        setTargetHotend3(0);
 | 
					 | 
				
			||||||
        setTargetBed(0);
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    #endif
 | 
					    #endif
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,7 +96,16 @@ FORCE_INLINE float degBed() { return current_temperature_bed; }
 | 
				
			|||||||
FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; }
 | 
					FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; }
 | 
				
			||||||
FORCE_INLINE float degTargetBed() { return target_temperature_bed; }
 | 
					FORCE_INLINE float degTargetBed() { return target_temperature_bed; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) { target_temperature[extruder] = celsius; }
 | 
					#ifdef THERMAL_PROTECTION_HOTENDS
 | 
				
			||||||
 | 
					  void start_watching_heater(int e=0);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
 | 
				
			||||||
 | 
					  target_temperature[extruder] = celsius;
 | 
				
			||||||
 | 
					  #ifdef THERMAL_PROTECTION_HOTENDS
 | 
				
			||||||
 | 
					    start_watching_heater(extruder);
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; }
 | 
					FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FORCE_INLINE bool isHeatingHotend(uint8_t extruder) { return target_temperature[extruder] > current_temperature[extruder]; }
 | 
					FORCE_INLINE bool isHeatingHotend(uint8_t extruder) { return target_temperature[extruder] > current_temperature[extruder]; }
 | 
				
			||||||
@@ -137,10 +146,6 @@ void PID_autotune(float temp, int extruder, int ncycles);
 | 
				
			|||||||
void setExtruderAutoFanState(int pin, bool state);
 | 
					void setExtruderAutoFanState(int pin, bool state);
 | 
				
			||||||
void checkExtruderAutoFans();
 | 
					void checkExtruderAutoFans();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef THERMAL_PROTECTION_HOTENDS
 | 
					 | 
				
			||||||
  void start_watching_heater(int e=0);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FORCE_INLINE void autotempShutdown() {
 | 
					FORCE_INLINE void autotempShutdown() {
 | 
				
			||||||
  #ifdef AUTOTEMP
 | 
					  #ifdef AUTOTEMP
 | 
				
			||||||
    if (autotemp_enabled) {
 | 
					    if (autotemp_enabled) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -515,12 +515,11 @@ static void lcd_tune_menu() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
 | 
					void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
 | 
				
			||||||
  if (temph > 0) setTargetHotend(temph, endnum);
 | 
					  if (temph > 0) setTargetHotend(temph, endnum);
 | 
				
			||||||
 | 
					  #if TEMP_SENSOR_BED != 0
 | 
				
			||||||
    setTargetBed(tempb);
 | 
					    setTargetBed(tempb);
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
  fanSpeed = fan;
 | 
					  fanSpeed = fan;
 | 
				
			||||||
  lcd_return_to_status();
 | 
					  lcd_return_to_status();
 | 
				
			||||||
  #ifdef WATCH_TEMP_PERIOD
 | 
					 | 
				
			||||||
    if (endnum >= 0) start_watching_heater(endnum);
 | 
					 | 
				
			||||||
  #endif
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
 | 
					void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
 | 
				
			||||||
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
 | 
					void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
 | 
				
			||||||
@@ -602,11 +601,7 @@ void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTem
 | 
				
			|||||||
#endif // more than one temperature sensor present
 | 
					#endif // more than one temperature sensor present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void lcd_cooldown() {
 | 
					void lcd_cooldown() {
 | 
				
			||||||
  setTargetHotend0(0);
 | 
					  disable_all_heaters();
 | 
				
			||||||
  setTargetHotend1(0);
 | 
					 | 
				
			||||||
  setTargetHotend2(0);
 | 
					 | 
				
			||||||
  setTargetHotend3(0);
 | 
					 | 
				
			||||||
  setTargetBed(0);
 | 
					 | 
				
			||||||
  fanSpeed = 0;
 | 
					  fanSpeed = 0;
 | 
				
			||||||
  lcd_return_to_status();
 | 
					  lcd_return_to_status();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user