From a0cf0082a6d40d71067123d2fc09583ec18ad6c8 Mon Sep 17 00:00:00 2001 From: Sebastiaan Dammann Date: Sun, 27 Sep 2020 19:41:36 +0200 Subject: [PATCH] Increase reliability of filament runout #7 Temporary stopgap until we get this spaghetti cleaned up. --- Marlin/Configuration.h | 6 +++--- Marlin/src/lcd/dwin/cr6/touch_lcd.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index b9caf87f2ecc..47cf7dc5bf8c 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1179,9 +1179,9 @@ #if ENABLED(FILAMENT_RUNOUT_SENSOR) #define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500. #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. - #define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present. - #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. - //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + #define FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present. + //#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + #define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. // Set one or more commands to execute on filament runout. // (After 'M412 H' Marlin will ask the host to handle the process.) diff --git a/Marlin/src/lcd/dwin/cr6/touch_lcd.cpp b/Marlin/src/lcd/dwin/cr6/touch_lcd.cpp index 0b02f8a07484..f855369466aa 100644 --- a/Marlin/src/lcd/dwin/cr6/touch_lcd.cpp +++ b/Marlin/src/lcd/dwin/cr6/touch_lcd.cpp @@ -86,6 +86,7 @@ float pause_z = 0; float pause_e = 0; bool sdcard_pause_check = true; bool pause_action_flag = false; +bool had_filament_runout = false; bool probe_offset_flag = false; millis_t next_rts_update_ms = 0; @@ -822,6 +823,7 @@ void RTSSHOW::RTS_HandleData() rtscheck.change_page(DWINTouchPage::PRINT_PROGRESS_RUNNING); } break; + case ResumePrintKey: // This is apparently triggered when the resume option is pressed if (recdat.data[0] == 1 /*Resume*/) { @@ -846,8 +848,10 @@ void RTSSHOW::RTS_HandleData() thermalManager.setTargetHotend(temphot, 0); } + had_filament_runout = false; break; + case ZoffsetEnterKey: last_zoffset = probe.offset.z; if(recdat.data[0] >= 32768) @@ -1530,6 +1534,7 @@ void RTSSHOW::RTS_FilamentRunout() { sdcard_pause_check = false; pause_action_flag = true; + had_filament_runout = true; pause_z = current_position[Z_AXIS]; pause_e = current_position[E_AXIS] - 5; @@ -1544,7 +1549,7 @@ void RTSSHOW::RTS_FilamentRunout() { void RTSSHOW::RTS_FilamentLoaded() { // "Filament load, please confirm resume print or stop print" - if (pause_action_flag == true && sdcard_pause_check == false) { + if (pause_action_flag == true && sdcard_pause_check == false && had_filament_runout == true) { rtscheck.change_page(DWINTouchPage::ERR_FILAMENTRUNOUT_FILAMENT_LOADED); // Update icon?