Browse Source

heaters-checking update

MRprusa3d 4 years ago
parent
commit
f09323a78f
3 changed files with 14 additions and 1 deletions
  1. 1 1
      Firmware/Marlin_main.cpp
  2. 8 0
      Firmware/temperature.cpp
  3. 5 0
      Firmware/temperature.h

+ 1 - 1
Firmware/Marlin_main.cpp

@@ -9463,7 +9463,7 @@ bool bInhibitFlag;
 			{
 #if IR_SENSOR_ANALOG
                     bool bTemp=current_voltage_raw_IR>14000; // nahradit prumerem @ vicero hodnot
-                    bTemp=bTemp&&(target_temperature[0]==0); // & bed (& dalsi extrudery)
+                    bTemp=bTemp&&(!CHECK_ALL_HEATERS);
                     bTemp=bTemp&&(menu_menu==lcd_status_screen);
                     bTemp=bTemp&&((oFsensorPCB==ClFsensorPCB::_Old)||(oFsensorPCB==ClFsensorPCB::_Undef));
                     bTemp=bTemp&&fsensor_enabled;

+ 8 - 0
Firmware/temperature.cpp

@@ -210,6 +210,14 @@ static void temp_runaway_check(int _heater_id, float _target_temperature, float
 static void temp_runaway_stop(bool isPreheat, bool isBed);
 #endif
 
+// return "false", if all extruder-heaters are 'off' (ie. "true", if any heater is 'on')
+bool checkAllHotends(void)
+{
+    bool result=false;
+    for(int i=0;i<EXTRUDERS;i++) result=(result||(target_temperature[i]!=0));
+    return(result);
+}
+
   void PID_autotune(float temp, int extruder, int ncycles)
   {
   pid_number_of_cycles = ncycles;

+ 5 - 0
Firmware/temperature.h

@@ -47,6 +47,8 @@
 void tp_init();  //initialize the heating
 void manage_heater(); //it is critical that this is called periodically.
 
+extern bool checkAllHotends(void);
+
 // low level conversion routines
 // do not use these routines and variables outside of temperature.cpp
 extern int target_temperature[EXTRUDERS];  
@@ -220,6 +222,9 @@ FORCE_INLINE bool isCoolingBed() {
 #error Invalid number of extruders
 #endif
 
+// return "false", if all heaters are 'off' (ie. "true", if any heater is 'on')
+#define CHECK_ALL_HEATERS (checkAllHotends()||(target_temperature_bed!=0))
+
 int getHeaterPower(int heater);
 void disable_heater();
 void updatePID();