Selaa lähdekoodia

Merge pull request #5255 from Kaibob2/CaseLightMenu

Case light menu (3rd attempt)
Scott Lahteine 8 vuotta sitten
vanhempi
commit
7f8133a51f
4 muutettua tiedostoa jossa 33 lisäystä ja 7 poistoa
  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 Näytä tiedosto

530
   ;
530
   ;
531
 #endif
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
 #if ENABLED(DELTA)
543
 #if ENABLED(DELTA)
534
 
544
 
535
   #define SIN_60 0.8660254037844386
545
   #define SIN_60 0.8660254037844386
7274
    *   P<byte>  Set case light brightness (PWM pin required)
7284
    *   P<byte>  Set case light brightness (PWM pin required)
7275
    */
7285
    */
7276
   inline void gcode_M355() {
7286
   inline void gcode_M355() {
7277
-    static bool case_light_on
7278
-      #if ENABLED(CASE_LIGHT_DEFAULT_ON)
7279
-        = true
7280
-      #endif
7281
-    ;
7282
     static uint8_t case_light_brightness = 255;
7287
     static uint8_t case_light_brightness = 255;
7283
     if (code_seen('P')) case_light_brightness = code_value_byte();
7288
     if (code_seen('P')) case_light_brightness = code_value_byte();
7284
     if (code_seen('S')) {
7289
     if (code_seen('S')) {

+ 2
- 0
Marlin/language_de.h Näytä tiedosto

184
 #define MSG_INFO_EXTRUDERS                  "Extruders"
184
 #define MSG_INFO_EXTRUDERS                  "Extruders"
185
 #define MSG_INFO_BAUDRATE                   "Baud"
185
 #define MSG_INFO_BAUDRATE                   "Baud"
186
 #define MSG_INFO_PROTOCOL                   "Protokol"
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
 #if LCD_WIDTH >= 20
190
 #if LCD_WIDTH >= 20
189
   #define MSG_INFO_PRINT_COUNT              "Gesamte Drucke"
191
   #define MSG_INFO_PRINT_COUNT              "Gesamte Drucke"

+ 6
- 0
Marlin/language_en.h Näytä tiedosto

487
 #ifndef MSG_INFO_PROTOCOL
487
 #ifndef MSG_INFO_PROTOCOL
488
   #define MSG_INFO_PROTOCOL                   "Protocol"
488
   #define MSG_INFO_PROTOCOL                   "Protocol"
489
 #endif
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
 #if LCD_WIDTH >= 20
497
 #if LCD_WIDTH >= 20
492
   #ifndef MSG_INFO_PRINT_COUNT
498
   #ifndef MSG_INFO_PRINT_COUNT

+ 15
- 2
Marlin/ultralcd.cpp Näytä tiedosto

110
   #if HAS_POWER_SWITCH
110
   #if HAS_POWER_SWITCH
111
     extern bool powersupply;
111
     extern bool powersupply;
112
   #endif
112
   #endif
113
+  #if HAS_CASE_LIGHT
114
+    extern bool case_light_on;
115
+  #endif
113
   const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE;
116
   const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE;
114
   static void lcd_main_menu();
117
   static void lcd_main_menu();
115
   static void lcd_tune_menu();
118
   static void lcd_tune_menu();
583
     START_MENU();
586
     START_MENU();
584
     MENU_BACK(MSG_WATCH);
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
     #if ENABLED(BLTOUCH)
599
     #if ENABLED(BLTOUCH)
587
       if (!endstops.z_probe_enabled && TEST_BLTOUCH())
600
       if (!endstops.z_probe_enabled && TEST_BLTOUCH())
588
         MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
601
         MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
859
 
872
 
860
     static void lcd_dac_menu() {
873
     static void lcd_dac_menu() {
861
       dac_driver_getValues();
874
       dac_driver_getValues();
862
-      START_MENU();    
875
+      START_MENU();
863
       MENU_BACK(MSG_CONTROL);
876
       MENU_BACK(MSG_CONTROL);
864
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit);
877
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit);
865
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit);
878
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit);
1549
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
1562
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
1550
     #endif
1563
     #endif
1551
     #if ENABLED(DAC_STEPPER_CURRENT)
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
     #endif
1566
     #endif
1554
 
1567
 
1555
     #if ENABLED(EEPROM_SETTINGS)
1568
     #if ENABLED(EEPROM_SETTINGS)

Loading…
Peruuta
Tallenna