Skip to content

Commit

Permalink
Increase reliability of filament runout MarlinFirmware#7
Browse files Browse the repository at this point in the history
Temporary stopgap until we get this spaghetti cleaned up.
  • Loading branch information
Sebazzz committed Sep 27, 2020
1 parent 71ed695 commit a0cf008
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/lcd/dwin/cr6/touch_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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*/) {
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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?
Expand Down

0 comments on commit a0cf008

Please sign in to comment.