|
@@ -730,6 +730,30 @@
|
730
|
730
|
z_values[x][y] += g29_constant;
|
731
|
731
|
}
|
732
|
732
|
|
|
733
|
+ #if ENABLED(NEWPANEL)
|
|
734
|
+
|
|
735
|
+ typedef void (*clickFunc_t)();
|
|
736
|
+
|
|
737
|
+ bool click_and_hold(const clickFunc_t func=NULL) {
|
|
738
|
+ if (is_lcd_clicked()) {
|
|
739
|
+ lcd_quick_feedback();
|
|
740
|
+ const millis_t nxt = millis() + 1500UL;
|
|
741
|
+ while (is_lcd_clicked()) { // Loop while the encoder is pressed. Uses hardware flag!
|
|
742
|
+ idle(); // idle, of course
|
|
743
|
+ if (ELAPSED(millis(), nxt)) { // After 1.5 seconds
|
|
744
|
+ lcd_quick_feedback();
|
|
745
|
+ if (func) (*func)();
|
|
746
|
+ wait_for_release();
|
|
747
|
+ safe_delay(50); // Debounce the Encoder wheel
|
|
748
|
+ return true;
|
|
749
|
+ }
|
|
750
|
+ }
|
|
751
|
+ }
|
|
752
|
+ return false;
|
|
753
|
+ }
|
|
754
|
+
|
|
755
|
+ #endif // NEWPANEL
|
|
756
|
+
|
733
|
757
|
#if HAS_BED_PROBE
|
734
|
758
|
/**
|
735
|
759
|
* Probe all invalidated locations of the mesh that can be reached by the probe.
|
|
@@ -755,10 +779,9 @@
|
755
|
779
|
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n");
|
756
|
780
|
lcd_quick_feedback();
|
757
|
781
|
STOW_PROBE();
|
758
|
|
- while (is_lcd_clicked()) idle();
|
|
782
|
+ wait_for_release();
|
759
|
783
|
lcd_external_control = false;
|
760
|
784
|
restore_ubl_active_state_and_leave();
|
761
|
|
- safe_delay(50); // Debounce the Encoder wheel
|
762
|
785
|
return;
|
763
|
786
|
}
|
764
|
787
|
#endif
|
|
@@ -895,19 +918,20 @@
|
895
|
918
|
|
896
|
919
|
#if ENABLED(NEWPANEL)
|
897
|
920
|
|
898
|
|
- float unified_bed_leveling::measure_point_with_encoder() {
|
899
|
|
-
|
900
|
|
- while (is_lcd_clicked()) delay(50); // wait for user to release encoder wheel
|
901
|
|
- delay(50); // debounce
|
902
|
|
-
|
903
|
|
- KEEPALIVE_STATE(PAUSED_FOR_USER);
|
904
|
|
- while (!is_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here!
|
|
921
|
+ void unified_bed_leveling::move_z_with_encoder(const float &multiplier) {
|
|
922
|
+ wait_for_release();
|
|
923
|
+ while (!is_lcd_clicked()) {
|
905
|
924
|
idle();
|
906
|
925
|
if (encoder_diff) {
|
907
|
|
- do_blocking_move_to_z(current_position[Z_AXIS] + 0.01 * float(encoder_diff));
|
|
926
|
+ do_blocking_move_to_z(current_position[Z_AXIS] + float(encoder_diff) * multiplier);
|
908
|
927
|
encoder_diff = 0;
|
909
|
928
|
}
|
910
|
929
|
}
|
|
930
|
+ }
|
|
931
|
+
|
|
932
|
+ float unified_bed_leveling::measure_point_with_encoder() {
|
|
933
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
934
|
+ move_z_with_encoder(0.01);
|
911
|
935
|
KEEPALIVE_STATE(IN_HANDLER);
|
912
|
936
|
return current_position[Z_AXIS];
|
913
|
937
|
}
|
|
@@ -956,6 +980,14 @@
|
956
|
980
|
return thickness;
|
957
|
981
|
}
|
958
|
982
|
|
|
983
|
+ void abort_manual_probe_remaining_mesh() {
|
|
984
|
+ SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
|
|
985
|
+ do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
986
|
+ lcd_external_control = false;
|
|
987
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
988
|
+ ubl.restore_ubl_active_state_and_leave();
|
|
989
|
+ }
|
|
990
|
+
|
959
|
991
|
void unified_bed_leveling::manually_probe_remaining_mesh(const float &rx, const float &ry, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) {
|
960
|
992
|
|
961
|
993
|
lcd_external_control = true;
|
|
@@ -991,36 +1023,15 @@
|
991
|
1023
|
const float z_step = 0.01; // existing behavior: 0.01mm per click, occasionally step
|
992
|
1024
|
//const float z_step = 1.0 / planner.axis_steps_per_mm[Z_AXIS]; // approx one step each click
|
993
|
1025
|
|
994
|
|
- while (is_lcd_clicked()) delay(50); // wait for user to release encoder wheel
|
995
|
|
- delay(50); // debounce
|
996
|
|
- while (!is_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here!
|
997
|
|
- idle();
|
998
|
|
- if (encoder_diff) {
|
999
|
|
- do_blocking_move_to_z(current_position[Z_AXIS] + float(encoder_diff) * z_step);
|
1000
|
|
- encoder_diff = 0;
|
1001
|
|
- }
|
1002
|
|
- }
|
|
1026
|
+ move_z_with_encoder(z_step);
|
1003
|
1027
|
|
1004
|
|
- // this sequence to detect an is_lcd_clicked() debounce it and leave if it is
|
1005
|
|
- // a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp). This
|
1006
|
|
- // should be redone and compressed.
|
1007
|
|
- const millis_t nxt = millis() + 1500L;
|
1008
|
|
- while (is_lcd_clicked()) { // debounce and watch for abort
|
1009
|
|
- idle();
|
1010
|
|
- if (ELAPSED(millis(), nxt)) {
|
1011
|
|
- SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
|
1012
|
|
- do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
1013
|
|
-
|
1014
|
|
- #if ENABLED(NEWPANEL)
|
1015
|
|
- lcd_quick_feedback();
|
1016
|
|
- while (is_lcd_clicked()) idle();
|
1017
|
|
- lcd_external_control = false;
|
1018
|
|
- #endif
|
1019
|
|
-
|
1020
|
|
- KEEPALIVE_STATE(IN_HANDLER);
|
1021
|
|
- restore_ubl_active_state_and_leave();
|
1022
|
|
- return;
|
1023
|
|
- }
|
|
1028
|
+ if (click_and_hold()) {
|
|
1029
|
+ SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
|
|
1030
|
+ do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
1031
|
+ lcd_external_control = false;
|
|
1032
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
1033
|
+ restore_ubl_active_state_and_leave();
|
|
1034
|
+ return;
|
1024
|
1035
|
}
|
1025
|
1036
|
|
1026
|
1037
|
z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick;
|
|
@@ -1177,16 +1188,16 @@
|
1177
|
1188
|
}
|
1178
|
1189
|
|
1179
|
1190
|
void unified_bed_leveling::restore_ubl_active_state_and_leave() {
|
1180
|
|
- if (--ubl_state_recursion_chk) {
|
1181
|
|
- SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
1182
|
|
-
|
1183
|
|
- #if ENABLED(NEWPANEL)
|
1184
|
|
- LCD_MESSAGEPGM(MSG_UBL_RESTORE_ERROR);
|
1185
|
|
- lcd_quick_feedback();
|
1186
|
|
- #endif
|
1187
|
|
-
|
1188
|
|
- return;
|
1189
|
|
- }
|
|
1191
|
+ #ifdef UBL_DEVEL_DEBUGGING
|
|
1192
|
+ if (--ubl_state_recursion_chk) {
|
|
1193
|
+ SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
|
1194
|
+ #if ENABLED(NEWPANEL)
|
|
1195
|
+ LCD_MESSAGEPGM(MSG_UBL_RESTORE_ERROR);
|
|
1196
|
+ lcd_quick_feedback();
|
|
1197
|
+ #endif
|
|
1198
|
+ return;
|
|
1199
|
+ }
|
|
1200
|
+ #endif
|
1190
|
1201
|
set_bed_leveling_enabled(ubl_state_at_invocation);
|
1191
|
1202
|
}
|
1192
|
1203
|
|
|
@@ -1468,6 +1479,12 @@
|
1468
|
1479
|
|
1469
|
1480
|
#if ENABLED(NEWPANEL)
|
1470
|
1481
|
|
|
1482
|
+ void abort_fine_tune() {
|
|
1483
|
+ lcd_return_to_status();
|
|
1484
|
+ do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
1485
|
+ LCD_MESSAGEPGM(MSG_EDITING_STOPPED);
|
|
1486
|
+ }
|
|
1487
|
+
|
1471
|
1488
|
void unified_bed_leveling::fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map) {
|
1472
|
1489
|
if (!parser.seen('R')) // fine_tune_mesh() is special. If no repetition count flag is specified
|
1473
|
1490
|
g29_repetition_cnt = 1; // do exactly one mesh location. Otherwise use what the parser decided.
|
|
@@ -1543,19 +1560,8 @@
|
1543
|
1560
|
// this sequence to detect an is_lcd_clicked() debounce it and leave if it is
|
1544
|
1561
|
// a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp). This
|
1545
|
1562
|
// should be redone and compressed.
|
1546
|
|
- const millis_t nxt = millis() + 1500UL;
|
1547
|
|
- while (is_lcd_clicked()) { // debounce and watch for abort
|
1548
|
|
- idle();
|
1549
|
|
- if (ELAPSED(millis(), nxt)) {
|
1550
|
|
- lcd_return_to_status();
|
1551
|
|
- do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
1552
|
|
- LCD_MESSAGEPGM(MSG_EDITING_STOPPED);
|
1553
|
|
-
|
1554
|
|
- while (is_lcd_clicked()) idle();
|
1555
|
|
-
|
1556
|
|
- goto FINE_TUNE_EXIT;
|
1557
|
|
- }
|
1558
|
|
- }
|
|
1563
|
+ if (click_and_hold(abort_fine_tune))
|
|
1564
|
+ goto FINE_TUNE_EXIT;
|
1559
|
1565
|
|
1560
|
1566
|
safe_delay(20); // We don't want any switch noise.
|
1561
|
1567
|
|