|
@@ -262,7 +262,7 @@ static void lcd_status_screen();
|
262
|
262
|
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
|
263
|
263
|
millis_t next_button_update_ms;
|
264
|
264
|
uint8_t lastEncoderBits;
|
265
|
|
- uint32_t encoderPosition;
|
|
265
|
+ uint32_t encoderPosition, nextEncoderPosition;
|
266
|
266
|
#if PIN_EXISTS(SD_DETECT)
|
267
|
267
|
uint8_t lcd_sd_status;
|
268
|
268
|
#endif
|
|
@@ -277,6 +277,7 @@ typedef struct {
|
277
|
277
|
} menuPosition;
|
278
|
278
|
|
279
|
279
|
menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active menu handler
|
|
280
|
+menuFunc_t nextMenu = NULL; // the next menu handler to activate
|
280
|
281
|
|
281
|
282
|
menuPosition menu_history[10];
|
282
|
283
|
uint8_t menu_history_depth = 0;
|
|
@@ -311,21 +312,16 @@ float raw_Ki, raw_Kd;
|
311
|
312
|
* Remembers the previous position
|
312
|
313
|
*/
|
313
|
314
|
static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const uint32_t encoder = 0) {
|
314
|
|
- if (currentMenu != menu) {
|
315
|
|
- currentMenu = menu;
|
316
|
|
- lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
|
315
|
+ if (currentMenu != menu && nextMenu != menu) {
|
|
316
|
+ nextMenu = menu;
|
|
317
|
+ nextEncoderPosition = encoder;
|
317
|
318
|
#if ENABLED(NEWPANEL)
|
318
|
|
- encoderPosition = encoder;
|
319
|
319
|
if (feedback) lcd_quick_feedback();
|
320
|
320
|
#endif
|
321
|
321
|
if (menu == lcd_status_screen) {
|
322
|
322
|
defer_return_to_status = false;
|
323
|
323
|
menu_history_depth = 0;
|
324
|
324
|
}
|
325
|
|
- #if ENABLED(LCD_PROGRESS_BAR)
|
326
|
|
- // For LCD_PROGRESS_BAR re-initialize custom characters
|
327
|
|
- lcd_set_custom_characters(menu == lcd_status_screen);
|
328
|
|
- #endif
|
329
|
325
|
}
|
330
|
326
|
}
|
331
|
327
|
|
|
@@ -891,15 +887,13 @@ void lcd_cooldown() {
|
891
|
887
|
*
|
892
|
888
|
*/
|
893
|
889
|
|
894
|
|
- static int _lcd_level_bed_position;
|
895
|
|
- static bool mbl_wait_for_move = false;
|
|
890
|
+ static uint8_t _lcd_level_bed_position;
|
896
|
891
|
|
897
|
892
|
// Utility to go to the next mesh point
|
898
|
893
|
// A raise is added between points if MIN_Z_HEIGHT_FOR_HOMING is in use
|
899
|
894
|
// Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
|
900
|
895
|
// Z position will be restored with the final action, a G28
|
901
|
896
|
inline void _mbl_goto_xy(float x, float y) {
|
902
|
|
- mbl_wait_for_move = true;
|
903
|
897
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
|
904
|
898
|
#if MIN_Z_HEIGHT_FOR_HOMING > 0
|
905
|
899
|
+ MIN_Z_HEIGHT_FOR_HOMING
|
|
@@ -914,59 +908,38 @@ void lcd_cooldown() {
|
914
|
908
|
line_to_current(Z_AXIS);
|
915
|
909
|
#endif
|
916
|
910
|
st_synchronize();
|
917
|
|
- mbl_wait_for_move = false;
|
|
911
|
+ }
|
|
912
|
+
|
|
913
|
+ static void _lcd_level_goto_next_point();
|
|
914
|
+
|
|
915
|
+ static void _lcd_level_bed_done() {
|
|
916
|
+ if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
|
918
|
917
|
}
|
919
|
918
|
|
920
|
919
|
/**
|
921
|
|
- * 5. MBL Wait for controller movement and clicks:
|
922
|
|
- * - Movement adjusts the Z axis
|
923
|
|
- * - Click saves the Z, goes to the next mesh point
|
|
920
|
+ * Step 7: Get the Z coordinate, then goto next point or exit
|
924
|
921
|
*/
|
925
|
|
- static void _lcd_level_bed_procedure() {
|
926
|
|
- // Menu handlers may be called in a re-entrant fashion
|
927
|
|
- // if they call st_synchronize or plan_buffer_line. So
|
928
|
|
- // while waiting for a move we just ignore new input.
|
929
|
|
- if (mbl_wait_for_move) {
|
930
|
|
- lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
931
|
|
- return;
|
932
|
|
- }
|
933
|
|
-
|
|
922
|
+ static void _lcd_level_bed_get_z() {
|
934
|
923
|
ENCODER_DIRECTION_NORMAL();
|
935
|
924
|
|
936
|
925
|
// Encoder wheel adjusts the Z position
|
937
|
926
|
if (encoderPosition && movesplanned() <= 3) {
|
938
|
927
|
refresh_cmd_timeout();
|
939
|
928
|
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
|
940
|
|
- if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
|
941
|
|
- if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
|
942
|
|
- encoderPosition = 0;
|
|
929
|
+ NOLESS(current_position[Z_AXIS], 0);
|
|
930
|
+ NOMORE(current_position[Z_AXIS], MESH_HOME_SEARCH_Z * 2);
|
943
|
931
|
line_to_current(Z_AXIS);
|
944
|
|
- lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
945
|
932
|
}
|
|
933
|
+ encoderPosition = 0;
|
946
|
934
|
|
947
|
|
- // Update on first display, then only on updates to Z position
|
948
|
|
- if (lcdDrawUpdate) {
|
949
|
|
- float v = current_position[Z_AXIS] - MESH_HOME_SEARCH_Z;
|
950
|
|
- lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43(v + (v < 0 ? -0.0001 : 0.0001), '+'));
|
951
|
|
- }
|
952
|
|
-
|
953
|
|
- // We want subsequent calls, but don't force redraw
|
954
|
|
- // Set here so it can be overridden by lcd_return_to_status below
|
955
|
|
- lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
956
|
|
-
|
957
|
|
- // Click sets the current Z and moves to the next position
|
958
|
935
|
static bool debounce_click = false;
|
959
|
936
|
if (LCD_CLICKED) {
|
960
|
937
|
if (!debounce_click) {
|
961
|
938
|
debounce_click = true; // ignore multiple "clicks" in a row
|
962
|
939
|
mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]);
|
963
|
940
|
if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
|
964
|
|
- lcd_return_to_status();
|
965
|
|
- LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
|
966
|
|
- #if HAS_BUZZER
|
967
|
|
- buzz(200, 659);
|
968
|
|
- buzz(200, 698);
|
969
|
|
- #endif
|
|
941
|
+ lcd_goto_menu(_lcd_level_bed_done, true);
|
|
942
|
+
|
970
|
943
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
|
971
|
944
|
#if MIN_Z_HEIGHT_FOR_HOMING > 0
|
972
|
945
|
+ MIN_Z_HEIGHT_FOR_HOMING
|
|
@@ -974,65 +947,98 @@ void lcd_cooldown() {
|
974
|
947
|
;
|
975
|
948
|
line_to_current(Z_AXIS);
|
976
|
949
|
st_synchronize();
|
|
950
|
+
|
977
|
951
|
mbl.active = true;
|
978
|
952
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
953
|
+ lcd_return_to_status();
|
|
954
|
+ //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
|
|
955
|
+ #if HAS_BUZZER
|
|
956
|
+ buzz(200, 659);
|
|
957
|
+ buzz(200, 698);
|
|
958
|
+ #endif
|
979
|
959
|
}
|
980
|
960
|
else {
|
981
|
|
- #if ENABLED(NEWPANEL)
|
982
|
|
- lcd_quick_feedback();
|
983
|
|
- #endif
|
984
|
|
- int ix, iy;
|
985
|
|
- mbl.zigzag(_lcd_level_bed_position, ix, iy);
|
986
|
|
- _mbl_goto_xy(mbl.get_x(ix), mbl.get_y(iy));
|
987
|
|
- encoderPosition = 0;
|
|
961
|
+ lcd_goto_menu(_lcd_level_goto_next_point, true);
|
988
|
962
|
}
|
989
|
963
|
}
|
990
|
964
|
}
|
991
|
965
|
else {
|
992
|
966
|
debounce_click = false;
|
993
|
967
|
}
|
|
968
|
+
|
|
969
|
+ // Update on first display, then only on updates to Z position
|
|
970
|
+ // Show message above on clicks instead
|
|
971
|
+ if (lcdDrawUpdate) {
|
|
972
|
+ float v = current_position[Z_AXIS] - MESH_HOME_SEARCH_Z;
|
|
973
|
+ lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43(v + (v < 0 ? -0.0001 : 0.0001), '+'));
|
|
974
|
+ }
|
|
975
|
+
|
994
|
976
|
}
|
995
|
977
|
|
996
|
978
|
/**
|
997
|
|
- * 4. MBL Display "Click to Begin", wait for click
|
998
|
|
- * Move to the first probe position
|
|
979
|
+ * Step 6: Display "Next point: 1 / 9" while waiting for move to finish
|
|
980
|
+ */
|
|
981
|
+ static void _lcd_level_bed_moving() {
|
|
982
|
+ if (lcdDrawUpdate) {
|
|
983
|
+ char msg[10];
|
|
984
|
+ sprintf_P(msg, PSTR("%i / %u"), (int)(_lcd_level_bed_position + 1), (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS));
|
|
985
|
+ lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
|
|
986
|
+ }
|
|
987
|
+ }
|
|
988
|
+
|
|
989
|
+ /**
|
|
990
|
+ * Step 5: Initiate a move to the next point
|
|
991
|
+ */
|
|
992
|
+ static void _lcd_level_goto_next_point() {
|
|
993
|
+ // Set the menu to display ahead of blocking call
|
|
994
|
+ lcd_goto_menu(_lcd_level_bed_moving);
|
|
995
|
+
|
|
996
|
+ // _mbl_goto_xy runs the menu loop until the move is done
|
|
997
|
+ int ix, iy;
|
|
998
|
+ mbl.zigzag(_lcd_level_bed_position, ix, iy);
|
|
999
|
+ _mbl_goto_xy(mbl.get_x(ix), mbl.get_y(iy));
|
|
1000
|
+
|
|
1001
|
+ // After the blocking function returns, change menus
|
|
1002
|
+ lcd_goto_menu(_lcd_level_bed_get_z);
|
|
1003
|
+ }
|
|
1004
|
+
|
|
1005
|
+ /**
|
|
1006
|
+ * Step 4: Display "Click to Begin", wait for click
|
|
1007
|
+ * Move to the first probe position
|
999
|
1008
|
*/
|
1000
|
1009
|
static void _lcd_level_bed_homing_done() {
|
1001
|
|
- if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING), NULL);
|
1002
|
|
- lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
1003
|
|
- if (mbl_wait_for_move) return;
|
|
1010
|
+ if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
|
1004
|
1011
|
if (LCD_CLICKED) {
|
|
1012
|
+ _lcd_level_bed_position = 0;
|
1005
|
1013
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
1006
|
1014
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1007
|
|
- _mbl_goto_xy(MESH_MIN_X, MESH_MIN_Y);
|
1008
|
|
- _lcd_level_bed_position = 0;
|
1009
|
|
- lcd_goto_menu(_lcd_level_bed_procedure, true);
|
|
1015
|
+ lcd_goto_menu(_lcd_level_goto_next_point, true);
|
1010
|
1016
|
}
|
1011
|
1017
|
}
|
1012
|
1018
|
|
1013
|
1019
|
/**
|
1014
|
|
- * 3. MBL Display "Hoing XYZ" - Wait for homing to finish
|
|
1020
|
+ * Step 3: Display "Homing XYZ" - Wait for homing to finish
|
1015
|
1021
|
*/
|
1016
|
1022
|
static void _lcd_level_bed_homing() {
|
1017
|
1023
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
1018
|
|
- lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
1019
|
|
- if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])
|
|
1024
|
+ if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
|
1020
|
1025
|
lcd_goto_menu(_lcd_level_bed_homing_done);
|
|
1026
|
+ lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW; // counts as a draw flag during graphical loop
|
1021
|
1027
|
}
|
1022
|
1028
|
|
1023
|
1029
|
/**
|
1024
|
|
- * 2. MBL Continue Bed Leveling...
|
|
1030
|
+ * Step 2: Continue Bed Leveling...
|
1025
|
1031
|
*/
|
1026
|
1032
|
static void _lcd_level_bed_continue() {
|
1027
|
1033
|
defer_return_to_status = true;
|
1028
|
|
- axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
|
|
1034
|
+ axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false;
|
1029
|
1035
|
mbl.reset();
|
1030
|
1036
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
1031
|
1037
|
lcd_goto_menu(_lcd_level_bed_homing);
|
1032
|
1038
|
}
|
1033
|
1039
|
|
1034
|
1040
|
/**
|
1035
|
|
- * 1. MBL entry-point: "Cancel" or "Level Bed"
|
|
1041
|
+ * Step 1: MBL entry-point: "Cancel" or "Level Bed"
|
1036
|
1042
|
*/
|
1037
|
1043
|
static void lcd_level_bed() {
|
1038
|
1044
|
START_MENU();
|
|
@@ -1072,8 +1078,9 @@ static void lcd_prepare_menu() {
|
1072
|
1078
|
// Level Bed
|
1073
|
1079
|
//
|
1074
|
1080
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
1075
|
|
- if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS])
|
1076
|
|
- MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29"));
|
|
1081
|
+ MENU_ITEM(gcode, MSG_LEVEL_BED,
|
|
1082
|
+ axis_homed[X_AXIS] && axis_homed[Y_AXIS] ? PSTR("G29") : PSTR("G28\nG29")
|
|
1083
|
+ );
|
1077
|
1084
|
#elif ENABLED(MANUAL_BED_LEVELING)
|
1078
|
1085
|
MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
|
1079
|
1086
|
#endif
|
|
@@ -1157,10 +1164,9 @@ static void _lcd_move(const char* name, AxisEnum axis, float min, float max) {
|
1157
|
1164
|
current_position[axis] += float((int32_t)encoderPosition) * move_menu_scale;
|
1158
|
1165
|
if (min_software_endstops) NOLESS(current_position[axis], min);
|
1159
|
1166
|
if (max_software_endstops) NOMORE(current_position[axis], max);
|
1160
|
|
- encoderPosition = 0;
|
1161
|
1167
|
line_to_current(axis);
|
1162
|
|
- lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
1163
|
1168
|
}
|
|
1169
|
+ encoderPosition = 0;
|
1164
|
1170
|
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
|
1165
|
1171
|
if (LCD_CLICKED) lcd_goto_previous_menu(true);
|
1166
|
1172
|
}
|
|
@@ -1186,10 +1192,9 @@ static void lcd_move_e(
|
1186
|
1192
|
#endif
|
1187
|
1193
|
if (encoderPosition && movesplanned() <= 3) {
|
1188
|
1194
|
current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
|
1189
|
|
- encoderPosition = 0;
|
1190
|
1195
|
line_to_current(E_AXIS);
|
1191
|
|
- lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
1192
|
1196
|
}
|
|
1197
|
+ encoderPosition = 0;
|
1193
|
1198
|
if (lcdDrawUpdate) {
|
1194
|
1199
|
PGM_P pos_label;
|
1195
|
1200
|
#if EXTRUDERS == 1
|
|
@@ -1342,7 +1347,7 @@ static void lcd_control_menu() {
|
1342
|
1347
|
|
1343
|
1348
|
static void _lcd_autotune(int e) {
|
1344
|
1349
|
char cmd[30];
|
1345
|
|
- sprintf_P(cmd, PSTR("M303 U1 E%d S%d"), e,
|
|
1350
|
+ sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), e,
|
1346
|
1351
|
#if HAS_PID_FOR_BOTH
|
1347
|
1352
|
e < 0 ? autotune_temp_bed : autotune_temp[e]
|
1348
|
1353
|
#elif ENABLED(PIDTEMPBED)
|
|
@@ -1678,7 +1683,6 @@ static void lcd_control_volumetric_menu() {
|
1678
|
1683
|
lcd_contrast &= 0x3F;
|
1679
|
1684
|
#endif
|
1680
|
1685
|
encoderPosition = 0;
|
1681
|
|
- lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
1682
|
1686
|
u8g.setContrast(lcd_contrast);
|
1683
|
1687
|
}
|
1684
|
1688
|
if (lcdDrawUpdate) {
|
|
@@ -1829,12 +1833,12 @@ static void lcd_control_volumetric_menu() {
|
1829
|
1833
|
} \
|
1830
|
1834
|
static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
|
1831
|
1835
|
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
1832
|
|
- currentMenu = menu_edit_ ## _name; \
|
|
1836
|
+ lcd_goto_menu(menu_edit_ ## _name); \
|
1833
|
1837
|
}\
|
1834
|
1838
|
static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, menuFunc_t callback) { \
|
1835
|
1839
|
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
1836
|
|
- currentMenu = menu_edit_callback_ ## _name; \
|
1837
|
1840
|
callbackFunc = callback; \
|
|
1841
|
+ lcd_goto_menu(menu_edit_callback_ ## _name); \
|
1838
|
1842
|
}
|
1839
|
1843
|
menu_edit_type(int, int3, itostr3, 1);
|
1840
|
1844
|
menu_edit_type(float, float3, ftostr3, 1);
|
|
@@ -1900,7 +1904,6 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01);
|
1900
|
1904
|
#endif
|
1901
|
1905
|
|
1902
|
1906
|
void lcd_quick_feedback() {
|
1903
|
|
- lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
1904
|
1907
|
next_button_update_ms = millis() + 500;
|
1905
|
1908
|
|
1906
|
1909
|
#if ENABLED(LCD_USE_I2C_BUZZER)
|
|
@@ -2067,7 +2070,7 @@ bool lcd_blink() {
|
2067
|
2070
|
* - Act on RepRap World keypad input
|
2068
|
2071
|
* - Update the encoder position
|
2069
|
2072
|
* - Apply acceleration to the encoder position
|
2070
|
|
- * - Set lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT on controller events
|
|
2073
|
+ * - Set lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NOW on controller events
|
2071
|
2074
|
* - Reset the Info Screen timeout if there's any input
|
2072
|
2075
|
* - Update status indicators, if any
|
2073
|
2076
|
*
|
|
@@ -2075,17 +2078,21 @@ bool lcd_blink() {
|
2075
|
2078
|
* - Call the handler only if lcdDrawUpdate != LCDVIEW_NONE
|
2076
|
2079
|
* - Before calling the handler, LCDVIEW_CALL_NO_REDRAW => LCDVIEW_NONE
|
2077
|
2080
|
* - Call the menu handler. Menu handlers should do the following:
|
2078
|
|
- * - If a value changes, set lcdDrawUpdate to LCDVIEW_REDRAW_NOW
|
|
2081
|
+ * - If a value changes, set lcdDrawUpdate to LCDVIEW_REDRAW_NOW and draw the value
|
|
2082
|
+ * (Encoder events automatically set lcdDrawUpdate for you.)
|
2079
|
2083
|
* - if (lcdDrawUpdate) { redraw }
|
2080
|
2084
|
* - Before exiting the handler set lcdDrawUpdate to:
|
2081
|
|
- * - LCDVIEW_REDRAW_NOW or LCDVIEW_NONE for no callbacks until the next controller event.
|
2082
|
2085
|
* - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT.
|
2083
|
|
- * - LCDVIEW_CALL_NO_REDRAW for a callback with no forced redraw on the next loop.
|
2084
|
|
- * - NOTE: For some displays, the menu handler may be called 2 or more times per loop.
|
|
2086
|
+ * - LCDVIEW_REDRAW_NOW or LCDVIEW_NONE to keep drawingm but only in this loop.
|
|
2087
|
+ * - LCDVIEW_REDRAW_NEXT to keep drawing and draw on the next loop also.
|
|
2088
|
+ * - LCDVIEW_CALL_NO_REDRAW to keep drawing (or start drawing) with no redraw on the next loop.
|
|
2089
|
+ * - NOTE: For graphical displays menu handlers may be called 2 or more times per loop,
|
|
2090
|
+ * so don't change lcdDrawUpdate without considering this.
|
2085
|
2091
|
*
|
2086
|
2092
|
* After the menu handler callback runs (or not):
|
|
2093
|
+ * - Set lcdDrawUpdate to nextLcdDrawUpdate (usually unchanged)
|
2087
|
2094
|
* - Clear the LCD if lcdDrawUpdate == LCDVIEW_CLEAR_CALL_REDRAW
|
2088
|
|
- * - Update lcdDrawUpdate for the next loop (i.e., move one state down, usually)
|
|
2095
|
+ * - Transition lcdDrawUpdate to the next state
|
2089
|
2096
|
*
|
2090
|
2097
|
* No worries. This function is only called from the main thread.
|
2091
|
2098
|
*/
|
|
@@ -2217,12 +2224,13 @@ void lcd_update() {
|
2217
|
2224
|
}
|
2218
|
2225
|
|
2219
|
2226
|
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
|
2220
|
|
- bool blink = lcd_blink();
|
|
2227
|
+ static int8_t dot_color = 0;
|
|
2228
|
+ dot_color = 1 - dot_color;
|
2221
|
2229
|
u8g.firstPage();
|
2222
|
2230
|
do {
|
2223
|
2231
|
lcd_setFont(FONT_MENU);
|
2224
|
2232
|
u8g.setPrintPos(125, 0);
|
2225
|
|
- u8g.setColorIndex(blink ? 1 : 0); // Set color for the alive dot
|
|
2233
|
+ u8g.setColorIndex(dot_color); // Set color for the alive dot
|
2226
|
2234
|
u8g.drawPixel(127, 63); // draw alive dot
|
2227
|
2235
|
u8g.setColorIndex(1); // black on white
|
2228
|
2236
|
(*currentMenu)();
|
|
@@ -2242,6 +2250,18 @@ void lcd_update() {
|
2242
|
2250
|
|
2243
|
2251
|
#endif // ULTIPANEL
|
2244
|
2252
|
|
|
2253
|
+ // If a new menu was set, update the pointer, set to clear & redraw
|
|
2254
|
+ if (nextMenu) {
|
|
2255
|
+ currentMenu = nextMenu;
|
|
2256
|
+ encoderPosition = nextEncoderPosition;
|
|
2257
|
+ nextMenu = NULL;
|
|
2258
|
+ lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
|
2259
|
+ #if ENABLED(LCD_PROGRESS_BAR)
|
|
2260
|
+ // For LCD_PROGRESS_BAR re-initialize custom characters
|
|
2261
|
+ lcd_set_custom_characters(currentMenu == lcd_status_screen);
|
|
2262
|
+ #endif
|
|
2263
|
+ }
|
|
2264
|
+
|
2245
|
2265
|
switch (lcdDrawUpdate) {
|
2246
|
2266
|
case LCDVIEW_CLEAR_CALL_REDRAW:
|
2247
|
2267
|
lcd_implementation_clear();
|