Просмотр исходного кода

Merge pull request #5255 from Kaibob2/CaseLightMenu

Case light menu (3rd attempt)
Scott Lahteine 8 лет назад
Родитель
Сommit
7f8133a51f
4 измененных файлов: 33 добавлений и 7 удалений
  1. 10
    5
      Marlin/Marlin_main.cpp
  2. 2
    0
      Marlin/language_de.h
  3. 6
    0
      Marlin/language_en.h
  4. 15
    2
      Marlin/ultralcd.cpp

+ 10
- 5
Marlin/Marlin_main.cpp Просмотреть файл

@@ -530,6 +530,16 @@ static uint8_t target_extruder;
530 530
   ;
531 531
 #endif
532 532
 
533
+#if ENABLED(ULTIPANEL) && HAS_CASE_LIGHT
534
+  bool case_light_on =
535
+    #if ENABLED(CASE_LIGHT_DEFAULT_ON)
536
+      true
537
+    #else
538
+      false
539
+    #endif
540
+  ;
541
+#endif
542
+
533 543
 #if ENABLED(DELTA)
534 544
 
535 545
   #define SIN_60 0.8660254037844386
@@ -7274,11 +7284,6 @@ inline void gcode_M907() {
7274 7284
    *   P<byte>  Set case light brightness (PWM pin required)
7275 7285
    */
7276 7286
   inline void gcode_M355() {
7277
-    static bool case_light_on
7278
-      #if ENABLED(CASE_LIGHT_DEFAULT_ON)
7279
-        = true
7280
-      #endif
7281
-    ;
7282 7287
     static uint8_t case_light_brightness = 255;
7283 7288
     if (code_seen('P')) case_light_brightness = code_value_byte();
7284 7289
     if (code_seen('S')) {

+ 2
- 0
Marlin/language_de.h Просмотреть файл

@@ -184,6 +184,8 @@
184 184
 #define MSG_INFO_EXTRUDERS                  "Extruders"
185 185
 #define MSG_INFO_BAUDRATE                   "Baud"
186 186
 #define MSG_INFO_PROTOCOL                   "Protokol"
187
+#define MSG_LIGHTS_ON                       "Gehäuse Licht an"
188
+#define MSG_LIGHTS_OFF                      "Gehäuse Licht aus"
187 189
 
188 190
 #if LCD_WIDTH >= 20
189 191
   #define MSG_INFO_PRINT_COUNT              "Gesamte Drucke"

+ 6
- 0
Marlin/language_en.h Просмотреть файл

@@ -487,6 +487,12 @@
487 487
 #ifndef MSG_INFO_PROTOCOL
488 488
   #define MSG_INFO_PROTOCOL                   "Protocol"
489 489
 #endif
490
+#ifndef MSG_LIGHTS_ON
491
+  #define MSG_LIGHTS_ON                       "Case light on"
492
+#endif
493
+#ifndef MSG_LIGHTS_OFF
494
+  #define MSG_LIGHTS_OFF                      "Case light off"
495
+#endif
490 496
 
491 497
 #if LCD_WIDTH >= 20
492 498
   #ifndef MSG_INFO_PRINT_COUNT

+ 15
- 2
Marlin/ultralcd.cpp Просмотреть файл

@@ -110,6 +110,9 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
110 110
   #if HAS_POWER_SWITCH
111 111
     extern bool powersupply;
112 112
   #endif
113
+  #if HAS_CASE_LIGHT
114
+    extern bool case_light_on;
115
+  #endif
113 116
   const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE;
114 117
   static void lcd_main_menu();
115 118
   static void lcd_tune_menu();
@@ -583,6 +586,16 @@ void kill_screen(const char* lcd_msg) {
583 586
     START_MENU();
584 587
     MENU_BACK(MSG_WATCH);
585 588
 
589
+    //
590
+    // Switch case light on/off
591
+    //
592
+    #if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT)
593
+      if (case_light_on == 0)
594
+        MENU_ITEM(gcode, MSG_LIGHTS_ON, PSTR("M355 S1"));
595
+      else
596
+        MENU_ITEM(gcode, MSG_LIGHTS_OFF, PSTR("M355 S0"));
597
+    #endif
598
+
586 599
     #if ENABLED(BLTOUCH)
587 600
       if (!endstops.z_probe_enabled && TEST_BLTOUCH())
588 601
         MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
@@ -859,7 +872,7 @@ void kill_screen(const char* lcd_msg) {
859 872
 
860 873
     static void lcd_dac_menu() {
861 874
       dac_driver_getValues();
862
-      START_MENU();    
875
+      START_MENU();
863 876
       MENU_BACK(MSG_CONTROL);
864 877
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit);
865 878
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit);
@@ -1549,7 +1562,7 @@ void kill_screen(const char* lcd_msg) {
1549 1562
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
1550 1563
     #endif
1551 1564
     #if ENABLED(DAC_STEPPER_CURRENT)
1552
-      MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu); 
1565
+      MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu);
1553 1566
     #endif
1554 1567
 
1555 1568
     #if ENABLED(EEPROM_SETTINGS)

Загрузка…
Отмена
Сохранить