소스 검색

Clean up main menu (#11972)

InsanityAutomation 6 년 전
부모
커밋
2e98437392
1개의 변경된 파일52개의 추가작업 그리고 42개의 파일을 삭제
  1. 52
    42
      Marlin/src/lcd/ultralcd.cpp

+ 52
- 42
Marlin/src/lcd/ultralcd.cpp 파일 보기

507
     return click;
507
     return click;
508
   }
508
   }
509
 
509
 
510
+  inline bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING; }
511
+
510
   /**
512
   /**
511
    * General function to go directly to a screen
513
    * General function to go directly to a screen
512
    */
514
    */
526
           if (currentScreen == lcd_status_screen)
528
           if (currentScreen == lcd_status_screen)
527
             doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
529
             doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
528
         }
530
         }
529
-        else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms)/* && (planner.movesplanned() || IS_SD_PRINTING)*/)
531
+        else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms)/* && printer_busy()*/)
530
           screen =
532
           screen =
531
             #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
533
             #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
532
               lcd_babystep_zoffset
534
               lcd_babystep_zoffset
1053
     static void IDEX_menu() {
1055
     static void IDEX_menu() {
1054
       START_MENU();
1056
       START_MENU();
1055
       MENU_BACK(MSG_MAIN);
1057
       MENU_BACK(MSG_MAIN);
1058
+
1056
       MENU_ITEM(gcode, MSG_IDEX_MODE_AUTOPARK,  PSTR("M605 S1\nG28 X\nG1 X100"));
1059
       MENU_ITEM(gcode, MSG_IDEX_MODE_AUTOPARK,  PSTR("M605 S1\nG28 X\nG1 X100"));
1057
       const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS));
1060
       const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS));
1058
       MENU_ITEM(gcode, MSG_IDEX_MODE_DUPLICATE, need_g28
1061
       MENU_ITEM(gcode, MSG_IDEX_MODE_DUPLICATE, need_g28
1145
     START_MENU();
1148
     START_MENU();
1146
     MENU_BACK(MSG_WATCH);
1149
     MENU_BACK(MSG_WATCH);
1147
 
1150
 
1148
-    #if ENABLED(CUSTOM_USER_MENUS)
1149
-      MENU_ITEM(submenu, MSG_USER_MENU, _lcd_user_menu);
1150
-    #endif
1151
-
1152
-    #if ENABLED(DUAL_X_CARRIAGE)
1153
-      MENU_ITEM(submenu, MSG_IDEX_MENU, IDEX_menu);
1154
-    #endif
1155
-
1156
-    //
1157
-    // Debug Menu when certain options are enabled
1158
-    //
1159
-    #if HAS_DEBUG_MENU
1160
-      MENU_ITEM(submenu, MSG_DEBUG_MENU, lcd_debug_menu);
1161
-    #endif
1162
-
1163
-    //
1164
-    // Set Case light on/off/brightness
1165
-    //
1166
-    #if ENABLED(MENU_ITEM_CASE_LIGHT)
1167
-      if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
1168
-        MENU_ITEM(submenu, MSG_CASE_LIGHT, case_light_menu);
1169
-      }
1170
-      else
1171
-        MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
1172
-    #endif
1173
-
1174
     #if ENABLED(SDSUPPORT)
1151
     #if ENABLED(SDSUPPORT)
1175
       if (card.cardOK) {
1152
       if (card.cardOK) {
1176
         if (card.isFileOpen()) {
1153
         if (card.isFileOpen()) {
1195
       }
1172
       }
1196
     #endif // SDSUPPORT
1173
     #endif // SDSUPPORT
1197
 
1174
 
1198
-    if (planner.movesplanned() || IS_SD_PRINTING)
1175
+    const bool busy = printer_busy();
1176
+    if (busy)
1199
       MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
1177
       MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
1200
     else {
1178
     else {
1201
       MENU_ITEM(submenu, MSG_MOTION, lcd_movement_menu);
1179
       MENU_ITEM(submenu, MSG_MOTION, lcd_movement_menu);
1202
       MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_temperature_menu);
1180
       MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_temperature_menu);
1203
-      MENU_ITEM(submenu, MSG_CONFIGURATION, lcd_configuration_menu);
1204
     }
1181
     }
1205
 
1182
 
1183
+    MENU_ITEM(submenu, MSG_CONFIGURATION, lcd_configuration_menu);
1184
+
1185
+    #if ENABLED(CUSTOM_USER_MENUS)
1186
+      MENU_ITEM(submenu, MSG_USER_MENU, _lcd_user_menu);
1187
+    #endif
1188
+
1206
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
1189
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
1207
       #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
1190
       #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
1208
         if (thermalManager.targetHotEnoughToExtrude(active_extruder))
1191
         if (thermalManager.targetHotEnoughToExtrude(active_extruder))
1236
     // Autostart
1219
     // Autostart
1237
     //
1220
     //
1238
     #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
1221
     #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
1239
-      MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
1222
+      if (!busy)
1223
+        MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
1240
     #endif
1224
     #endif
1241
 
1225
 
1242
     END_MENU();
1226
     END_MENU();
2727
      *    Load Settings       (Req: EEPROM_SETTINGS)
2711
      *    Load Settings       (Req: EEPROM_SETTINGS)
2728
      *    Save Settings       (Req: EEPROM_SETTINGS)
2712
      *    Save Settings       (Req: EEPROM_SETTINGS)
2729
      */
2713
      */
2730
-    void lcd_bed_leveling() {
2714
+    void lcd_bed_leveling_menu() {
2731
       START_MENU();
2715
       START_MENU();
2732
       MENU_BACK(MSG_MOTION);
2716
       MENU_BACK(MSG_MOTION);
2733
 
2717
 
2836
       #if ENABLED(PROBE_MANUALLY)
2820
       #if ENABLED(PROBE_MANUALLY)
2837
         if (!g29_in_progress)
2821
         if (!g29_in_progress)
2838
       #endif
2822
       #endif
2839
-          MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
2823
+          MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling_menu);
2840
 
2824
 
2841
     #elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)
2825
     #elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)
2842
 
2826
 
3418
     START_MENU();
3402
     START_MENU();
3419
     MENU_BACK(MSG_MAIN);
3403
     MENU_BACK(MSG_MAIN);
3420
 
3404
 
3405
+    //
3406
+    // Debug Menu when certain options are enabled
3407
+    //
3408
+    #if HAS_DEBUG_MENU
3409
+      MENU_ITEM(submenu, MSG_DEBUG_MENU, lcd_debug_menu);
3410
+    #endif
3411
+
3421
     MENU_ITEM(submenu, MSG_ADVANCED_SETTINGS, lcd_advanced_settings_menu);
3412
     MENU_ITEM(submenu, MSG_ADVANCED_SETTINGS, lcd_advanced_settings_menu);
3422
 
3413
 
3414
+    const bool busy = printer_busy();
3415
+    if (!busy) {
3416
+      //
3417
+      // Delta Calibration
3418
+      //
3419
+      #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)
3420
+        MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
3421
+      #endif
3422
+
3423
+      #if ENABLED(DUAL_X_CARRIAGE)
3424
+        MENU_ITEM(submenu, MSG_IDEX_MENU, IDEX_menu);
3425
+      #endif
3426
+
3427
+      #if ENABLED(BLTOUCH)
3428
+        MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu);
3429
+      #endif
3430
+    }
3431
+
3423
     //
3432
     //
3424
-    // Delta Calibration
3433
+    // Set Case light on/off/brightness
3425
     //
3434
     //
3426
-    #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)
3427
-      MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
3435
+    #if ENABLED(MENU_ITEM_CASE_LIGHT)
3436
+      if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN))
3437
+        MENU_ITEM(submenu, MSG_CASE_LIGHT, case_light_menu);
3438
+      else
3439
+        MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
3428
     #endif
