|
@@ -164,6 +164,8 @@ uint16_t max_display_update_time = 0;
|
164
|
164
|
extern bool powersupply_on;
|
165
|
165
|
#endif
|
166
|
166
|
|
|
167
|
+ bool no_reentry = false;
|
|
168
|
+
|
167
|
169
|
////////////////////////////////////////////
|
168
|
170
|
///////////////// Menu Tree ////////////////
|
169
|
171
|
////////////////////////////////////////////
|
|
@@ -572,14 +574,13 @@ uint16_t max_display_update_time = 0;
|
572
|
574
|
// done. ** This blocks the command queue! **
|
573
|
575
|
//
|
574
|
576
|
void _lcd_synchronize() {
|
575
|
|
- static bool no_reentry = false;
|
576
|
577
|
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
|
577
|
578
|
if (no_reentry) return;
|
578
|
579
|
// Make this the current handler till all moves are done
|
579
|
580
|
no_reentry = true;
|
580
|
581
|
const screenFunc_t old_screen = currentScreen;
|
581
|
582
|
lcd_goto_screen(_lcd_synchronize);
|
582
|
|
- stepper.synchronize();
|
|
583
|
+ stepper.synchronize(); // idle() is called until moves complete
|
583
|
584
|
no_reentry = false;
|
584
|
585
|
lcd_goto_screen(old_screen);
|
585
|
586
|
}
|
|
@@ -1741,6 +1742,20 @@ void kill_screen(const char* lcd_msg) {
|
1741
|
1742
|
lcd_return_to_status();
|
1742
|
1743
|
}
|
1743
|
1744
|
|
|
1745
|
+ #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
1746
|
+
|
|
1747
|
+ /**
|
|
1748
|
+ * If the queue is full, the command will fail, so we have to loop
|
|
1749
|
+ * with idle() to make sure the command has been enqueued.
|
|
1750
|
+ */
|
|
1751
|
+ void lcd_enqueue_command_sram(char * const cmd) {
|
|
1752
|
+ no_reentry = true;
|
|
1753
|
+ while (enqueue_and_echo_command(cmd)) idle();
|
|
1754
|
+ no_reentry = false;
|
|
1755
|
+ }
|
|
1756
|
+
|
|
1757
|
+ #endif
|
|
1758
|
+
|
1744
|
1759
|
#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
|
1745
|
1760
|
|
1746
|
1761
|
void lcd_autostart_sd() {
|
|
@@ -1917,7 +1932,6 @@ void kill_screen(const char* lcd_msg) {
|
1917
|
1932
|
* Step 5: Initiate a move to the next point
|
1918
|
1933
|
*/
|
1919
|
1934
|
void _lcd_level_goto_next_point() {
|
1920
|
|
- // Set the menu to display ahead of blocking call
|
1921
|
1935
|
lcd_goto_screen(_lcd_level_bed_moving);
|
1922
|
1936
|
|
1923
|
1937
|
// G29 Records Z, moves, and signals when it pauses
|
|
@@ -2065,10 +2079,10 @@ void kill_screen(const char* lcd_msg) {
|
2065
|
2079
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
2066
|
2080
|
#if HAS_TEMP_BED
|
2067
|
2081
|
sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
|
2068
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2082
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
2069
|
2083
|
#endif
|
2070
|
2084
|
sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
|
2071
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2085
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
2072
|
2086
|
enqueue_and_echo_commands_P(PSTR("G29 P1"));
|
2073
|
2087
|
}
|
2074
|
2088
|
|
|
@@ -2099,7 +2113,7 @@ void kill_screen(const char* lcd_msg) {
|
2099
|
2113
|
const int ind = ubl_height_amount > 0 ? 9 : 10;
|
2100
|
2114
|
strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
|
2101
|
2115
|
sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
|
2102
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2116
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
2103
|
2117
|
}
|
2104
|
2118
|
|
2105
|
2119
|
/**
|
|
@@ -2149,8 +2163,9 @@ void kill_screen(const char* lcd_msg) {
|
2149
|
2163
|
0
|
2150
|
2164
|
#endif
|
2151
|
2165
|
;
|
2152
|
|
- sprintf_P(UBL_LCD_GCODE, PSTR("G28\nG26 C B%i H%i P"), temp, custom_hotend_temp);
|
2153
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2166
|
+ sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp);
|
|
2167
|
+ lcd_enqueue_command_sram("G28");
|
|
2168
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
2154
|
2169
|
}
|
2155
|
2170
|
|
2156
|
2171
|
/**
|
|
@@ -2183,7 +2198,7 @@ void kill_screen(const char* lcd_msg) {
|
2183
|
2198
|
void _lcd_ubl_grid_level_cmd() {
|
2184
|
2199
|
char UBL_LCD_GCODE[10];
|
2185
|
2200
|
sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points);
|
2186
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2201
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
2187
|
2202
|
}
|
2188
|
2203
|
|
2189
|
2204
|
/**
|
|
@@ -2224,16 +2239,7 @@ void kill_screen(const char* lcd_msg) {
|
2224
|
2239
|
void _lcd_ubl_fillin_amount_cmd() {
|
2225
|
2240
|
char UBL_LCD_GCODE[16];
|
2226
|
2241
|
sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount);
|
2227
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
2228
|
|
- }
|
2229
|
|
-
|
2230
|
|
- /**
|
2231
|
|
- * UBL Smart Fill-in Command
|
2232
|
|
- */
|
2233
|
|
- void _lcd_ubl_smart_fillin_cmd() {
|
2234
|
|
- char UBL_LCD_GCODE[12];
|
2235
|
|
- sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 T0"));
|
2236
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2242
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
2237
|
2243
|
}
|
2238
|
2244
|
|
2239
|
2245
|
/**
|
|
@@ -2250,7 +2256,7 @@ void kill_screen(const char* lcd_msg) {
|
2250
|
2256
|
START_MENU();
|
2251
|
2257
|
MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
|
2252
|
2258
|
MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9, _lcd_ubl_fillin_amount_cmd);
|
2253
|
|
- MENU_ITEM(function, MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
|
|
2259
|
+ MENU_ITEM(gcode, MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0"));
|
2254
|
2260
|
MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0"));
|
2255
|
2261
|
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
2256
|
2262
|
END_MENU();
|
|
@@ -2323,22 +2329,20 @@ void kill_screen(const char* lcd_msg) {
|
2323
|
2329
|
* UBL Load Mesh Command
|
2324
|
2330
|
*/
|
2325
|
2331
|
void _lcd_ubl_load_mesh_cmd() {
|
2326
|
|
- char UBL_LCD_GCODE[25];
|
|
2332
|
+ char UBL_LCD_GCODE[10];
|
2327
|
2333
|
sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
|
2328
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
2329
|
|
- sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_LOADED "."), ubl_storage_slot);
|
2330
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2334
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
|
2335
|
+ enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_LOADED "."));
|
2331
|
2336
|
}
|
2332
|
2337
|
|
2333
|
2338
|
/**
|
2334
|
2339
|
* UBL Save Mesh Command
|
2335
|
2340
|
*/
|
2336
|
2341
|
void _lcd_ubl_save_mesh_cmd() {
|
2337
|
|
- char UBL_LCD_GCODE[25];
|
|
2342
|
+ char UBL_LCD_GCODE[10];
|
2338
|
2343
|
sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
|
2339
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
2340
|
|
- sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_SAVED "."), ubl_storage_slot);
|
2341
|
|
- enqueue_and_echo_command(UBL_LCD_GCODE);
|
|
2344
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
|
2345
|
+ enqueue_and_echo_commands_P(PSTR("M117 " MSG_MESH_SAVED "."));
|
2342
|
2346
|
}
|
2343
|
2347
|
|
2344
|
2348
|
/**
|
|
@@ -2384,12 +2388,11 @@ void kill_screen(const char* lcd_msg) {
|
2384
|
2388
|
* UBL LCD "radar" map point editing
|
2385
|
2389
|
*/
|
2386
|
2390
|
void _lcd_ubl_map_lcd_edit_cmd() {
|
2387
|
|
- char ubl_lcd_gcode [50], str[10], str2[10];
|
2388
|
|
-
|
|
2391
|
+ char UBL_LCD_GCODE[50], str[10], str2[10];
|
2389
|
2392
|
dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
|
2390
|
2393
|
dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
|
2391
|
|
- snprintf_P(ubl_lcd_gcode, sizeof(ubl_lcd_gcode), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
|
2392
|
|
- enqueue_and_echo_command(ubl_lcd_gcode);
|
|
2394
|
+ snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
|
|
2395
|
+ lcd_enqueue_command_sram(UBL_LCD_GCODE);
|
2393
|
2396
|
}
|
2394
|
2397
|
|
2395
|
2398
|
/**
|
|
@@ -2537,7 +2540,7 @@ void kill_screen(const char* lcd_msg) {
|
2537
|
2540
|
START_MENU();
|
2538
|
2541
|
MENU_BACK(MSG_UBL_LEVEL_BED);
|
2539
|
2542
|
MENU_ITEM(gcode, "1 " MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1"));
|
2540
|
|
- MENU_ITEM(function, "2 " MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
|
|
2543
|
+ MENU_ITEM(gcode, "2 " MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0"));
|
2541
|
2544
|
MENU_ITEM(submenu, "3 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
|
2542
|
2545
|
MENU_ITEM(gcode, "4 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T"));
|
2543
|
2546
|
MENU_ITEM(submenu, "5 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
|
|
@@ -2979,11 +2982,10 @@ void kill_screen(const char* lcd_msg) {
|
2979
|
2982
|
#endif
|
2980
|
2983
|
|
2981
|
2984
|
manual_move_to_current(axis);
|
2982
|
|
-
|
2983
|
2985
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
2984
|
2986
|
}
|
2985
|
2987
|
encoderPosition = 0;
|
2986
|
|
- if (lcdDrawUpdate && !processing_manual_move) {
|
|
2988
|
+ if (lcdDrawUpdate) {
|
2987
|
2989
|
const float pos = current_position[axis]
|
2988
|
2990
|
#if IS_KINEMATIC
|
2989
|
2991
|
+ manual_move_offset
|
|
@@ -3019,7 +3021,7 @@ void kill_screen(const char* lcd_msg) {
|
3019
|
3021
|
}
|
3020
|
3022
|
encoderPosition = 0;
|
3021
|
3023
|
}
|
3022
|
|
- if (lcdDrawUpdate && !processing_manual_move) {
|
|
3024
|
+ if (lcdDrawUpdate) {
|
3023
|
3025
|
PGM_P pos_label;
|
3024
|
3026
|
#if E_MANUAL == 1
|
3025
|
3027
|
pos_label = PSTR(MSG_MOVE_E);
|
|
@@ -3283,7 +3285,7 @@ void kill_screen(const char* lcd_msg) {
|
3283
|
3285
|
autotune_temp[e]
|
3284
|
3286
|
#endif
|
3285
|
3287
|
);
|
3286
|
|
- enqueue_and_echo_command(cmd);
|
|
3288
|
+ lcd_enqueue_command_sram(cmd);
|
3287
|
3289
|
}
|
3288
|
3290
|
|
3289
|
3291
|
#endif // PID_AUTOTUNE_MENU
|
|
@@ -4719,7 +4721,7 @@ void lcd_update() {
|
4719
|
4721
|
if (UBL_CONDITION && LCD_CLICKED) {
|
4720
|
4722
|
if (!wait_for_unclick) { // If not waiting for a debounce release:
|
4721
|
4723
|
wait_for_unclick = true; // Set debounce flag to ignore continous clicks
|
4722
|
|
- lcd_clicked = !wait_for_user; // Keep the click if not waiting for a user-click
|
|
4724
|
+ lcd_clicked = !wait_for_user && !no_reentry; // Flag the click if allowed
|
4723
|
4725
|
wait_for_user = false; // Any click clears wait for user
|
4724
|
4726
|
lcd_quick_feedback(); // Always make a click sound
|
4725
|
4727
|
}
|