浏览代码

Added Menu entry for Case light

Kai 8 年前
父节点
当前提交
0c341f0c50
共有 3 个文件被更改,包括 31 次插入7 次删除
  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 查看文件

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

+ 6
- 0
Marlin/language_en.h 查看文件

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 查看文件

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();
581
     START_MENU();
584
     START_MENU();
582
     MENU_BACK(MSG_WATCH);
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
     #if ENABLED(BLTOUCH)
597
     #if ENABLED(BLTOUCH)
585
       if (!endstops.z_probe_enabled && TEST_BLTOUCH())
598
       if (!endstops.z_probe_enabled && TEST_BLTOUCH())
586
         MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
599
         MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));
857
 
870
 
858
     static void lcd_dac_menu() {
871
     static void lcd_dac_menu() {
859
       dac_driver_getValues();
872
       dac_driver_getValues();
860
-      START_MENU();    
873
+      START_MENU();
861
       MENU_BACK(MSG_CONTROL);
874
       MENU_BACK(MSG_CONTROL);
862
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit);
875
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit);
863
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit);
876
       MENU_ITEM_EDIT_CALLBACK(int3, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit);
1547
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
1560
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
1548
     #endif
1561
     #endif
1549
     #if ENABLED(DAC_STEPPER_CURRENT)
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
     #endif
1564
     #endif
1552
 
1565
 
1553
     #if ENABLED(EEPROM_SETTINGS)
1566
     #if ENABLED(EEPROM_SETTINGS)

正在加载...
取消
保存