Skip to content

Commit

Permalink
MT_DET_PIN_INVERTING => MT_DET_PIN_STATE
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 12, 2021
1 parent fd77a5f commit e45de40
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#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_INVERTING false
#define MT_DET_1_PIN 1
#define MT_DET_2_PIN 2
#define MT_DET_PIN_STATE LOW
#endif

#define MKS_FINSH
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,17 +1495,17 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) {
break;

case UNRUNOUT_STATUS:
if (READ(MT_DET_1_PIN) == LOW)
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
runout_mks.runout_status = RUNOUT_STATUS;
break;

case RUNOUT_BEGIN_STATUS:
if (READ(MT_DET_1_PIN) == HIGH)
if (READ(MT_DET_1_PIN) != MT_DET_PIN_STATE)
runout_mks.runout_status = RUNOUT_WAITTING_STATUS;
break;

case RUNOUT_WAITTING_STATUS:
if (READ(MT_DET_1_PIN) == LOW)
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
runout_mks.runout_status = RUNOUT_BEGIN_STATUS;
break;

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/mks_ui/printer_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,23 @@ void filament_check() {
#endif
#if PIN_EXISTS(MT_DET_1)
static int fil_det_count_1 = 0;
if (READ(MT_DET_1_PIN) == MT_DET_PIN_INVERTING)
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
fil_det_count_1++;
else if (fil_det_count_1 > 0)
fil_det_count_1--;
#endif

#if PIN_EXISTS(MT_DET_2)
static int fil_det_count_2 = 0;
if (READ(MT_DET_2_PIN) == MT_DET_PIN_INVERTING)
if (READ(MT_DET_2_PIN) == MT_DET_PIN_STATE)
fil_det_count_2++;
else if (fil_det_count_2 > 0)
fil_det_count_2--;
#endif

#if PIN_EXISTS(MT_DET_3)
static int fil_det_count_3 = 0;
if (READ(MT_DET_3_PIN) == MT_DET_PIN_INVERTING)
if (READ(MT_DET_3_PIN) == MT_DET_PIN_STATE)
fil_det_count_3++;
else if (fil_det_count_3 > 0)
fil_det_count_3--;
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,11 @@
//#define PS_ON_PIN PA3 // PW_CN /PW_OFF
#endif

#define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_2_PIN PE6 // FALA_CRTL
#define MT_DET_PIN_INVERTING false
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_2_PIN PE6 // FALA_CRTL
#define MT_DET_PIN_STATE LOW
#endif

//
// LED / NEOPixel
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
#endif

#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#define MT_DET_PIN_STATE LOW // LVGL UI filament RUNOUT PIN STATE

#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@
#define POWER_LOSS_PIN PA2 // PW_DET
#define PS_ON_PIN PA3 // PW_OFF

#define MT_DET_1_PIN PA4
#define MT_DET_PIN_INVERTING false
#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

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#define MT_DET_PIN_STATE LOW // LVGL UI filament RUNOUT PIN STATE

#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@
// Misc. Functions
//
#if HAS_TFT_LVGL_UI

#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#define MT_DET_PIN_STATE LOW // LVGL UI filament RUNOUT PIN STATE

#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@
//
// Misc. Functions
//
#define MT_DET_1_PIN PA4
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_2_PIN PE6 // FALA_CRTL
#define MT_DET_PIN_STATE LOW // LVGL UI filament RUNOUT PIN STATE
#endif

#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN MT_DET_1_PIN
Expand Down

0 comments on commit e45de40

Please sign in to comment.