|
@@ -187,6 +187,30 @@
|
187
|
187
|
}
|
188
|
188
|
|
189
|
189
|
/**
|
|
190
|
+ * Detect ubl_lcd_clicked, debounce it, and return true for cancel
|
|
191
|
+ */
|
|
192
|
+ bool user_canceled() {
|
|
193
|
+ if (!ubl_lcd_clicked()) return false;
|
|
194
|
+ safe_delay(10); // Wait for click to settle
|
|
195
|
+
|
|
196
|
+ #if ENABLED(ULTRA_LCD)
|
|
197
|
+ lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
|
|
198
|
+ lcd_quick_feedback();
|
|
199
|
+ #endif
|
|
200
|
+ lcd_reset_alert_level();
|
|
201
|
+
|
|
202
|
+ while (!ubl_lcd_clicked()) idle(); // Wait for button release
|
|
203
|
+
|
|
204
|
+ // If the button is suddenly pressed again,
|
|
205
|
+ // ask the user to resolve the issue
|
|
206
|
+ lcd_setstatuspgm(PSTR("Release button"), 99); // will never appear...
|
|
207
|
+ while (ubl_lcd_clicked()) idle(); // unless this loop happens
|
|
208
|
+ lcd_setstatuspgm(PSTR(""));
|
|
209
|
+
|
|
210
|
+ return true;
|
|
211
|
+ }
|
|
212
|
+
|
|
213
|
+ /**
|
190
|
214
|
* G26: Mesh Validation Pattern generation.
|
191
|
215
|
*
|
192
|
216
|
* Used to interactively edit UBL's Mesh by placing the
|
|
@@ -300,25 +324,7 @@
|
300
|
324
|
|
301
|
325
|
for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
|
302
|
326
|
|
303
|
|
- // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is
|
304
|
|
- // a Press and Hold is repeated in a lot of places (including ubl_G29.cpp). This
|
305
|
|
- // should be redone and compressed.
|
306
|
|
- if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
307
|
|
- #if ENABLED(ULTRA_LCD)
|
308
|
|
- lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
|
309
|
|
- lcd_quick_feedback();
|
310
|
|
- #endif
|
311
|
|
- while (!ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
312
|
|
- idle(); // Encoder Wheel if that is why we are leaving
|
313
|
|
- lcd_reset_alert_level();
|
314
|
|
- lcd_setstatuspgm(PSTR(""));
|
315
|
|
- }
|
316
|
|
- while (ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
317
|
|
- idle(); // Encoder Wheel if that is why we are leaving
|
318
|
|
- lcd_setstatuspgm(PSTR("Unpress Wheel"), 99);
|
319
|
|
- }
|
320
|
|
- goto LEAVE;
|
321
|
|
- }
|
|
327
|
+ if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
322
|
328
|
|
323
|
329
|
int tmp_div_30 = tmp / 30.0;
|
324
|
330
|
if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
|
|
@@ -436,28 +442,10 @@
|
436
|
442
|
for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
|
437
|
443
|
for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
|
438
|
444
|
|
439
|
|
- // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is
|
440
|
|
- // a Press and Hold is repeated in a lot of places (including ubl_G29.cpp). This
|
441
|
|
- // should be redone and compressed.
|
442
|
|
- if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
|
443
|
|
- #if ENABLED(ULTRA_LCD)
|
444
|
|
- lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
|
445
|
|
- lcd_quick_feedback();
|
446
|
|
- #endif
|
447
|
|
- while (!ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
448
|
|
- idle(); // Encoder Wheel if that is why we are leaving
|
449
|
|
- lcd_reset_alert_level();
|
450
|
|
- lcd_setstatuspgm(PSTR(""));
|
451
|
|
- }
|
452
|
|
- while (ubl_lcd_clicked()) { // Wait until the user is done pressing the
|
453
|
|
- idle(); // Encoder Wheel if that is why we are leaving
|
454
|
|
- lcd_setstatuspgm(PSTR("Unpress Wheel"), 99);
|
455
|
|
- }
|
456
|
|
- return true;
|
457
|
|
- }
|
|
445
|
+ if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation
|
458
|
446
|
|
459
|
447
|
if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X.
|
460
|
|
- // This is already a half circle because we are at the edge of the bed.
|
|
448
|
+ // This is already a half circle because we are at the edge of the bed.
|
461
|
449
|
|
462
|
450
|
if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i + 1, j)) { // check if we can do a line to the left
|
463
|
451
|
if (!is_bit_set(horizontal_mesh_line_flags, i, j)) {
|