diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 3589847761c5..fbb78ccbf9aa 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -221,7 +221,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load impatient_beep(max_beep_count); #if ALL(HAS_FILAMENT_SENSOR, FILAMENT_CHANGE_RESUME_ON_INSERT) #if MULTI_FILAMENT_SENSOR - #define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break; + #define _CASE_INSERTED(N) case N-1: if (!FILAMENT_IS_OUT(N)) wait_for_user = false; break; switch (active_extruder) { REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED) } diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 52a9020830b7..d7c41907ed73 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -51,7 +51,7 @@ #define HAS_FILAMENT_SWITCH 1 #endif -#define FILAMENT_IS_OUT() (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE) +#define FILAMENT_IS_OUT(N...) (READ(FIL_RUNOUT##N##_PIN) == FIL_RUNOUT##N##_STATE) typedef Flags< #if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index b7edc34ade35..034878db66d1 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -553,6 +553,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero." #elif DISABLED(ADVANCED_PAUSE_FEATURE) && defined(FILAMENT_RUNOUT_SCRIPT) static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "FILAMENT_RUNOUT_SCRIPT cannot make use of M600 unless ADVANCED_PAUSE_FEATURE is enabled"); + #elif DGUS_LCD_UI_MKS + #error "MKS UI is not currently compatible with FILAMENT_RUNOUT_SENSOR. Define DGUS_MKS_RUNOUT_SENSOR instead." #endif #endif diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h index ee2e7ffb6bbb..95bee1722905 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h @@ -27,12 +27,6 @@ #define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500) -#if ENABLED(DGUS_MKS_RUNOUT_SENSOR) - #define MT_DET_1_PIN 1 - #define MT_DET_2_PIN 2 - #define MT_DET_PIN_STATE LOW -#endif - #define MKS_FINSH extern uint16_t manualMoveStep; diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index edaff3b845dc..19995186077b 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -47,6 +47,10 @@ #include "../../../../feature/powerloss.h" #endif +#if ENABLED(DGUS_MKS_RUNOUT_SENSOR) + #define FILAMENT_IS_OUT(N...) (READ(FIL_RUNOUT##N##_PIN) == FIL_RUNOUT##N##_STATE) +#endif + #if HAS_MEDIA extern ExtUI::FileList filelist; #endif @@ -1374,8 +1378,8 @@ void DGUSScreenHandlerMKS::extrudeLoadInit() { } void DGUSScreenHandlerMKS::runoutInit() { - #if PIN_EXISTS(MT_DET_1) - SET_INPUT_PULLUP(MT_DET_1_PIN); + #if ENABLED(DGUS_MKS_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT) + SET_INPUT_PULLUP(FIL_RUNOUT_PIN); #endif runout_mks.de_count = 0; runout_mks.de_times = 10; @@ -1399,17 +1403,17 @@ void DGUSScreenHandlerMKS::runoutIdle() { break; case UNRUNOUT_STATUS: - if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE) + if (FILAMENT_IS_OUT()) runout_mks.runout_status = RUNOUT_STATUS; break; case RUNOUT_BEGIN_STATUS: - if (READ(MT_DET_1_PIN) != MT_DET_PIN_STATE) + if (!FILAMENT_IS_OUT()) runout_mks.runout_status = RUNOUT_WAITING_STATUS; break; case RUNOUT_WAITING_STATUS: - if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE) + if (FILAMENT_IS_OUT()) runout_mks.runout_status = RUNOUT_BEGIN_STATUS; break; diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index f06ffcd89d7b..c216eb7e63f4 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -41,8 +41,11 @@ #include "mks_hardware.h" #include "../../../module/endstops.h" - bool pw_det_sta, pw_off_sta, mt_det_sta; - #if PIN_EXISTS(MT_DET_2) + bool pw_det_sta, pw_off_sta; + #if PIN_EXISTS(FIL_RUNOUT) + bool mt_det1_sta; + #endif + #if PIN_EXISTS(FIL_RUNOUT2) bool mt_det2_sta; #endif #if USE_X_MIN @@ -96,40 +99,42 @@ constexpr static bool endstopz4_sta = true; #endif - #define ESTATE(S) (READ(S##_PIN) == S##_ENDSTOP_HIT_STATE) + #define LOWSTATE(S) (READ(S##_PIN) == LOW) void test_gpio_readlevel_L() { #if PIN_EXISTS(WIFI_IO0) WRITE(WIFI_IO0_PIN, HIGH); #endif delay(10); - pw_det_sta = (READ(MKS_TEST_POWER_LOSS_PIN) == LOW); - pw_off_sta = (READ(MKS_TEST_PS_ON_PIN) == LOW); - mt_det_sta = (READ(MT_DET_1_PIN) == LOW); - #if PIN_EXISTS(MT_DET_2) - mt_det2_sta = (READ(MT_DET_2_PIN) == LOW); + pw_det_sta = LOWSTATE(MKS_TEST_POWER_LOSS); + pw_off_sta = LOWSTATE(MKS_TEST_PS_ON); + #if PIN_EXISTS(FIL_RUNOUT) + mt_det1_sta = LOWSTATE(FIL_RUNOUT); + #endif + #if PIN_EXISTS(FIL_RUNOUT2) + mt_det2_sta = LOWSTATE(FIL_RUNOUT2); #endif - TERN_(USE_X_MIN, endstopx1_min = ESTATE(X_MIN)); - TERN_(USE_X_MAX, endstopx1_max = ESTATE(X_MAX)); + TERN_(USE_X_MIN, endstopx1_min = LOWSTATE(X_MIN)); + TERN_(USE_X_MAX, endstopx1_max = LOWSTATE(X_MAX)); #if USE_X2_MIN || USE_X2_MAX - endstopx2_sta = ESTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX)); + endstopx2_sta = LOWSTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX)); #endif #if USE_Y_MIN || USE_Y_MAX - endstopy1_sta = ESTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX)); + endstopy1_sta = LOWSTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX)); #endif #if USE_Y2_MIN || USE_Y2_MAX - endstopy2_sta = ESTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX)); + endstopy2_sta = LOWSTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX)); #endif - TERN_(USE_Z_MIN, endstopz1_min = ESTATE(Z_MIN)); - TERN_(USE_Z_MAX, endstopz1_max = ESTATE(Z_MAX)); + TERN_(USE_Z_MIN, endstopz1_min = LOWSTATE(Z_MIN)); + TERN_(USE_Z_MAX, endstopz1_max = LOWSTATE(Z_MAX)); #if USE_Z2_MIN || USE_Z2_MAX - endstopz2_sta = ESTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX)); + endstopz2_sta = LOWSTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX)); #endif #if USE_Z3_MIN || USE_Z3_MAX - endstopz3_sta = ESTATE(TERN(USE_Z3_MIN, Z3_MIN, Z3_MAX)); + endstopz3_sta = LOWSTATE(TERN(USE_Z3_MIN, Z3_MIN, Z3_MAX)); #endif #if USE_Z4_MIN || USE_Z4_MAX - endstopz4_sta = ESTATE(TERN(USE_Z4_MIN, Z4_MIN, Z4_MAX)); + endstopz4_sta = LOWSTATE(TERN(USE_Z4_MIN, Z4_MIN, Z4_MAX)); #endif } @@ -138,33 +143,35 @@ WRITE(WIFI_IO0_PIN, LOW); #endif delay(10); - pw_det_sta = (READ(MKS_TEST_POWER_LOSS_PIN) == HIGH); - pw_off_sta = (READ(MKS_TEST_PS_ON_PIN) == HIGH); - mt_det_sta = (READ(MT_DET_1_PIN) == HIGH); - #if PIN_EXISTS(MT_DET_2) - mt_det2_sta = (READ(MT_DET_2_PIN) == HIGH); + pw_det_sta = !LOWSTATE(MKS_TEST_POWER_LOSS); + pw_off_sta = !LOWSTATE(MKS_TEST_PS_ON); + #if PIN_EXISTS(FIL_RUNOUT) + mt_det1_sta = !LOWSTATE(FIL_RUNOUT); #endif - TERN_(USE_X_MIN, endstopx1_min = !ESTATE(X_MIN)); - TERN_(USE_X_MAX, endstopx1_max = !ESTATE(X_MAX)); + #if PIN_EXISTS(FIL_RUNOUT2) + mt_det2_sta = !LOWSTATE(FIL_RUNOUT2); + #endif + TERN_(USE_X_MIN, endstopx1_min = !LOWSTATE(X_MIN)); + TERN_(USE_X_MAX, endstopx1_max = !LOWSTATE(X_MAX)); #if USE_X2_MIN || USE_X2_MAX - endstopx2_sta = !ESTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX)); + endstopx2_sta = !LOWSTATE(TERN(USE_X2_MIN, X2_MIN, X2_MAX)); #endif #if USE_Y_MIN || USE_Y_MAX - endstopy1_sta = !ESTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX)); + endstopy1_sta = !LOWSTATE(TERN(USE_Y_MIN, Y_MIN, Y_MAX)); #endif #if USE_Y2_MIN || USE_Y2_MAX - endstopy2_sta = !ESTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX)); + endstopy2_sta = !LOWSTATE(TERN(USE_Y2_MIN, Y2_MIN, Y2_MAX)); #endif - TERN_(USE_Z_MIN, endstopz1_min = !ESTATE(Z_MIN)); - TERN_(USE_Z_MAX, endstopz1_max = !ESTATE(Z_MAX)); + TERN_(USE_Z_MIN, endstopz1_min = !LOWSTATE(Z_MIN)); + TERN_(USE_Z_MAX, endstopz1_max = !LOWSTATE(Z_MAX)); #if USE_Z2_MIN || USE_Z2_MAX - endstopz2_sta = !ESTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX)); + endstopz2_sta = !LOWSTATE(TERN(USE_Z2_MIN, Z2_MIN, Z2_MAX)); #endif #if USE_Z3_MIN || USE_Z3_MAX - endstopz3_sta = !ESTATE(TERN(USE_Z3_MIN, Z3_MIN, Z3_MAX)); + endstopz3_sta = !LOWSTATE(TERN(USE_Z3_MIN, Z3_MIN, Z3_MAX)); #endif #if USE_Z4_MIN || USE_Z4_MAX - endstopz4_sta = !ESTATE(TERN(USE_Z4_MIN, Z4_MIN, Z4_MAX)); + endstopz4_sta = !LOWSTATE(TERN(USE_Z4_MIN, Z4_MIN, Z4_MAX)); #endif } @@ -177,11 +184,11 @@ SET_OUTPUT(WIFI_IO0_PIN); #endif - #if PIN_EXISTS(MT_DET_1) - SET_INPUT_PULLUP(MT_DET_1_PIN); + #if PIN_EXISTS(FIL_RUNOUT) + SET_INPUT_PULLUP(FIL_RUNOUT_PIN); #endif - #if PIN_EXISTS(MT_DET_2) - SET_INPUT_PULLUP(MT_DET_2_PIN); + #if PIN_EXISTS(FIL_RUNOUT2) + SET_INPUT_PULLUP(FIL_RUNOUT2_PIN); #endif SET_INPUT_PULLUP(MKS_TEST_POWER_LOSS_PIN); @@ -225,8 +232,11 @@ test_gpio_readlevel_L(); test_gpio_readlevel_H(); test_gpio_readlevel_L(); - if (pw_det_sta && pw_off_sta && mt_det_sta - #if PIN_EXISTS(MT_DET_2) + if (pw_det_sta && pw_off_sta + #if PIN_EXISTS(FIL_RUNOUT) + && mt_det1_sta + #endif + #if PIN_EXISTS(FIL_RUNOUT2) && mt_det2_sta #endif #if ENABLED(MKS_HARDWARE_TEST_ONLY_E0) diff --git a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp index 26979af2703f..dc47cdb357be 100644 --- a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp +++ b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp @@ -39,6 +39,11 @@ #include "../../../feature/powerloss.h" #endif +#define FILAMENT_IS_OUT(N...) (READ(FIL_RUNOUT##N##_PIN) == FIL_RUNOUT##N##_STATE) +#ifndef FILAMENT_RUNOUT_THRESHOLD + #define FILAMENT_RUNOUT_THRESHOLD 20 +#endif + extern uint32_t To_pre_view; extern bool flash_preview_begin, default_preview_flg, gcode_preview_over; @@ -101,6 +106,7 @@ void printer_state_polling() { update_spi_flash(); } } + #if ENABLED(POWER_LOSS_RECOVERY) if (uiCfg.print_state == REPRINTED) { #if HAS_HOTEND @@ -118,6 +124,7 @@ void printer_state_polling() { #endif recovery.resume(); + #if 0 // Move back to the saved XY char str_1[16], str_2[16]; @@ -140,61 +147,57 @@ void printer_state_polling() { } #endif - if (uiCfg.print_state == WORKING) - filament_check(); + if (uiCfg.print_state == WORKING) filament_check(); TERN_(MKS_WIFI_MODULE, wifi_looping()); } void filament_pin_setup() { - #if PIN_EXISTS(MT_DET_1) - SET_INPUT_PULLUP(MT_DET_1_PIN); + #if PIN_EXISTS(FIL_RUNOUT1) + SET_INPUT_PULLUP(FIL_RUNOUT1_PIN); #endif - #if PIN_EXISTS(MT_DET_2) - SET_INPUT_PULLUP(MT_DET_2_PIN); + #if PIN_EXISTS(FIL_RUNOUT2) + SET_INPUT_PULLUP(FIL_RUNOUT2_PIN); #endif - #if PIN_EXISTS(MT_DET_3) - SET_INPUT_PULLUP(MT_DET_3_PIN); + #if PIN_EXISTS(FIL_RUNOUT3) + SET_INPUT_PULLUP(FIL_RUNOUT3_PIN); #endif } void filament_check() { - #if ANY_PIN(MT_DET_1, MT_DET_2, MT_DET_3) - const int FIL_DELAY = 20; - #endif - #if PIN_EXISTS(MT_DET_1) + #if PIN_EXISTS(FIL_RUNOUT1) static int fil_det_count_1 = 0; - if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE) + if (FILAMENT_IS_OUT(1)) fil_det_count_1++; else if (fil_det_count_1 > 0) fil_det_count_1--; #endif - #if PIN_EXISTS(MT_DET_2) + #if PIN_EXISTS(FIL_RUNOUT2) static int fil_det_count_2 = 0; - if (READ(MT_DET_2_PIN) == MT_DET_PIN_STATE) + if (FILAMENT_IS_OUT(2)) fil_det_count_2++; else if (fil_det_count_2 > 0) fil_det_count_2--; #endif - #if PIN_EXISTS(MT_DET_3) + #if PIN_EXISTS(FIL_RUNOUT3) static int fil_det_count_3 = 0; - if (READ(MT_DET_3_PIN) == MT_DET_PIN_STATE) + if (FILAMENT_IS_OUT(3)) fil_det_count_3++; else if (fil_det_count_3 > 0) fil_det_count_3--; #endif if (false - #if PIN_EXISTS(MT_DET_1) - || fil_det_count_1 >= FIL_DELAY + #if PIN_EXISTS(FIL_RUNOUT1) + || fil_det_count_1 >= FILAMENT_RUNOUT_THRESHOLD #endif - #if PIN_EXISTS(MT_DET_2) - || fil_det_count_2 >= FIL_DELAY + #if PIN_EXISTS(FIL_RUNOUT2) + || fil_det_count_2 >= FILAMENT_RUNOUT_THRESHOLD #endif - #if PIN_EXISTS(MT_DET_3) - || fil_det_count_3 >= FIL_DELAY + #if PIN_EXISTS(FIL_RUNOUT3) + || fil_det_count_3 >= FILAMENT_RUNOUT_THRESHOLD #endif ) { clear_cur_ui(); diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index e0e8ca4dd03d..65a2f222ce7b 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -114,7 +114,7 @@ void menu_advanced_settings(); #endif #define STOP_ITEM(A,I,M,L) TERN(HAS_##A##I##_##M##_STATE, _STOP_ITEM, _IF_1_ELSE)(STRINGIFY(A) STRINGIFY(I) S1_SPACE(I) " " L, A##I##_##M) #define STOP_MINMAX(A,I) STOP_ITEM(A,I,MIN,"Min") STOP_ITEM(A,I,MAX,"Max") - #define FIL_ITEM(N) PSTRING_ITEM_N_P(N-1, MSG_FILAMENT_EN, (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) ? PSTR("PRESENT") : PSTR("out"), SS_FULL); + #define FIL_ITEM(N) PSTRING_ITEM_N_P(N-1, MSG_FILAMENT_EN, FILAMENT_IS_OUT(N) ? PSTR("out") : PSTR("PRESENT"), SS_FULL); static void screen_endstop_test() { if (ui.use_click()) { diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index f3515ad9282d..6894b13f076a 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -519,18 +519,12 @@ void __O2 Endstops::report_states() { print_es_state(READ(CALIBRATION_PIN) != CALIBRATION_PIN_INVERTING, F(STR_CALIBRATION)); #endif #if MULTI_FILAMENT_SENSOR - #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break; - for (uint8_t i = 1; i <= NUM_RUNOUT_SENSORS; ++i) { - pin_t pin; - uint8_t state; - switch (i) { - default: continue; - REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT) - } - SERIAL_ECHOPGM(STR_FILAMENT); - if (i > 1) SERIAL_CHAR(' ', '0' + i); - print_es_state(extDigitalRead(pin) != state); - } + #define _CASE_RUNOUT(N) do{ \ + SERIAL_ECHO(F(STR_FILAMENT)); \ + if ((N) > 1) SERIAL_CHAR(' ', '0' + char(N)); \ + print_es_state(!FILAMENT_IS_OUT(N)); \ + }while(0); + REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT) #undef _CASE_RUNOUT #elif HAS_FILAMENT_SENSOR print_es_state(!FILAMENT_IS_OUT(), F(STR_FILAMENT)); diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index fa757d2d52d3..caac738bb995 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -95,10 +95,6 @@ #define Z_MIN_PIN PA11 // -Z #define Z_MAX_PIN PC4 // +Z -#ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN PA4 // MT_DET -#endif - // // Steppers // @@ -225,9 +221,15 @@ #endif #if HAS_TFT_LVGL_UI - #define MT_DET_1_PIN PA4 // MT_DET - #define MT_DET_2_PIN PE6 - #define MT_DET_PIN_STATE LOW + #ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA4 // MT_DET_1 + #endif + #ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PE6 // MT_DET_2 + #endif + #ifndef FIL_RUNOUT_STATE + #define FIL_RUNOUT_STATE LOW + #endif #endif // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index 01be779b1366..087a064c053d 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -80,6 +80,10 @@ #define Z_MIN_PIN PA11 #define Z_MAX_PIN PC4 +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA4 // MT_DET +#endif + // // Probe enable // @@ -187,8 +191,9 @@ #define KILL_PIN_STATE HIGH #endif - #define MT_DET_1_PIN PA4 - #define MT_DET_PIN_STATE LOW + #ifndef FIL_RUNOUT_STATE + #define FIL_RUNOUT_STATE LOW + #endif #define WIFI_IO0_PIN PC13 #define WIFI_IO1_PIN PC7 @@ -205,7 +210,6 @@ #else //#define POWER_LOSS_PIN PA2 // PW_DET //#define PS_ON_PIN PB2 // PW_OFF - #define FIL_RUNOUT_PIN PA4 #endif //#define LED_PIN PB2 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index 6b563e960728..e21760940c11 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -70,6 +70,9 @@ #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN PA4 // MT_DET #endif +#ifndef FIL_RUNOUT_STATE + #define FIL_RUNOUT_STATE LOW +#endif // // Probe enable @@ -126,11 +129,6 @@ #define POWER_LOSS_PIN PA2 // PW_DET #define PS_ON_PIN PA3 // PW_OFF -#if HAS_TFT_LVGL_UI - #define MT_DET_1_PIN PA4 // MT_DET - #define MT_DET_PIN_STATE LOW -#endif - #define WIFI_IO0_PIN PC13 // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 67d60a97ede6..5c09d8e80708 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -211,9 +211,15 @@ // Misc. Functions // #if HAS_TFT_LVGL_UI - #define MT_DET_1_PIN PA4 - #define MT_DET_2_PIN PE6 - #define MT_DET_PIN_STATE LOW + #ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA4 // MT_DET_1 + #endif + #ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PE6 // MT_DET_2 + #endif + #ifndef FIL_RUNOUT_STATE + #define FIL_RUNOUT_STATE LOW + #endif #define WIFI_IO0_PIN PC13 #define WIFI_IO1_PIN PC7 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h index 6d644ed086d6..808b0c190cf4 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -149,9 +149,15 @@ // Misc. Functions // #if HAS_TFT_LVGL_UI - #define MT_DET_1_PIN PA4 - #define MT_DET_2_PIN PE6 - #define MT_DET_PIN_STATE LOW + #ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA4 // MT_DET_1 + #endif + #ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PE6 // MT_DET_2 + #endif + #ifndef FIL_RUNOUT_STATE + #define FIL_RUNOUT_STATE LOW + #endif #define WIFI_IO0_PIN PC13 #define WIFI_IO1_PIN PC7 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h index 7d6ea8e03947..a8d0be3ca62a 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h @@ -41,13 +41,11 @@ // #define PW_DET PC5 // Y+ #define PW_OFF PB12 // Z+ -#define MT_DET_1_PIN PW_DET -#define MT_DET_2_PIN PW_OFF #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN MT_DET_1_PIN + #define FIL_RUNOUT_PIN PC5 // Y+ #endif #ifndef FIL_RUNOUT2_PIN - #define FIL_RUNOUT2_PIN MT_DET_2_PIN + #define FIL_RUNOUT2_PIN PB12 // Z+ #endif #include "pins_MKS_MONSTER8_common.h" diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h index 12d3947b9934..3312a576b051 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h @@ -39,13 +39,11 @@ // #define PW_DET PA13 // MT_DET #define PW_OFF PB12 // Z+ -#define MT_DET_1_PIN PW_DET -#define MT_DET_2_PIN PW_OFF #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN MT_DET_1_PIN + #define FIL_RUNOUT_PIN PA13 // MT_DET #endif #ifndef FIL_RUNOUT2_PIN - #define FIL_RUNOUT2_PIN MT_DET_2_PIN + #define FIL_RUNOUT2_PIN PB12 // Z+ #endif // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h index b15c7d7288c6..9c81eb1c85d7 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h @@ -74,6 +74,16 @@ #define PROBE_ENABLE_PIN SERVO0_PIN #endif +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PC5 // Y+ +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PB12 // Z+ +#endif + // // Steppers // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index a3f65712712c..8f4e5ff6b808 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -147,16 +147,15 @@ // Misc. Functions // #if HAS_TFT_LVGL_UI - #define MT_DET_1_PIN PA4 // MT_DET - #define MT_DET_2_PIN PE6 - #define MT_DET_PIN_STATE LOW -#endif - -#ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN PA4 -#endif -#ifndef FIL_RUNOUT2_PIN - #define FIL_RUNOUT2_PIN PE6 + #ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA4 // MT_DET_1 + #endif + #ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PE6 // MT_DET_2 + #endif + #ifndef FIL_RUNOUT_STATE + #define FIL_RUNOUT_STATE LOW + #endif #endif #ifndef POWER_LOSS_PIN