Fix extraneous "Home XYZ First" message

This commit is contained in:
Scott Lahteine
2019-09-25 21:01:29 -05:00
parent 9a209012b5
commit b2e1f77f58
35 changed files with 248 additions and 284 deletions

View File

@ -1030,26 +1030,32 @@ void prepare_move_to_destination() {
set_current_from_destination();
}
bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) {
uint8_t axes_need_homing(uint8_t axis_bits/*=0x07*/) {
#if ENABLED(HOME_AFTER_DEACTIVATE)
const bool xx = x && !TEST(axis_known_position, X_AXIS),
yy = y && !TEST(axis_known_position, Y_AXIS),
zz = z && !TEST(axis_known_position, Z_AXIS);
#define HOMED_FLAGS axis_known_position
#else
const bool xx = x && !TEST(axis_homed, X_AXIS),
yy = y && !TEST(axis_homed, Y_AXIS),
zz = z && !TEST(axis_homed, Z_AXIS);
#define HOMED_FLAGS axis_homed
#endif
if (xx || yy || zz) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_HOME " ");
if (xx) SERIAL_CHAR('X');
if (yy) SERIAL_CHAR('Y');
if (zz) SERIAL_CHAR('Z');
SERIAL_ECHOLNPGM(" " MSG_FIRST);
// Clear test bits that are homed
if (TEST(axis_bits, X_AXIS) && TEST(HOMED_FLAGS, X_AXIS)) CBI(axis_bits, X_AXIS);
if (TEST(axis_bits, Y_AXIS) && TEST(HOMED_FLAGS, Y_AXIS)) CBI(axis_bits, Y_AXIS);
if (TEST(axis_bits, Z_AXIS) && TEST(HOMED_FLAGS, Z_AXIS)) CBI(axis_bits, Z_AXIS);
return axis_bits;
}
bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) {
if ((axis_bits = axes_need_homing(axis_bits))) {
static const char home_first[] PROGMEM = MSG_HOME_FIRST;
char msg[sizeof(home_first)];
sprintf_P(msg, home_first,
TEST(axis_bits, X_AXIS) ? "X" : "",
TEST(axis_bits, Y_AXIS) ? "Y" : "",
TEST(axis_bits, Z_AXIS) ? "Z" : ""
);
SERIAL_ECHO_START();
SERIAL_ECHO(msg);
#if HAS_DISPLAY
ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : "");
ui.set_status(msg);
#endif
return true;
}

View File

@ -211,7 +211,8 @@ void restore_feedrate_and_scaling();
// Homing
//
bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);
uint8_t axes_need_homing(uint8_t axis_bits=0x07);
bool axis_unhomed_error(uint8_t axis_bits=0x07);
#if ENABLED(NO_MOTION_BEFORE_HOMING)
#define MOTION_CONDITIONS (IsRunning() && !axis_unhomed_error())

View File

@ -373,12 +373,11 @@ bool set_probe_deployed(const bool deploy) {
do_probe_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
#if ENABLED(Z_PROBE_SLED)
#define _AUE_ARGS true, false, false
#else
#define _AUE_ARGS
#endif
if (axis_unhomed_error(_AUE_ARGS)) {
if (axis_unhomed_error(
#if ENABLED(Z_PROBE_SLED)
_BV(X_AXIS)
#endif
)) {
SERIAL_ERROR_MSG(MSG_STOP_UNHOMED);
stop();
return true;

View File

@ -158,7 +158,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
#endif
);
if (axis_unhomed_error(true, false, false)) return;
if (axis_unhomed_error(_BV(X_AXIS))) return;
/**
* Z Lift and Nozzle Offset shift ar defined in caller method to work equal with any Multi Hotend realization