|
@@ -47,7 +47,6 @@ void GcodeSuite::M206() {
|
47
|
47
|
if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_linear_units()); // Psi
|
48
|
48
|
#endif
|
49
|
49
|
|
50
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
51
|
50
|
report_current_position();
|
52
|
51
|
}
|
53
|
52
|
|
|
@@ -63,32 +62,27 @@ void GcodeSuite::M206() {
|
63
|
62
|
* Use M206 to set these values directly.
|
64
|
63
|
*/
|
65
|
64
|
void GcodeSuite::M428() {
|
66
|
|
- bool err = false;
|
|
65
|
+ if (axis_unhomed_error()) return;
|
|
66
|
+
|
|
67
|
+ float diff[XYZ];
|
67
|
68
|
LOOP_XYZ(i) {
|
68
|
|
- if (axis_homed[i]) {
|
69
|
|
- const float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
|
70
|
|
- diff = base - current_position[i];
|
71
|
|
- if (WITHIN(diff, -20, 20)) {
|
72
|
|
- set_home_offset((AxisEnum)i, diff);
|
73
|
|
- }
|
74
|
|
- else {
|
75
|
|
- SERIAL_ERROR_START();
|
76
|
|
- SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
77
|
|
- LCD_ALERTMESSAGEPGM("Err: Too far!");
|
78
|
|
- BUZZ(200, 40);
|
79
|
|
- err = true;
|
80
|
|
- break;
|
81
|
|
- }
|
|
69
|
+ diff[i] = base_home_pos((AxisEnum)i) - current_position[i];
|
|
70
|
+ if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
|
|
71
|
+ diff[i] = -current_position[i];
|
|
72
|
+ if (!WITHIN(diff[i], -20, 20)) {
|
|
73
|
+ SERIAL_ERROR_START();
|
|
74
|
+ SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
|
75
|
+ LCD_ALERTMESSAGEPGM("Err: Too far!");
|
|
76
|
+ BUZZ(200, 40);
|
|
77
|
+ return;
|
82
|
78
|
}
|
83
|
79
|
}
|
84
|
80
|
|
85
|
|
- if (!err) {
|
86
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
87
|
|
- report_current_position();
|
88
|
|
- LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
89
|
|
- BUZZ(100, 659);
|
90
|
|
- BUZZ(100, 698);
|
91
|
|
- }
|
|
81
|
+ LOOP_XYZ(i) set_home_offset((AxisEnum)i, diff[i]);
|
|
82
|
+ report_current_position();
|
|
83
|
+ LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
|
84
|
+ BUZZ(100, 659);
|
|
85
|
+ BUZZ(100, 698);
|
92
|
86
|
}
|
93
|
87
|
|
94
|
88
|
#endif // HAS_M206_COMMAND
|