Scott Lahteine vor 8 Jahren
Ursprung
Commit
ae9b09fe94
1 geänderte Dateien mit 56 neuen und 56 gelöschten Zeilen
  1. 56
    56
      Marlin/ultralcd.cpp

+ 56
- 56
Marlin/ultralcd.cpp Datei anzeigen

@@ -129,13 +129,13 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
129 129
   #endif
130 130
 
131 131
   // Function pointer to menu functions.
132
-  typedef void (*menuFunc_t)();
132
+  typedef void (*screenFunc_t)();
133 133
 
134 134
   // Different types of actions that can be used in menu items.
135 135
   static void menu_action_back();
136
-  static void menu_action_submenu(menuFunc_t data);
136
+  static void menu_action_submenu(screenFunc_t data);
137 137
   static void menu_action_gcode(const char* pgcode);
138
-  static void menu_action_function(menuFunc_t data);
138
+  static void menu_action_function(screenFunc_t data);
139 139
   static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
140 140
   static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
141 141
   static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
@@ -145,15 +145,15 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
145 145
   static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
146 146
   static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
147 147
   static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
148
-  static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
149
-  static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
150
-  static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
151
-  static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
152
-  static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
153
-  static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
154
-  static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
155
-  static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
156
-  static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
148
+  static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
149
+  static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callbackFunc);
150
+  static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
151
+  static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
152
+  static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
153
+  static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
154
+  static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
155
+  static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
156
+  static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, screenFunc_t callbackFunc);
157 157
 
158 158
   #if ENABLED(SDSUPPORT)
159 159
     static void lcd_sdcard_menu();
@@ -286,14 +286,14 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
286 286
   #endif
287 287
 
288 288
   typedef struct {
289
-    menuFunc_t menu_function;
289
+    screenFunc_t menu_function;
290 290
     uint32_t encoder_position;
291 291
   } menuPosition;
292 292
 
293
-  menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active menu handler
293
+  screenFunc_t currentScreen = lcd_status_screen; // pointer to the currently active menu handler
294 294
 
295
-  menuPosition menu_history[10];
296
-  uint8_t menu_history_depth = 0;
295
+  menuPosition screen_history[10];
296
+  uint8_t screen_history_depth = 0;
297 297
 
298 298
   bool ignore_click = false;
299 299
   bool wait_for_unclick;
@@ -303,49 +303,49 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
303 303
   const char* editLabel;
304 304
   void* editValue;
305 305
   int32_t minEditValue, maxEditValue;
306
-  menuFunc_t callbackFunc;              // call this after editing
306
+  screenFunc_t callbackFunc;              // call this after editing
307 307
 
308 308
   /**
309 309
    * General function to go directly to a menu
310 310
    * Remembers the previous position
311 311
    */
312
-  static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const uint32_t encoder = 0) {
313
-    if (currentMenu != menu) {
314
-      currentMenu = menu;
312
+  static void lcd_goto_screen(screenFunc_t screen, const bool feedback = false, const uint32_t encoder = 0) {
313
+    if (currentScreen != screen) {
314
+      currentScreen = screen;
315 315
       lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
316 316
       #if ENABLED(NEWPANEL)
317 317
         encoderPosition = encoder;
318 318
         if (feedback) lcd_quick_feedback();
319 319
       #endif
320
-      if (menu == lcd_status_screen) {
320
+      if (screen == lcd_status_screen) {
321 321
         defer_return_to_status = false;
322
-        menu_history_depth = 0;
322
+        screen_history_depth = 0;
323 323
       }
324 324
       #if ENABLED(LCD_PROGRESS_BAR)
325 325
         // For LCD_PROGRESS_BAR re-initialize custom characters
326
-        lcd_set_custom_characters(menu == lcd_status_screen);
326
+        lcd_set_custom_characters(screen == lcd_status_screen);
327 327
       #endif
328 328
     }
329 329
   }
330 330
 
331
-  static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
331
+  static void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
332 332
 
333 333
   inline void lcd_save_previous_menu() {
334
-    if (menu_history_depth < COUNT(menu_history)) {
335
-      menu_history[menu_history_depth].menu_function = currentMenu;
334
+    if (screen_history_depth < COUNT(screen_history)) {
335
+      screen_history[screen_history_depth].menu_function = currentScreen;
336 336
       #if ENABLED(ULTIPANEL)
337
-        menu_history[menu_history_depth].encoder_position = encoderPosition;
337
+        screen_history[screen_history_depth].encoder_position = encoderPosition;
338 338
       #endif
339
-      ++menu_history_depth;
339
+      ++screen_history_depth;
340 340
     }
341 341
   }
342 342
 
343 343
   static void lcd_goto_previous_menu(bool feedback=false) {
344
-    if (menu_history_depth > 0) {
345
-      --menu_history_depth;
346
-      lcd_goto_menu(menu_history[menu_history_depth].menu_function, feedback
344
+    if (screen_history_depth > 0) {
345
+      --screen_history_depth;
346
+      lcd_goto_screen(screen_history[screen_history_depth].menu_function, feedback
347 347
         #if ENABLED(ULTIPANEL)
348
-          , menu_history[menu_history_depth].encoder_position
348
+          , screen_history[screen_history_depth].encoder_position
349 349
         #endif
350 350
       );
351 351
     }
@@ -428,10 +428,10 @@ static void lcd_status_screen() {
428 428
     }
429 429
 
430 430
     if (current_click) {
431
-      lcd_goto_menu(lcd_main_menu, true);
431
+      lcd_goto_screen(lcd_main_menu, true);
432 432
       lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
433 433
         #if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
434
-          currentMenu == lcd_status_screen
434
+          currentScreen == lcd_status_screen
435 435
         #endif
436 436
       );
437 437
       #if ENABLED(FILAMENT_LCD_DISPLAY)
@@ -588,11 +588,11 @@ static void lcd_status_screen() {
588 588
     #if ENABLED(BABYSTEP_XY)
589 589
       static void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
590 590
       static void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
591
-      static void lcd_babystep_x() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_x); }
592
-      static void lcd_babystep_y() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_y); }
591
+      static void lcd_babystep_x() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_x); }
592
+      static void lcd_babystep_y() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_y); }
593 593
     #endif
