From 4d5566a6b720d9cfde0073d55e551625144983fe Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Sun, 30 Sep 2018 22:33:46 -0400 Subject: [PATCH] Add filament runout sensor menu item (#11971) --- Marlin/src/feature/runout.cpp | 3 ++- Marlin/src/feature/runout.h | 3 +++ Marlin/src/lcd/language/language_en.h | 5 ++++- Marlin/src/lcd/ultralcd.cpp | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 00eb97195d..7e3301e5bd 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -32,7 +32,8 @@ FilamentRunoutSensor runout; -bool FilamentRunoutSensor::filament_ran_out; // = false +bool FilamentRunoutSensor::enabled = true, + FilamentRunoutSensor::filament_ran_out; // = false uint8_t FilamentRunoutSensor::runout_count; // = 0 void FilamentRunoutSensor::setup() { diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index aaabaad6e9..13233d3d6e 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -38,6 +38,8 @@ class FilamentRunoutSensor { public: + static bool enabled; + FilamentRunoutSensor() {} static void setup(); @@ -56,6 +58,7 @@ class FilamentRunoutSensor { static uint8_t runout_count; FORCE_INLINE static bool check() { + if (!enabled) return false; #if NUM_RUNOUT_SENSORS < 2 // A single sensor applying to all extruders const bool is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 687d4cc44d..7b896adf76 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -973,7 +973,7 @@ #define MSG_CASE_LIGHT _UxGT("Case light") #endif #ifndef MSG_CASE_LIGHT_BRIGHTNESS - #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Light BRIGHTNESS") + #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Light Brightness") #endif #if LCD_WIDTH >= 20 #ifndef MSG_INFO_PRINT_COUNT @@ -1047,6 +1047,9 @@ #ifndef MSG_FILAMENT_CHANGE_NOZZLE #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozzle: ") #endif +#ifndef MSG_RUNOUT_SENSOR_ENABLE + #define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Runout Sensor") +#endif #ifndef MSG_ERR_HOMING_FAILED #define MSG_ERR_HOMING_FAILED _UxGT("Homing failed") #endif diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index dabb694a16..7d3a8d0d38 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -71,6 +71,10 @@ #include "../feature/leds/leds.h" #endif +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #include "../feature/runout.h" +#endif + #if DISABLED(LCD_USE_I2C_BUZZER) #include "../libs/buzzer.h" #endif @@ -3428,6 +3432,10 @@ void lcd_quick_feedback(const bool clear_buttons) { MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu); #endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + MENU_ITEM_EDIT(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled); + #endif + #if DISABLED(SLIM_LCD_MENUS) // Preheat configurations MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_configuration_temperature_preheat_material1_settings_menu);