3440
     #endif
3429
 
3441
 
3430
     #if HAS_LCD_CONTRAST
3442
     #if HAS_LCD_CONTRAST
3440
       MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_pwm_menu);
3452
       MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_pwm_menu);
3441
     #endif
3453
     #endif
3442
 
3454
 
3443
-    #if ENABLED(BLTOUCH)
3444
-      MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu);
3445
-    #endif
3446
-
3447
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
3455
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
3448
       MENU_ITEM_EDIT(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled);
3456
       MENU_ITEM_EDIT(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled);
3449
     #endif
3457
     #endif
3456
 
3464
 
3457
     #if ENABLED(EEPROM_SETTINGS)
3465
     #if ENABLED(EEPROM_SETTINGS)
3458
       MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
3466
       MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
3459
-      MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
3467
+      if (!busy)
3468
+        MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
3460
     #endif
3469
     #endif
3461
 
3470
 
3462
-    MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
3471
+    if (!busy)
3472
+      MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
3463
 
3473
 
3464
     END_MENU();
3474
     END_MENU();
3465
   }
3475
   }
4670
         #endif // E_STEPPERS == 1
4680
         #endif // E_STEPPERS == 1
4671
 
4681
 
4672
         #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
4682
         #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
4673
-          if (!planner.movesplanned() && !IS_SD_FILE_OPEN) {
4683
+          if (!printer_busy()) {
4674
             // Load filament
4684
             // Load filament
4675
             #if E_STEPPERS == 1
4685
             #if E_STEPPERS == 1
4676
               PGM_P msg0 = PSTR(MSG_FILAMENTLOAD);
4686
               PGM_P msg0 = PSTR(MSG_FILAMENTLOAD);

Loading…
취소
저장