From 61bf8478a2a10f083462f4292a44671b944bce0e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 22 Jan 2018 04:29:29 -0600 Subject: [PATCH] Add hotEnough methods --- Marlin/src/feature/pause.cpp | 4 ++-- Marlin/src/lcd/ultralcd.cpp | 26 +++++++++++++------------- Marlin/src/module/temperature.h | 3 +++ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 43244acbc9..cdb51e32c3 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -287,7 +287,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u COPY(resume_position, current_position); // Initial retract before move to filament change position - if (retract && !thermalManager.tooColdToExtrude(active_extruder)) + if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE); // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos) @@ -397,7 +397,7 @@ void resume_print(const float &load_length/*=0*/, const float &extrude_length/*= thermalManager.reset_heater_idle_timer(e); } - if (nozzle_timed_out || !thermalManager.tooColdToExtrude(active_extruder)) { + if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) { // Load the new filament load_filament(load_length, extrude_length, max_beep_count, true, nozzle_timed_out); } diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 8366710a8f..e8f528ba11 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -1402,7 +1402,7 @@ void kill_screen(const char* lcd_msg) { // #if ENABLED(ADVANCED_PAUSE_FEATURE) #if E_STEPPERS == 1 && !ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - if (!thermalManager.targetTooColdToExtrude(active_extruder)) + if (thermalManager.targetHotEnoughToExtrude(active_extruder)) MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0")); else MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_temp_menu_e0_filament_change); @@ -2608,7 +2608,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(ADVANCED_PAUSE_FEATURE) if (!IS_SD_FILE_OPEN) { #if E_STEPPERS == 1 && !ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - if (!thermalManager.targetTooColdToExtrude(active_extruder)) + if (thermalManager.targetHotEnoughToExtrude(active_extruder)) MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0")); else MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_temp_menu_e0_filament_change); @@ -4282,21 +4282,21 @@ void kill_screen(const char* lcd_msg) { // Unload filament #if E_STEPPERS == 1 - if (!thermalManager.targetTooColdToExtrude(active_extruder)) + if (thermalManager.targetHotEnoughToExtrude(active_extruder)) MENU_ITEM(gcode, MSG_FILAMENTUNLOAD, PSTR("M702")); else MENU_ITEM(submenu, MSG_FILAMENTUNLOAD, lcd_temp_menu_e0_filament_unload); #else #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) - if (!thermalManager.targetTooColdToExtrude(0) + if (thermalManager.targetHotEnoughToExtrude(0) #if E_STEPPERS > 1 - && !thermalManager.targetTooColdToExtrude(1) + && thermalManager.targetHotEnoughToExtrude(1) #if E_STEPPERS > 2 - && !thermalManager.targetTooColdToExtrude(2) + && thermalManager.targetHotEnoughToExtrude(2) #if E_STEPPERS > 3 - && !thermalManager.targetTooColdToExtrude(3) + && thermalManager.targetHotEnoughToExtrude(3) #if E_STEPPERS > 4 - && !thermalManager.targetTooColdToExtrude(4) + && thermalManager.targetHotEnoughToExtrude(4) #endif // E_STEPPERS > 4 #endif // E_STEPPERS > 3 #endif // E_STEPPERS > 2 @@ -4306,26 +4306,26 @@ void kill_screen(const char* lcd_msg) { else MENU_ITEM(submenu, MSG_FILAMENTUNLOAD_ALL, lcd_unload_filament_all_temp_menu); #endif - if (!thermalManager.targetTooColdToExtrude(0)) + if (thermalManager.targetHotEnoughToExtrude(0)) MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E1, PSTR("M702 T0")); else MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E1, lcd_temp_menu_e0_filament_unload); - if (!thermalManager.targetTooColdToExtrude(1)) + if (thermalManager.targetHotEnoughToExtrude(1)) MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E2, PSTR("M702 T1")); else MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E2, lcd_temp_menu_e1_filament_unload); #if E_STEPPERS > 2 - if (!thermalManager.targetTooColdToExtrude(2)) + if (thermalManager.targetHotEnoughToExtrude(2)) MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E3, PSTR("M702 T2")); else MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E3, lcd_temp_menu_e2_filament_unload); #if E_STEPPERS > 3 - if (!thermalManager.targetTooColdToExtrude(3)) + if (thermalManager.targetHotEnoughToExtrude(3)) MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E4, PSTR("M702 T3")); else MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E4, lcd_temp_menu_e3_filament_unload); #if E_STEPPERS > 4 - if (!thermalManager.targetTooColdToExtrude(4)) + if (thermalManager.targetHotEnoughToExtrude(4)) MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E5, PSTR("M702 T4")); else MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E5, lcd_temp_menu_e4_filament_unload); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index dc2b701047..167c6d2dfb 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -188,6 +188,9 @@ class Temperature { FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { UNUSED(e); return false; } #endif + FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); } + FORCE_INLINE static bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); } + private: #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)