소스 검색

Merge pull request #3330 from thinkyhead/rc_mbl_lcdDrawUpdate

Improvements to MBL, general LCD menu handling
Scott Lahteine 8 년 전
부모
커밋
cf9a171aa9

+ 1
- 1
Marlin/Marlin_main.cpp 파일 보기

@@ -5589,7 +5589,7 @@ inline void gcode_M428() {
5589 5589
     memcpy(current_position, new_pos, sizeof(new_pos));
5590 5590
     memcpy(home_offset, new_offs, sizeof(new_offs));
5591 5591
     sync_plan_position();
5592
-    LCD_ALERTMESSAGEPGM("Offset applied.");
5592
+    LCD_ALERTMESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
5593 5593
     #if HAS_BUZZER
5594 5594
       buzz(200, 659);
5595 5595
       buzz(200, 698);

+ 3
- 0
Marlin/language_an.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Amortar motors"
44 44
 #define MSG_AUTO_HOME                       "Levar a l'orichen"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Set home offsets"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Establir zero"
48 51
 #define MSG_PREHEAT_PLA                     "Precalentar PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Precalentar PLA "

+ 3
- 0
Marlin/language_bg.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Изкл. двигатели"
44 44
 #define MSG_AUTO_HOME                       "Паркиране"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Задай Начало"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Изходна точка"
48 51
 #define MSG_PREHEAT_PLA                     "Подгряване PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Подгряване PLA"

+ 3
- 0
Marlin/language_ca.h 파일 보기

@@ -44,7 +44,10 @@
44 44
 #define MSG_DISABLE_STEPPERS                "Apagar motors"
45 45
 #define MSG_AUTO_HOME                       "Home global"
46 46
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
47
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
48
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
47 49
 #define MSG_SET_HOME_OFFSETS                "Set home offsets"
50
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
48 51
 #define MSG_SET_ORIGIN                      "Establir origen"
49 52
 #define MSG_PREHEAT_PLA                     "Preescalfar PLA"
50 53
 #define MSG_PREHEAT_PLA_N                   "Preescalfar PLA "

+ 3
- 0
Marlin/language_cn.h 파일 보기

@@ -41,7 +41,10 @@
41 41
 #define MSG_DISABLE_STEPPERS                "\xb5\xb6\xb7\xb8\xb9\xba"
42 42
 #define MSG_AUTO_HOME                       "\xbb\xbc\xbd"
43 43
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
44
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
45
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
44 46
 #define MSG_SET_HOME_OFFSETS                "\xbe\xbf\xbb\xbc\xbd\xc0\xc1"
47
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
45 48
 #define MSG_SET_ORIGIN                      "\xbe\xbf\xbc\xbd"
46 49
 #define MSG_PREHEAT_PLA                     "\xc3\xc4 PLA"
47 50
 #define MSG_PREHEAT_PLA_N                   MSG_PREHEAT_PLA " "

+ 3
- 0
Marlin/language_cz.h 파일 보기

@@ -47,7 +47,10 @@
47 47
 #define MSG_DISABLE_STEPPERS                "Uvolnit motory"
48 48
 #define MSG_AUTO_HOME                       "Domovska pozice"
49 49
 #define MSG_LEVEL_BED_HOMING                "Mereni podlozky"
50
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
51
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
50 52
 #define MSG_SET_HOME_OFFSETS                "Nastavit ofsety"
53
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
51 54
 #define MSG_SET_ORIGIN                      "Nastavit pocatek"
52 55
 #define MSG_PREHEAT_PLA                     "Zahrat PLA"
53 56
 #define MSG_PREHEAT_PLA_N                   MSG_PREHEAT_PLA " "

+ 3
- 0
Marlin/language_da.h 파일 보기

@@ -44,7 +44,10 @@
44 44
 #define MSG_COOLDOWN                        "Afkøl"
45 45
 #define MSG_DISABLE_STEPPERS                "Slå stepper fra"
46 46
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
47
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
48
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
47 49
 #define MSG_SET_HOME_OFFSETS                "Sæt home offsets"
50
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
48 51
 #define MSG_SET_ORIGIN                      "Sæt origin"
49 52
 #define MSG_SWITCH_PS_ON                    "Slå strøm til"
50 53
 #define MSG_SWITCH_PS_OFF                   "Slå strøm fra"

+ 3
- 0
Marlin/language_de.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Motoren Aus" // M84
44 44
 #define MSG_AUTO_HOME                       "Home" // G28
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Setze Home hier"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Setze Null hier" //"G92 X0 Y0 Z0" commented out in ultralcd.cpp
48 51
 #define MSG_PREHEAT_PLA                     "Vorwärmen PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Vorwärmen PLA "

+ 9
- 0
Marlin/language_en.h 파일 보기

@@ -64,9 +64,18 @@
64 64
 #ifndef MSG_LEVEL_BED_HOMING
65 65
   #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
66 66
 #endif
67
+#ifndef MSG_LEVEL_BED_WAITING
68
+  #define MSG_LEVEL_BED_WAITING               "Click to Begin"
69
+#endif
70
+#ifndef MSG_LEVEL_BED_DONE
71
+  #define MSG_LEVEL_BED_DONE                  "Leveling Done!"
72
+#endif
67 73
 #ifndef MSG_SET_HOME_OFFSETS
68 74
   #define MSG_SET_HOME_OFFSETS                "Set home offsets"
69 75
 #endif
76
+#ifndef MSG_HOME_OFFSETS_APPLIED
77
+  #define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
78
+#endif
70 79
 #ifndef MSG_SET_ORIGIN
71 80
   #define MSG_SET_ORIGIN                      "Set origin"
72 81
 #endif

+ 3
- 0
Marlin/language_es.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Apagar motores"
44 44
 #define MSG_AUTO_HOME                       "Llevar al origen"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Ajustar offsets"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Establecer cero"
48 51
 #define MSG_PREHEAT_PLA                     "Precalentar PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Precalentar PLA "

+ 3
- 0
Marlin/language_eu.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Itzali motoreak"
44 44
 #define MSG_AUTO_HOME                       "Hasierara joan"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Set home offsets"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Hasiera ipini"
48 51
 #define MSG_PREHEAT_PLA                     "Aurreberotu PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Aurreberotu PLA "

+ 3
- 0
Marlin/language_fi.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Vapauta moottorit"
44 44
 #define MSG_AUTO_HOME                       "Aja referenssiin"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Set home offsets"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Aseta origo"
48 51
 #define MSG_PREHEAT_PLA                     "Esilämmitä PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Esilämmitä PLA "

+ 3
- 0
Marlin/language_fr.h 파일 보기

@@ -44,7 +44,10 @@
44 44
 #define MSG_DISABLE_STEPPERS                "Arreter moteurs"
45 45
 #define MSG_AUTO_HOME                       "Home auto."
46 46
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
47
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
48
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
47 49
 #define MSG_SET_HOME_OFFSETS                "Set home offsets"
50
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
48 51
 #define MSG_SET_ORIGIN                      "Regler origine"
49 52
 #define MSG_PREHEAT_PLA                     "Prechauffage PLA"
50 53
 #define MSG_PREHEAT_PLA_N                   "Prechauff. PLA "

+ 3
- 0
Marlin/language_it.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Disabilita Motori"
44 44
 #define MSG_AUTO_HOME                       "Auto Home"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Setta offset home"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Imposta Origine"
48 51
 #define MSG_PREHEAT_PLA                     "Preriscalda PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Preriscalda PLA "

+ 3
- 0
Marlin/language_kana.h 파일 보기

@@ -45,7 +45,10 @@
45 45
 #define MSG_DISABLE_STEPPERS                "\xd3\xb0\xc0\xb0\xc3\xde\xdd\xb9\xde\xdd\x20\xb5\xcc"         // "Disable steppers"
46 46
 #define MSG_AUTO_HOME                       "\xb9\xde\xdd\xc3\xdd\xc6\xb2\xc4\xde\xb3"                     // "Auto home"
47 47
 #define MSG_LEVEL_BED_HOMING                "\xb9\xde\xdd\xc3\xdd\xc6\xb2\xc4\xde\xb3"                     // "Homing XYZ"
48
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
49
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
48 50
 #define MSG_SET_HOME_OFFSETS                "\xb7\xbc\xde\xad\xdd\xb5\xcc\xbe\xaf\xc4\xbe\xaf\xc3\xb2"     // "Set home offsets"
51
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
49 52
 #define MSG_SET_ORIGIN                      "\xb7\xbc\xde\xad\xdd\xbe\xaf\xc4"                             // "Set origin"
50 53
 #define MSG_PREHEAT_PLA                     "PLA \xd6\xc8\xc2"                                             // "Preheat PLA"
51 54
 #define MSG_PREHEAT_PLA_N                   MSG_PREHEAT_PLA " "

+ 3
- 0
Marlin/language_kana_utf8.h 파일 보기

@@ -49,7 +49,10 @@
49 49
 #define MSG_DISABLE_STEPPERS                "モーターデンゲン オフ"            // "Disable steppers"
50 50
 #define MSG_AUTO_HOME                       "ゲンテンニイドウ"                // "Auto home"
51 51
 #define MSG_LEVEL_BED_HOMING                "ゲンテンニイドウ"                // "Homing XYZ"
52
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
53
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
52 54
 #define MSG_SET_HOME_OFFSETS                "キジュンオフセットセッテイ"         // "Set home offsets"
55
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
53 56
 #define MSG_SET_ORIGIN                      "キジュンセット"                 // "Set origin"
54 57
 #define MSG_PREHEAT_PLA                     "PLA ヨネツ"                   // "Preheat PLA"
55 58
 #define MSG_PREHEAT_PLA_N                   MSG_PREHEAT_PLA " "

+ 3
- 0
Marlin/language_nl.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Motoren uit"
44 44
 #define MSG_AUTO_HOME                       "Auto home"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Set home offsets"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Nulpunt instellen"
48 51
 #define MSG_PREHEAT_PLA                     "PLA voorverwarmen"
49 52
 #define MSG_PREHEAT_PLA_N                   "PLA voorverw. "

+ 3
- 0
Marlin/language_pl.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Wylacz silniki"
44 44
 #define MSG_AUTO_HOME                       "Auto. poz. zerowa"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Set home offsets"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Ustaw punkt zero"
48 51
 #define MSG_PREHEAT_PLA                     "Rozgrzej PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Rozgrzej PLA "

+ 3
- 0
Marlin/language_pt-br.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Desabi. motores"
44 44
 #define MSG_AUTO_HOME                       "Ir para origen"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Ajustar Jogo"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Ajustar orig."
48 51
 #define MSG_PREHEAT_PLA                     "Pre-aquecer PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Pre-aquecer PLA"

+ 3
- 0
Marlin/language_pt-br_utf8.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Desabi. motores"
44 44
 #define MSG_AUTO_HOME                       "Ir para origen"
45 45
 #define MSG_LEVEL_BED_HOMING                "Indo para origem"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Ajustar Jogo"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Ajustar orig."
48 51
 #define MSG_PREHEAT_PLA                     "Pre-aquecer PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Pre-aquecer PLA"

+ 3
- 0
Marlin/language_pt.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Desactivar motores"
44 44
 #define MSG_AUTO_HOME                       "Ir para origem"
45 45
 #define MSG_LEVEL_BED_HOMING                "Indo para origem"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Definir desvio"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Definir origem"
48 51
 #define MSG_PREHEAT_PLA                     "Pre-aquecer PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Pre-aquecer PLA"

+ 3
- 0
Marlin/language_pt_utf8.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Desactivar motores"
44 44
 #define MSG_AUTO_HOME                       "Ir para origem"
45 45
 #define MSG_LEVEL_BED_HOMING                "Indo para origem"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Definir desvio"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Definir origem"
48 51
 #define MSG_PREHEAT_PLA                     "Pre-aquecer PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Pre-aquecer PLA"

+ 3
- 0
Marlin/language_ru.h 파일 보기

@@ -43,7 +43,10 @@
43 43
 #define MSG_DISABLE_STEPPERS                "Выкл. двигатели"
44 44
 #define MSG_AUTO_HOME                       "Парковка"
45 45
 #define MSG_LEVEL_BED_HOMING                "Homing XYZ"
46
+#define MSG_LEVEL_BED_WAITING               "Click to Begin"
47
+#define MSG_LEVEL_BED_DONE                  "Leveling Done!"
46 48
 #define MSG_SET_HOME_OFFSETS                "Запомнить парковку"
49
+#define MSG_HOME_OFFSETS_APPLIED            "Offsets applied"
47 50
 #define MSG_SET_ORIGIN                      "Запомнить ноль"
48 51
 #define MSG_PREHEAT_PLA                     "Преднагрев PLA"
49 52
 #define MSG_PREHEAT_PLA_N                   "Греть PLA Сопло "

+ 129
- 42
Marlin/ultralcd.cpp 파일 보기

@@ -252,7 +252,7 @@ static void lcd_status_screen();
252 252
   #endif //!ENCODER_RATE_MULTIPLIER
253 253
   #define END_MENU() \
254 254
       if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * (ENCODER_STEPS_PER_MENU_ITEM) - 1; encoderLine = _menuItemNr - 1; }\