594 594
     static void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); }
595
-    static void lcd_babystep_z() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_z); }
595
+    static void lcd_babystep_z() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_z); }
596 596
 
597 597
   #endif //BABYSTEPPING
598 598
 
@@ -970,7 +970,7 @@ static void lcd_status_screen() {
970 970
           debounce_click = true; // ignore multiple "clicks" in a row
971 971
           mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]);
972 972
           if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
973
-            lcd_goto_menu(_lcd_level_bed_done, true);
973
+            lcd_goto_screen(_lcd_level_bed_done, true);
974 974
 
975 975
             current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
976 976
               #if MIN_Z_HEIGHT_FOR_HOMING > 0
@@ -990,7 +990,7 @@ static void lcd_status_screen() {
990 990
             #endif
991 991
           }
992 992
           else {
993
-            lcd_goto_menu(_lcd_level_goto_next_point, true);
993
+            lcd_goto_screen(_lcd_level_goto_next_point, true);
994 994
           }
995 995
         }
996 996
       }
@@ -1031,7 +1031,7 @@ static void lcd_status_screen() {
1031 1031
      */
1032 1032
     static void _lcd_level_goto_next_point() {
1033 1033
       // Set the menu to display ahead of blocking call
1034
-      lcd_goto_menu(_lcd_level_bed_moving);
1034
+      lcd_goto_screen(_lcd_level_bed_moving);
1035 1035
 
1036 1036
       // _mbl_goto_xy runs the menu loop until the move is done
1037 1037
       int8_t px, py;
@@ -1039,7 +1039,7 @@ static void lcd_status_screen() {
1039 1039
       _mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py));
1040 1040
 
1041 1041
       // After the blocking function returns, change menus
1042
-      lcd_goto_menu(_lcd_level_bed_get_z);
1042
+      lcd_goto_screen(_lcd_level_bed_get_z);
1043 1043
     }
1044 1044
 
