Skip to content

Commit

Permalink
Throw out MKS UI filament runout handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 24, 2022
1 parent b036641 commit eb2a055
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 72 deletions.
70 changes: 0 additions & 70 deletions Marlin/src/lcd/extui/mks_ui/printer_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,77 +142,7 @@ void printer_state_polling() {
}
#endif

#if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (uiCfg.print_state == WORKING) filament_check();
#endif

TERN_(MKS_WIFI_MODULE, wifi_looping());
}

#if ENABLED(FILAMENT_RUNOUT_SENSOR)

void filament_pin_setup() {
#if PIN_EXISTS(FIL_RUNOUT1)
SET_INPUT_PULLUP(FIL_RUNOUT_PIN);
#endif
#if PIN_EXISTS(FIL_RUNOUT2) && NUM_RUNOUT_SENSORS >= 2
SET_INPUT_PULLUP(FIL_RUNOUT2_PIN);
#endif
#if PIN_EXISTS(FIL_RUNOUT3) && NUM_RUNOUT_SENSORS >= 3
SET_INPUT_PULLUP(FIL_RUNOUT3_PIN);
#endif
}

void filament_check() {
#if PIN_EXISTS(FIL_RUNOUT1)
static int fil_det_count_1 = 0;
if (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT1_STATE)
fil_det_count_1++;
else if (fil_det_count_1 > 0)
fil_det_count_1--;
#endif

#if PIN_EXISTS(FIL_RUNOUT2) && NUM_RUNOUT_SENSORS >= 2
static int fil_det_count_2 = 0;
if (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE)
fil_det_count_2++;
else if (fil_det_count_2 > 0)
fil_det_count_2--;
#endif

#if PIN_EXISTS(FIL_RUNOUT3) && NUM_RUNOUT_SENSORS >= 3
static int fil_det_count_3 = 0;
if (READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT3_STATE)
fil_det_count_3++;
else if (fil_det_count_3 > 0)
fil_det_count_3--;
#endif

if (false
#if PIN_EXISTS(FIL_RUNOUT1)
|| fil_det_count_1 >= FILAMENT_RUNOUT_THRESHOLD
#endif
#if PIN_EXISTS(FIL_RUNOUT2) && NUM_RUNOUT_SENSORS >= 2
|| fil_det_count_2 >= FILAMENT_RUNOUT_THRESHOLD
#endif
#if PIN_EXISTS(FIL_RUNOUT3) && NUM_RUNOUT_SENSORS >= 3
|| fil_det_count_3 >= FILAMENT_RUNOUT_THRESHOLD
#endif
) {
clear_cur_ui();
card.pauseSDPrint();
stop_print_time();
uiCfg.print_state = PAUSING;

if (gCfgItems.from_flash_pic)
flash_preview_begin = true;
else
default_preview_flg = true;

lv_draw_printing();
}
}

#endif // FILAMENT_RUNOUT_SENSOR

#endif // HAS_TFT_LVGL_UI
2 changes: 0 additions & 2 deletions Marlin/src/lcd/extui/mks_ui/printer_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#define MIN_FILE_PRINTED 100 //5000

void printer_state_polling();
void filament_pin_setup();
void filament_check();

#ifdef __cplusplus
} /* C-declarations for C++ */
Expand Down

0 comments on commit eb2a055

Please sign in to comment.