Explorar el Código

Added Menu entry for Case light

Kai hace 8 años
padre
commit
0c341f0c50
Se han modificado 3 ficheros con 31 adiciones y 7 borrados
  1. 10
    5
      Marlin/Marlin_main.cpp
  2. 6
    0
      Marlin/language_en.h
  3. 15
    2
      Marlin/ultralcd.cpp

+ 10
- 5
Marlin/Marlin_main.cpp Ver fichero

@@ -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
@@ -7225,11 +7235,6 @@ inline void gcode_M907() {
7225 7235
    *   P<byte>  Set case light brightness (PWM pin required)
7226 7236
    */
7227 7237
   inline void gcode_M355() {
7228
-    static bool case_light_on
7229
-      #if ENABLED(CASE_LIGHT_DEFAULT_ON)
7230
-        = true
7231
-      #endif
7232
-    ;
7233 7238
     static uint8_t case_light_brightness = 255;
7234 7239
     if (code_seen('P')) case_light_brightness = code_value_byte();
7235 7240
     if (code_seen('S')) {

+ 6
- 0
Marlin/language_en.h Ver fichero

@@ -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 Ver fichero

@@ -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();
@@ -581,6 +584,16 @@ void kill_screen(const char* lcd_msg) {
581 584
     START_MENU();
582 585
     MENU_BACK(MSG_WATCH);
583 586
 
587
+    //
588
+    // Switch case light on/off
589
+    //
590
+    #if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT)
591
+      if (case_light_on == 0)
592
+        MENU_ITEM(gcode, MSG_LIGHTS_ON, PSTR("M355 S1"));
593
+      else
594
+        MENU_ITEM(gcode, MSG_LIGHTS_OFF, PSTR("M355 S0"));
595
+    #endif
596
+
584 597
     #if ENABLED(BLTOUCH)
585 598
       if (!endstops.z_probe_enabled && TEST_BLTOUCH())
586 599
         MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
@@ -857,7 +870,7 @@ void kill_screen(const char* lcd_msg) {
857 870
 
858 871
     static void lcd_dac_menu() {
859 872
       dac_driver_getValues();
860
-      START_MENU();    
873
+      START_MENU();
861 874
       MENU_BACK(MSG_CONTROL);
862 875
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit);
863 876
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit);
@@ -1547,7 +1560,7 @@ void kill_screen(const char* lcd_msg) {
1547 1560
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
1548 1561
     #endif
1549 1562
     #if ENABLED(DAC_STEPPER_CURRENT)
1550
-      MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu); 
1563
+      MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu);
1551 1564
     #endif
1552 1565
 
1553 1566
     #if ENABLED(EEPROM_SETTINGS)

Loading…
Cancelar
Guardar