1045 1045
     /**
@@ -1052,7 +1052,7 @@ static void lcd_status_screen() {
1052 1052
         _lcd_level_bed_position = 0;
1053 1053
         current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1054 1054
         planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1055
-        lcd_goto_menu(_lcd_level_goto_next_point, true);
1055
+        lcd_goto_screen(_lcd_level_goto_next_point, true);
1056 1056
       }
1057 1057
     }
1058 1058
 
@@ -1069,7 +1069,7 @@ static void lcd_status_screen() {
1069 1069
         #endif
1070 1070
       ;
1071 1071
       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1072
-        lcd_goto_menu(_lcd_level_bed_homing_done);
1072
+        lcd_goto_screen(_lcd_level_bed_homing_done);
1073 1073
     }
1074 1074
 
1075 1075
     /**
@@ -1080,7 +1080,7 @@ static void lcd_status_screen() {
1080 1080
       axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false;
1081 1081
       mbl.reset();
1082 1082
       enqueue_and_echo_commands_P(PSTR("G28"));
1083
-      lcd_goto_menu(_lcd_level_bed_homing);
1083
+      lcd_goto_screen(_lcd_level_bed_homing);
1084 1084
     }
1085 1085
 
1086 1086
     /**
@@ -1868,7 +1868,7 @@ static void lcd_status_screen() {
1868 1868
    *   void menu_edit_callback_int3(); // edit int (interactively) with callback on completion
1869 1869
    *   static void _menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
1870 1870
    *   static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
1871
-   *   static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callback); // edit int with callback
1871
+   *   static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callback); // edit int with callback
1872 1872
    *
1873 1873
    * You can then use one of the menu macros to present the edit interface:
1874 1874
    *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_multiplier, 10, 999)
@@ -1910,11 +1910,11 @@ static void lcd_status_screen() {
1910 1910
     } \
1911 1911
     static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
1912 1912
       _menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
1913
-      currentMenu = menu_edit_ ## _name; \
1913
+      currentScreen = menu_edit_ ## _name; \
1914 1914
     }\
1915
-    static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, menuFunc_t callback) { \
1915
+    static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, screenFunc_t callback) { \
1916 1916
       _menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
1917
-      currentMenu = menu_edit_callback_ ## _name; \
1917
+      currentScreen = menu_edit_callback_ ## _name; \
1918 1918
       callbackFunc = callback; \
1919 1919
     }
1920 1920
   menu_edit_type(int, int3, itostr3, 1);
@@ -1999,9 +1999,9 @@ static void lcd_status_screen() {
1999 1999
    *
2000 2000
    */
2001 2001
   static void menu_action_back() { lcd_goto_previous_menu(); }
2002
-  static void menu_action_submenu(menuFunc_t func) { lcd_save_previous_menu(); lcd_goto_menu(func); }
2002
+  static void menu_action_submenu(screenFunc_t func) { lcd_save_previous_menu(); lcd_goto_screen(func); }
2003 2003
   static void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
2004
-  static void menu_action_function(menuFunc_t func) { (*func)(); }
2004
+  static void menu_action_function(screenFunc_t func) { (*func)(); }
2005 2005
 
2006 2006
   #if ENABLED(SDSUPPORT)
2007 2007
 
@@ -2020,7 +2020,7 @@ static void lcd_status_screen() {
2020 2020
   #endif //SDSUPPORT
2021 2021
 
2022 2022
   static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr = !(*ptr); }
2023
-  static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) {
2023
+  static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) {
2024 2024
     menu_action_setting_edit_bool(pstr, ptr);
2025 2025
     (*callback)();
2026 2026
   }
@@ -2180,7 +2180,7 @@ void lcd_update() {
2180 2180
       lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
2181 2181
       lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
2182 2182
         #if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
2183
-          currentMenu == lcd_status_screen
2183
+          currentScreen == lcd_status_screen
2184 2184
         #endif
2185 2185
       );
2186 2186
 
@@ -2280,7 +2280,7 @@ void lcd_update() {
2280 2280
     static int8_t lcd_status_update_delay = 1; // first update one loop delayed
2281 2281
     if (
2282 2282
       #if ENABLED(ULTIPANEL)
2283
-        currentMenu == lcd_status_screen &&
2283
+        currentScreen == lcd_status_screen &&
2284 2284
       #endif
2285 2285
         !lcd_status_update_delay--) {
2286 2286
       lcd_status_update_delay = 9;
@@ -2312,14 +2312,14 @@ void lcd_update() {
2312 2312
           u8g.drawPixel(127, 63); // draw alive dot
2313 2313
           u8g.setColorIndex(1); // black on white
2314 2314
           #if ENABLED(ULTIPANEL)
2315
-            (*currentMenu)();
2315
+            (*currentScreen)();
2316 2316
           #else
2317 2317
             lcd_status_screen();
2318 2318
           #endif
2319 2319
         } while (u8g.nextPage());
2320 2320
       #else
2321 2321
         #if ENABLED(ULTIPANEL)
2322
-          (*currentMenu)();
2322
+          (*currentScreen)();
2323 2323
         #else
2324 2324
           lcd_status_screen();
2325 2325
         #endif
@@ -2329,7 +2329,7 @@ void lcd_update() {
2329 2329
     #if ENABLED(ULTIPANEL)
2330 2330
 
2331 2331
       // Return to Status Screen after a timeout
2332
-      if (currentMenu == lcd_status_screen || defer_return_to_status)
2332
+      if (currentScreen == lcd_status_screen || defer_return_to_status)
2333 2333
         return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
2334 2334
       else if (ELAPSED(ms, return_to_status_ms))
2335 2335
         lcd_return_to_status();

Laden…
Abbrechen
Speichern