|
@@ -311,17 +311,16 @@
|
311
|
311
|
#define USE_PROBE_AS_REFERENCE 1
|
312
|
312
|
|
313
|
313
|
// The simple parameter flags and values are 'static' so parameter parsing can be in a support routine.
|
314
|
|
- static int g29_verbose_level, phase_value = -1, repetition_cnt,
|
|
314
|
+ static int g29_verbose_level, phase_value, repetition_cnt,
|
315
|
315
|
storage_slot = 0, map_type, grid_size;
|
316
|
316
|
static bool repeat_flag, c_flag, x_flag, y_flag;
|
317
|
317
|
static float x_pos, y_pos, measured_z, card_thickness = 0.0, ubl_constant = 0.0;
|
318
|
318
|
|
319
|
|
- extern void lcd_setstatus(const char* message, const bool persist);
|
320
|
|
- extern void lcd_setstatuspgm(const char* message, const uint8_t level);
|
|
319
|
+ extern void lcd_setstatus(const char* message, const bool persist);
|
|
320
|
+ extern void lcd_setstatuspgm(const char* message, const uint8_t level);
|
321
|
321
|
|
322
|
322
|
void __attribute__((optimize("O0"))) gcode_G29() {
|
323
|
323
|
|
324
|
|
-
|
325
|
324
|
if (ubl.eeprom_start < 0) {
|
326
|
325
|
SERIAL_PROTOCOLLNPGM("?You need to enable your EEPROM and initialize it");
|
327
|
326
|
SERIAL_PROTOCOLLNPGM("with M502, M500, M501 in that order.\n");
|
|
@@ -384,21 +383,17 @@
|
384
|
383
|
}
|
385
|
384
|
|
386
|
385
|
if (code_seen('J')) {
|
387
|
|
- if (!WITHIN(grid_size, 2, 9)) {
|
388
|
|
- SERIAL_PROTOCOLLNPGM("ERROR - grid size must be between 2 and 9");
|
389
|
|
- return;
|
390
|
|
- }
|
391
|
386
|
ubl.save_ubl_active_state_and_disable();
|
392
|
387
|
ubl.tilt_mesh_based_on_probed_grid(code_seen('O') || code_seen('M'));
|
393
|
388
|
ubl.restore_ubl_active_state_and_leave();
|
394
|
389
|
}
|
395
|
390
|
|
396
|
391
|
if (code_seen('P')) {
|
397
|
|
- phase_value = code_value_int();
|
398
|
|
- if (!WITHIN(phase_value, 0, 7)) {
|
399
|
|
- SERIAL_PROTOCOLLNPGM("Invalid Phase value. (0-4)\n");
|
400
|
|
- return;
|
|
392
|
+ if (WITHIN(phase_value,0,1) && ubl.state.eeprom_storage_slot==-1) {
|
|
393
|
+ ubl.state.eeprom_storage_slot=0;
|
|
394
|
+ SERIAL_PROTOCOLLNPGM("Default storage slot 0 selected.\n");
|
401
|
395
|
}
|
|
396
|
+
|
402
|
397
|
switch (phase_value) {
|
403
|
398
|
case 0:
|
404
|
399
|
//
|
|
@@ -420,7 +415,7 @@
|
420
|
415
|
SERIAL_PROTOCOLPAIR("Probing Mesh Points Closest to (", x_pos);
|
421
|
416
|
SERIAL_PROTOCOLCHAR(',');
|
422
|
417
|
SERIAL_PROTOCOL(y_pos);
|
423
|
|
- SERIAL_PROTOCOLLNPGM(")\n");
|
|
418
|
+ SERIAL_PROTOCOLLNPGM(").\n");
|
424
|
419
|
}
|
425
|
420
|
ubl.probe_entire_mesh(x_pos + X_PROBE_OFFSET_FROM_EXTRUDER, y_pos + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
426
|
421
|
code_seen('O') || code_seen('M'), code_seen('E'), code_seen('U'));
|
|
@@ -460,7 +455,7 @@
|
460
|
455
|
}
|
461
|
456
|
}
|
462
|
457
|
manually_probe_remaining_mesh(x_pos, y_pos, height, card_thickness, code_seen('O') || code_seen('M'));
|
463
|
|
- SERIAL_PROTOCOLLNPGM("G29 P2 finished");
|
|
458
|
+ SERIAL_PROTOCOLLNPGM("G29 P2 finished.");
|
464
|
459
|
|
465
|
460
|
} break;
|
466
|
461
|
|
|
@@ -757,8 +752,6 @@
|
757
|
752
|
}
|
758
|
753
|
|
759
|
754
|
void unified_bed_leveling::tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3) {
|
760
|
|
- int i, j;
|
761
|
|
-
|
762
|
755
|
matrix_3x3 rotation;
|
763
|
756
|
vector_3 v1 = vector_3( (UBL_PROBE_PT_1_X - UBL_PROBE_PT_2_X),
|
764
|
757
|
(UBL_PROBE_PT_1_Y - UBL_PROBE_PT_2_Y),
|
|
@@ -892,14 +885,14 @@
|
892
|
885
|
//, min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]) / 2.0);
|
893
|
886
|
|
894
|
887
|
stepper.synchronize();
|
895
|
|
- SERIAL_PROTOCOLPGM("Place shim under nozzle");
|
|
888
|
+ SERIAL_PROTOCOLPGM("Place shim under nozzle.");
|
896
|
889
|
say_and_take_a_measurement();
|
897
|
890
|
|
898
|
891
|
const float z1 = use_encoder_wheel_to_measure_point();
|
899
|
892
|
do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
|
900
|
893
|
stepper.synchronize();
|
901
|
894
|
|
902
|
|
- SERIAL_PROTOCOLPGM("Remove shim");
|
|
895
|
+ SERIAL_PROTOCOLPGM("Remove shim.");
|
903
|
896
|
say_and_take_a_measurement();
|
904
|
897
|
|
905
|
898
|
const float z2 = use_encoder_wheel_to_measure_point();
|
|
@@ -1039,14 +1032,22 @@
|
1039
|
1032
|
|
1040
|
1033
|
g29_verbose_level = code_seen('V') ? code_value_int() : 0;
|
1041
|
1034
|
if (!WITHIN(g29_verbose_level, 0, 4)) {
|
1042
|
|
- SERIAL_PROTOCOLLNPGM("?(V)erbose Level is implausible (0-4)\n");
|
|
1035
|
+ SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).\n");
|
1043
|
1036
|
err_flag = true;
|
1044
|
1037
|
}
|
1045
|
1038
|
|
|
1039
|
+ if (code_seen('P')) {
|
|
1040
|
+ phase_value = code_value_int();
|
|
1041
|
+ if (!WITHIN(phase_value, 0, 6)) {
|
|
1042
|
+ SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
|
|
1043
|
+ err_flag = true;
|
|
1044
|
+ }
|
|
1045
|
+ }
|
|
1046
|
+
|
1046
|
1047
|
if (code_seen('J')) {
|
1047
|
1048
|
grid_size = code_has_value() ? code_value_int() : 3;
|
1048
|
|
- if (!WITHIN(grid_size, 2, 5)) {
|
1049
|
|
- SERIAL_PROTOCOLLNPGM("Invalid grid probe points specified.\n");
|
|
1049
|
+ if (!WITHIN(grid_size, 2, 9)) {
|
|
1050
|
+ SERIAL_PROTOCOLLNPGM("?Invalid grid size (J) specified (2-9).\n");
|
1050
|
1051
|
err_flag = true;
|
1051
|
1052
|
}
|
1052
|
1053
|
}
|
|
@@ -1607,7 +1608,10 @@
|
1607
|
1608
|
zig_zag ^= true;
|
1608
|
1609
|
}
|
1609
|
1610
|
|
1610
|
|
- const int status = finish_incremental_LSF(&lsf_results);
|
|
1611
|
+ if (finish_incremental_LSF(&lsf_results)) {
|
|
1612
|
+ SERIAL_ECHOPGM("Could not complete LSF!");
|
|
1613
|
+ return;
|
|
1614
|
+ }
|
1611
|
1615
|
|
1612
|
1616
|
if (g29_verbose_level > 3) {
|
1613
|
1617
|
SERIAL_ECHOPGM("LSF Results A=");
|