Fix M428
This fixes the old implementation of M428 which was broken, did not match the website, and made no sense.
This commit is contained in:
parent
a2fc7da587
commit
227b96b28b
@ -439,6 +439,7 @@ void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s
|
|||||||
|| ENABLED(NOZZLE_CLEAN_FEATURE) \
|
|| ENABLED(NOZZLE_CLEAN_FEATURE) \
|
||||||
|| ENABLED(NOZZLE_PARK_FEATURE) \
|
|| ENABLED(NOZZLE_PARK_FEATURE) \
|
||||||
|| (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)) \
|
|| (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)) \
|
||||||
|
|| HAS_M206_COMMAND \
|
||||||
) || ENABLED(NO_MOTION_BEFORE_HOMING)
|
) || ENABLED(NO_MOTION_BEFORE_HOMING)
|
||||||
|
|
||||||
#if HAS_AXIS_UNHOMED_ERR
|
#if HAS_AXIS_UNHOMED_ERR
|
||||||
|
@ -9959,31 +9959,27 @@ void quickstop_stepper() {
|
|||||||
* Use M206 to set these values directly.
|
* Use M206 to set these values directly.
|
||||||
*/
|
*/
|
||||||
inline void gcode_M428() {
|
inline void gcode_M428() {
|
||||||
bool err = false;
|
if (axis_unhomed_error()) return;
|
||||||
|
|
||||||
|
float diff[XYZ];
|
||||||
LOOP_XYZ(i) {
|
LOOP_XYZ(i) {
|
||||||
if (axis_homed[i]) {
|
diff[i] = base_home_pos((AxisEnum)i) - current_position[i];
|
||||||
const float base = (current_position[i] > (soft_endstop_min[i] + soft_endstop_max[i]) * 0.5) ? base_home_pos((AxisEnum)i) : 0,
|
if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
|
||||||
diff = base - current_position[i];
|
diff[i] = -current_position[i];
|
||||||
if (WITHIN(diff, -20, 20)) {
|
if (!WITHIN(diff[i], -20, 20)) {
|
||||||
set_home_offset((AxisEnum)i, diff);
|
SERIAL_ERROR_START();
|
||||||
}
|
SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
||||||
else {
|
LCD_ALERTMESSAGEPGM("Err: Too far!");
|
||||||
SERIAL_ERROR_START();
|
BUZZ(200, 40);
|
||||||
SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
|
return;
|
||||||
LCD_ALERTMESSAGEPGM("Err: Too far!");
|
|
||||||
BUZZ(200, 40);
|
|
||||||
err = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err) {
|
LOOP_XYZ(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||||
report_current_position();
|
report_current_position();
|
||||||
LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
||||||
BUZZ(100, 659);
|
BUZZ(100, 659);
|
||||||
BUZZ(100, 698);
|
BUZZ(100, 698);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_M206_COMMAND
|
#endif // HAS_M206_COMMAND
|
||||||
|
Loading…
Reference in New Issue
Block a user