Pārlūkot izejas kodu

Add filament runout sensor menu item (#11971)

InsanityAutomation 6 gadus atpakaļ
vecāks
revīzija
4d5566a6b7

+ 2
- 1
Marlin/src/feature/runout.cpp Parādīt failu

32
 
32
 
33
 FilamentRunoutSensor runout;
33
 FilamentRunoutSensor runout;
34
 
34
 
35
-bool FilamentRunoutSensor::filament_ran_out; // = false
35
+bool FilamentRunoutSensor::enabled = true,
36
+     FilamentRunoutSensor::filament_ran_out; // = false
36
 uint8_t FilamentRunoutSensor::runout_count; // = 0
37
 uint8_t FilamentRunoutSensor::runout_count; // = 0
37
 
38
 
38
 void FilamentRunoutSensor::setup() {
39
 void FilamentRunoutSensor::setup() {

+ 3
- 0
Marlin/src/feature/runout.h Parādīt failu

38
 
38
 
39
 class FilamentRunoutSensor {
39
 class FilamentRunoutSensor {
40
   public:
40
   public:
41
+    static bool enabled;
42
+
41
     FilamentRunoutSensor() {}
43
     FilamentRunoutSensor() {}
42
 
44
 
43
     static void setup();
45
     static void setup();
56
     static uint8_t runout_count;
58
     static uint8_t runout_count;
57
 
59
 
58
     FORCE_INLINE static bool check() {
60
     FORCE_INLINE static bool check() {
61
+      if (!enabled) return false;
59
       #if NUM_RUNOUT_SENSORS < 2
62
       #if NUM_RUNOUT_SENSORS < 2
60
         // A single sensor applying to all extruders
63
         // A single sensor applying to all extruders
61
         const bool is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;
64
         const bool is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;

+ 4
- 1
Marlin/src/lcd/language/language_en.h Parādīt failu

973
   #define MSG_CASE_LIGHT                      _UxGT("Case light")
973
   #define MSG_CASE_LIGHT                      _UxGT("Case light")
974
 #endif
974
 #endif
975
 #ifndef MSG_CASE_LIGHT_BRIGHTNESS
975
 #ifndef MSG_CASE_LIGHT_BRIGHTNESS
976
-  #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Light BRIGHTNESS")
976
+  #define MSG_CASE_LIGHT_BRIGHTNESS           _UxGT("Light Brightness")
977
 #endif
977
 #endif
978
 #if LCD_WIDTH >= 20
978
 #if LCD_WIDTH >= 20
979
   #ifndef MSG_INFO_PRINT_COUNT
979
   #ifndef MSG_INFO_PRINT_COUNT
1047
 #ifndef MSG_FILAMENT_CHANGE_NOZZLE
1047
 #ifndef MSG_FILAMENT_CHANGE_NOZZLE
1048
   #define MSG_FILAMENT_CHANGE_NOZZLE          _UxGT("  Nozzle: ")
1048
   #define MSG_FILAMENT_CHANGE_NOZZLE          _UxGT("  Nozzle: ")
1049
 #endif
1049
 #endif
1050
+#ifndef MSG_RUNOUT_SENSOR_ENABLE
1051
+  #define MSG_RUNOUT_SENSOR_ENABLE            _UxGT("Runout Sensor")
1052
+#endif
1050
 #ifndef MSG_ERR_HOMING_FAILED
1053
 #ifndef MSG_ERR_HOMING_FAILED
1051
   #define MSG_ERR_HOMING_FAILED               _UxGT("Homing failed")
1054
   #define MSG_ERR_HOMING_FAILED               _UxGT("Homing failed")
1052
 #endif
1055
 #endif

+ 8
- 0
Marlin/src/lcd/ultralcd.cpp Parādīt failu

71
   #include "../feature/leds/leds.h"
71
   #include "../feature/leds/leds.h"
72
 #endif
72
 #endif
73
 
73
 
74
+#if ENABLED(FILAMENT_RUNOUT_SENSOR)
75
+  #include "../feature/runout.h"
76
+#endif
77
+
74
 #if DISABLED(LCD_USE_I2C_BUZZER)
78
 #if DISABLED(LCD_USE_I2C_BUZZER)
75
   #include "../libs/buzzer.h"
79
   #include "../libs/buzzer.h"
76
 #endif
80
 #endif
3428
       MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu);
3432
       MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu);
3429
     #endif
3433
     #endif
3430
 
3434
 
3435
+    #if ENABLED(FILAMENT_RUNOUT_SENSOR)
3436
+      MENU_ITEM_EDIT(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled);
3437
+    #endif
3438
+
3431
     #if DISABLED(SLIM_LCD_MENUS)
3439
     #if DISABLED(SLIM_LCD_MENUS)
3432
       // Preheat configurations
3440
       // Preheat configurations
3433
       MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_configuration_temperature_preheat_material1_settings_menu);
3441
       MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_configuration_temperature_preheat_material1_settings_menu);

Notiek ielāde…
Atcelt
Saglabāt