255
-      if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - (LCD_HEIGHT) + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
255
+      if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - (LCD_HEIGHT) + 1; lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
256 256
       } } while(0)
257 257
 
258 258
   /** Used variables to keep track of the menu */
@@ -280,7 +280,15 @@ uint8_t lcd_status_update_delay;
280 280
 bool ignore_click = false;
281 281
 bool wait_for_unclick;
282 282
 bool defer_return_to_status = false;
283
-uint8_t lcdDrawUpdate = 2;                  /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) */
283
+
284
+enum LCDHandlerAction {
285
+  LCD_DRAW_UPDATE_NONE,
286
+  LCD_DRAW_UPDATE_CALL_REDRAW,
287
+  LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW,
288
+  LCD_DRAW_UPDATE_CALL_NO_REDRAW,
289
+};
290
+
291
+uint8_t lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW; // Set 1 or 2 when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
284 292
 
285 293
 // Variables used when editing values.
286 294
 const char* editLabel;
@@ -298,7 +306,7 @@ float raw_Ki, raw_Kd;
298 306
 static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const uint32_t encoder = 0) {
299 307
   if (currentMenu != menu) {
300 308
     currentMenu = menu;
301
-    lcdDrawUpdate = 2;
309
+    lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW;
302 310
     #if ENABLED(NEWPANEL)
303 311
       encoderPosition = encoder;
304 312
       if (feedback) lcd_quick_feedback();
@@ -524,7 +532,7 @@ void lcd_set_home_offsets() {
524 532
     if (encoderPosition != 0) {
525 533
       int distance =  (int)encoderPosition * BABYSTEP_MULTIPLICATOR;
526 534
       encoderPosition = 0;
527
-      lcdDrawUpdate = 1;
535
+      lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
528 536
       #if ENABLED(COREXY) || ENABLED(COREXZ)
529 537
         #if ENABLED(BABYSTEP_XY)
530 538
           switch(axis) {
@@ -948,7 +956,7 @@ static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
948 956
     if (max_software_endstops) NOMORE(current_position[axis], max);
949 957
     encoderPosition = 0;
950 958
     line_to_current(axis);
951
-    lcdDrawUpdate = 1;
959
+    lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
952 960
   }
953 961
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
954 962
   if (LCD_CLICKED) lcd_goto_previous_menu();
@@ -977,7 +985,7 @@ static void lcd_move_e(
977 985
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
978 986
     encoderPosition = 0;
979 987
     line_to_current(E_AXIS);
980
-    lcdDrawUpdate = 1;
988
+    lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
981 989
   }
982 990
   if (lcdDrawUpdate) {
983 991
     PGM_P pos_label;
@@ -1449,7 +1457,7 @@ static void lcd_control_volumetric_menu() {
1449 1457
         lcd_contrast &= 0x3F;
1450 1458
       #endif
1451 1459
       encoderPosition = 0;
1452
-      lcdDrawUpdate = 1;
1460
+      lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
1453 1461
       u8g.setContrast(lcd_contrast);
1454 1462
     }
1455 1463
     if (lcdDrawUpdate) {
@@ -1590,7 +1598,7 @@ static void lcd_control_volumetric_menu() {
1590 1598
   static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
1591 1599
     lcd_save_previous_menu(); \
1592 1600
     \
1593
-    lcdDrawUpdate = 2; \
1601
+    lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW; \
1594 1602
     currentMenu = menu_edit_ ## _name; \
1595 1603
     \
1596 1604
     editLabel = pstr; \
@@ -1672,7 +1680,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
1672 1680
 #endif
1673 1681
 
1674 1682
 void lcd_quick_feedback() {
1675
-  lcdDrawUpdate = 2;
1683
+  lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW;
1676 1684
   next_button_update_ms = millis() + 500;
1677 1685
 
1678 1686
   #if ENABLED(LCD_USE_I2C_BUZZER)
@@ -1837,11 +1845,27 @@ bool lcd_blink() {
1837 1845
  *   - Act on RepRap World keypad input
1838 1846
  *   - Update the encoder position
1839 1847
  *   - Apply acceleration to the encoder position
1848
+ *   - Set lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW on controller events
1840 1849
  *   - Reset the Info Screen timeout if there's any input
1841 1850
  *   - Update status indicators, if any
1842
- *   - Clear the LCD if lcdDrawUpdate == 2
1843 1851
  *
1844
- * Warning: This function is called from interrupt context!
1852
+ *   Run the current LCD menu handler callback function:
1853
+ *   - Call the handler only if lcdDrawUpdate != LCD_DRAW_UPDATE_NONE
1854
+ *   - Before calling the handler, LCD_DRAW_UPDATE_CALL_NO_REDRAW => LCD_DRAW_UPDATE_NONE
1855
+ *   - Call the menu handler. Menu handlers should do the following:
1856
+ *     - If a value changes, set lcdDrawUpdate to LCD_DRAW_UPDATE_CALL_REDRAW
1857
+ *     - if (lcdDrawUpdate) { redraw }
1858
+ *     - Before exiting the handler set lcdDrawUpdate to:
1859
+ *       - LCD_DRAW_UPDATE_CALL_REDRAW or LCD_DRAW_UPDATE_NONE for no callbacks until the next controller event.
1860
+ *       - LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW to clear screen, LCD_DRAW_UPDATE_CALL_REDRAW on the next loop.
1861
+ *       - LCD_DRAW_UPDATE_CALL_NO_REDRAW for a callback with no forced redraw on the next loop.
1862
+ *     - NOTE: For some displays, the menu handler may be called 2 or more times per loop.
1863
+ *
1864
+ *   After the menu handler callback runs (or not):
1865
+ *   - Clear the LCD if lcdDrawUpdate == LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW
1866
+ *   - Update lcdDrawUpdate for the next loop (i.e., move one state down, usually)
1867
+ *
1868
+ * No worries. This function is only called from the main thread.
1845 1869
  */
1846 1870
 void lcd_update() {
1847 1871
   #if ENABLED(ULTIPANEL)
@@ -1854,7 +1878,7 @@ void lcd_update() {
1854 1878
 
1855 1879
     bool sd_status = IS_SD_INSERTED;
1856 1880
     if (sd_status != lcd_sd_status && lcd_detected()) {
1857
-      lcdDrawUpdate = 2;
1881
+      lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW;
1858 1882
       lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
1859 1883
         #if ENABLED(LCD_PROGRESS_BAR)
1860 1884
           currentMenu == lcd_status_screen
@@ -1933,13 +1957,13 @@ void lcd_update() {
1933 1957
           encoderDiff = 0;
1934 1958
         }
1935 1959
         return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
1936
-        lcdDrawUpdate = 1;
1960
+        lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
1937 1961
       }
1938 1962
     #endif //ULTIPANEL
1939 1963
 
1940 1964
     if (currentMenu == lcd_status_screen) {
1941 1965
       if (!lcd_status_update_delay) {
1942
-        lcdDrawUpdate = 1;
1966
+        lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
1943 1967
         lcd_status_update_delay = 10;   /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
1944 1968
       }
1945 1969
       else {
@@ -1948,6 +1972,9 @@ void lcd_update() {
1948 1972
     }
1949 1973
 
1950 1974
     if (lcdDrawUpdate) {
1975
+
1976
+      if (lcdDrawUpdate == LCD_DRAW_UPDATE_CALL_NO_REDRAW) lcdDrawUpdate = LCD_DRAW_UPDATE_NONE;
1977
+
1951 1978
       #if ENABLED(DOGLCD)  // Changes due to different driver architecture of the DOGM display
1952 1979
         bool blink = lcd_blink();
1953 1980
         u8g.firstPage();
@@ -1971,14 +1998,29 @@ void lcd_update() {
1971 1998
     #if ENABLED(ULTIPANEL)
1972 1999
 
1973 2000
       // Return to Status Screen after a timeout
1974
-      if (!defer_return_to_status && currentMenu != lcd_status_screen && millis() > return_to_status_ms) {
2001
+      if (defer_return_to_status)
2002
+        return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
2003
+      else if (currentMenu != lcd_status_screen && millis() > return_to_status_ms) {
1975 2004
         lcd_return_to_status();
1976
-        lcdDrawUpdate = 2;
1977 2005
       }
1978 2006
 
1979 2007
     #endif // ULTIPANEL
1980 2008
 
1981
-    if (lcdDrawUpdate && --lcdDrawUpdate) lcd_implementation_clear();
2009
+    switch (lcdDrawUpdate) {
2010
+      case LCD_DRAW_UPDATE_NONE:
2011
+        // do nothing
2012
+      case LCD_DRAW_UPDATE_CALL_NO_REDRAW:
2013
+        // changes to LCD_DRAW_UPDATE_NONE before call
2014
+        break;
2015
+      case LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW:
2016
+        lcd_implementation_clear();
2017
+        lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
2018
+        break;
2019
+      case LCD_DRAW_UPDATE_CALL_REDRAW:
2020
+        lcdDrawUpdate = LCD_DRAW_UPDATE_NONE;
2021
+        break;
2022
+    }
2023
+
1982 2024
     next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
1983 2025
   }
1984 2026
 }
@@ -1995,7 +2037,7 @@ void lcd_finishstatus(bool persist=false) {
1995 2037
       expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
1996 2038
     #endif
1997 2039
   #endif
1998
-  lcdDrawUpdate = 2;
2040
+  lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW;
1999 2041
 
2000 2042
   #if ENABLED(FILAMENT_LCD_DISPLAY)
2001 2043
     previous_lcd_status_ms = millis();  //get status message to show up for a while
@@ -2223,13 +2265,13 @@ char *ftostr32(const float& x) {
2223 2265
   return conv;
2224 2266
 }
2225 2267
 
2226
-// Convert signed float to string (len 5 or 6) with 1.234 / -1.234 format
2227
-char* ftostr43(const float& x) {
2268
+// Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
2269
+char* ftostr43(const float& x, char plus/*=' '*/) {
2228 2270
   long xx = x * 1000;
2229
-  char *conv_ptr = conv;
2230
-  if (xx >= 0) {
2231
-    conv_ptr++;
2232
-  }
2271
+  if (xx == 0)
2272
+    conv[0] = ' ';
2273
+  else if (xx > 0)
2274
+    conv[0] = plus;
2233 2275
   else {
2234 2276
     xx = -xx;
2235 2277
     conv[0] = '-';
@@ -2240,7 +2282,7 @@ char* ftostr43(const float& x) {
2240 2282
   conv[4] = (xx / 10) % 10 + '0';
2241 2283
   conv[5] = (xx) % 10 + '0';
2242 2284
   conv[6] = 0;
2243
-  return conv_ptr;
2285
+  return conv;
2244 2286
 }
2245 2287
 
2246 2288
 // Convert unsigned float to string with 1.23 format
@@ -2440,25 +2482,44 @@ char* ftostr52(const float& x) {
2440 2482
    *   - Movement adjusts the Z axis
2441 2483
    *   - Click saves the Z and goes to the next mesh point
2442 2484
    */
2443
-  static void _lcd_level_bed() {
2485
+  static void _lcd_level_bed_procedure() {
2486
+    static bool mbl_wait_for_move = false;
2487
+    // Menu handlers may be called in a re-entrant fashion
2488
+    // if they call st_synchronize or plan_buffer_line. So
2489
+    // while waiting for a move we just ignore new input.
2490
+    if (mbl_wait_for_move) {
2491
+      lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
2492
+      return;
2493
+    }
2494
+
2444 2495
     ENCODER_DIRECTION_NORMAL();
2445
-    if ((encoderPosition != 0) && (movesplanned() <= 3)) {
2496
+
2497
+    // Encoder wheel adjusts the Z position
2498
+    if (encoderPosition != 0 && movesplanned() <= 3) {
2446 2499
       refresh_cmd_timeout();
2447 2500
       current_position[Z_AXIS] += float((int)encoderPosition) * (MBL_Z_STEP);
2448 2501
       if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
2449 2502
       if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
2450 2503
       encoderPosition = 0;
2451 2504
       line_to_current(Z_AXIS);
2452
-      lcdDrawUpdate = 1;
2505
+      lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
2453 2506
     }
2507
+
2508
+    // Update on first display, then only on updates to Z position
2454 2509
     if (lcdDrawUpdate) {
2455 2510
       float v = current_position[Z_AXIS] - MESH_HOME_SEARCH_Z;
2456
-      lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43(v + (v < 0 ? -0.0001 : 0.0001)));
2511
+      lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43(v + (v < 0 ? -0.0001 : 0.0001), '+'));
2457 2512
     }
2513
+
2514
+    // We want subsequent calls, but don't force redraw
2515
+    // Set here so it can be overridden by lcd_return_to_status below
2516
+    lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
2517
+
2518
+    // Click sets the current Z and moves to the next position
2458 2519
     static bool debounce_click = false;
2459 2520
     if (LCD_CLICKED) {
2460 2521
       if (!debounce_click) {
2461
-        debounce_click = true;
2522
+        debounce_click = true; // ignore multiple "clicks" in a row
2462 2523
         int ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS),
2463 2524
             iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
2464 2525
         if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
@@ -2466,11 +2527,21 @@ char* ftostr52(const float& x) {
2466 2527
         _lcd_level_bed_position++;
2467 2528
         if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
2468 2529
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
2530
+          mbl_wait_for_move = true;
2469 2531
           line_to_current(Z_AXIS);
2470 2532
           st_synchronize();
2471 2533
           mbl.active = 1;
2472 2534
           enqueue_and_echo_commands_P(PSTR("G28"));
2535
+          mbl_wait_for_move = false;
2473 2536
           lcd_return_to_status();
2537
+          #if ENABLED(NEWPANEL)
2538
+            lcd_quick_feedback();
2539
+          #endif
2540
+          LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
2541
+          #if HAS_BUZZER
2542
+            buzz(200, 659);
2543
+            buzz(200, 698);
2544
+          #endif
2474 2545
         }
2475 2546
         else {
2476 2547
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
@@ -2481,7 +2552,6 @@ char* ftostr52(const float& x) {
2481 2552
           current_position[X_AXIS] = mbl.get_x(ix);
2482 2553
           current_position[Y_AXIS] = mbl.get_y(iy);
2483 2554
           line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
2484
-          lcdDrawUpdate = 1;
2485 2555
         }
2486 2556
       }
2487 2557
     }
@@ -2490,32 +2560,49 @@ char* ftostr52(const float& x) {
2490 2560
     }
2491 2561
   }
2492 2562
 
2493
-  /**
2494
-   * MBL Move to mesh starting point
2495
-   */
2496
-  static void _lcd_level_bed_homing() {
2497
-    if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
2498
-    lcdDrawUpdate = 1;
2499
-    if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]) {
2563
+  static void _lcd_level_bed_homing_done() {
2564
+    if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING), NULL);
2565
+    lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
2566
+    if (LCD_CLICKED) {
2500 2567
       current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
2501 2568
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
2502 2569
       current_position[X_AXIS] = MESH_MIN_X;
2503 2570
       current_position[Y_AXIS] = MESH_MIN_Y;
2504 2571
       line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
2505 2572
       _lcd_level_bed_position = 0;
2506
-      lcd_goto_menu(_lcd_level_bed);
2573
+      lcd_goto_menu(_lcd_level_bed_procedure, true);
2507 2574
     }
2508 2575
   }
2509 2576
 
2510 2577
   /**
2511
-   * MBL entry-point
2578
+   * MBL Move to mesh starting point
2512 2579
    */
2513
-  static void lcd_level_bed() {
2580
+  static void _lcd_level_bed_homing() {
2581
+    if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
2582
+    lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
2583
+    if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])
2584
+      lcd_goto_menu(_lcd_level_bed_homing_done);
2585
+  }
2586
+
2587
+  /**
2588
+   * MBL Continue Bed Leveling...
2589
+   */
2590
+  static void _lcd_level_bed_continue() {
2514 2591
     defer_return_to_status = true;
2515 2592
     axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
2516 2593
     mbl.reset();
2517 2594
     enqueue_and_echo_commands_P(PSTR("G28"));
2518
-    lcd_goto_menu(_lcd_level_bed_homing);
2595
+    lcd_goto_menu(_lcd_level_bed_homing, true);
2596
+  }
2597
+
2598
+  /**
2599
+   * MBL entry-point
2600
+   */
2601
+  static void lcd_level_bed() {
2602
+    START_MENU();
2603
+    MENU_ITEM(back, "Cancel", lcd_prepare_menu);
2604
+    MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
2605
+    END_MENU();
2519 2606
   }
2520 2607
 
2521 2608
 #endif  // MANUAL_BED_LEVELING

+ 1
- 1
Marlin/ultralcd.h 파일 보기

@@ -156,7 +156,7 @@ char* ftostr4sign(const float& x);
156 156
 char* ftostr31ns(const float& x); // float to string without sign character
157 157
 char* ftostr31(const float& x);
158 158
 char* ftostr32(const float& x);
159
-char* ftostr43(const float& x);
159
+char* ftostr43(const float& x, char plus=' ');
160 160
 char* ftostr12ns(const float& x);
161 161
 char* ftostr32sp(const float& x); // remove zero-padding from ftostr32
162 162
 char* ftostr5(const float& x);

Loading…
취소
저장