Adjust axis homed / trusted methods (#20323)
This commit is contained in:
@ -506,18 +506,12 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
lcd_put_wchar('X' + uint8_t(axis));
|
||||
if (blink)
|
||||
lcd_put_u8str(value);
|
||||
else {
|
||||
if (!TEST(axis_homed, axis))
|
||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
||||
else {
|
||||
#if NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING)
|
||||
if (!TEST(axis_known_position, axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
else
|
||||
#endif
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
}
|
||||
else if (axis_should_home(axis))
|
||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
|
||||
FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) {
|
||||
|
@ -422,18 +422,12 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
lcd.write('X' + uint8_t(axis));
|
||||
if (blink)
|
||||
lcd.print(value);
|
||||
else {
|
||||
if (!TEST(axis_homed, axis))
|
||||
while (const char c = *value++) lcd.write(c <= '.' ? c : '?');
|
||||
else {
|
||||
#if NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING)
|
||||
if (!TEST(axis_known_position, axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
else
|
||||
#endif
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
}
|
||||
else if (axis_should_home(axis))
|
||||
while (const char c = *value++) lcd.write(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
|
||||
FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *prefix, const bool blink) {
|
||||
|
@ -384,18 +384,12 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
|
||||
if (blink)
|
||||
lcd_put_u8str(value);
|
||||
else {
|
||||
if (!TEST(axis_homed, axis))
|
||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
||||
else {
|
||||
#if NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING)
|
||||
if (!TEST(axis_known_position, axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
else
|
||||
#endif
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
}
|
||||
else if (axis_should_home(axis))
|
||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -659,13 +659,13 @@ void ST7920_Lite_Status_Screen::draw_status_message() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool position_known) {
|
||||
void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool position_trusted) {
|
||||
char str[7];
|
||||
set_ddram_address(DDRAM_LINE_4);
|
||||
begin_data();
|
||||
|
||||
// If position is unknown, flash the labels.
|
||||
const unsigned char alt_label = position_known ? 0 : (ui.get_blink() ? ' ' : 0);
|
||||
const unsigned char alt_label = position_trusted ? 0 : (ui.get_blink() ? ' ' : 0);
|
||||
|
||||
if (TERN1(LCD_SHOW_E_TOTAL, !printingIsActive())) {
|
||||
write_byte(alt_label ? alt_label : 'X');
|
||||
@ -831,9 +831,8 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) {
|
||||
}
|
||||
}
|
||||
|
||||
if (countdown == 0 && (forceUpdate || position_changed()
|
||||
|| TERN(DISABLE_REDUCED_ACCURACY_WARNING, 0, blink_changed())
|
||||
)) draw_position(current_position, TERN(DISABLE_REDUCED_ACCURACY_WARNING, 1, all_axes_known()));
|
||||
if (countdown == 0 && (forceUpdate || position_changed() || TERN(DISABLE_REDUCED_ACCURACY_WARNING, 0, blink_changed())))
|
||||
draw_position(current_position, TERN(DISABLE_REDUCED_ACCURACY_WARNING, 1, all_axes_trusted()));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -855,7 +854,7 @@ void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) {
|
||||
|
||||
UNUSED(forceUpdate);
|
||||
|
||||
#endif // LCD_SET_PROGRESS_MANUALLY || SDSUPPORT
|
||||
#endif
|
||||
}
|
||||
|
||||
void ST7920_Lite_Status_Screen::update(const bool forceUpdate) {
|
||||
|
@ -1281,8 +1281,7 @@ void HMI_Move_Z() {
|
||||
last_zoffset = dwin_zoffset;
|
||||
dwin_zoffset = HMI_ValueStruct.offset_value / 100.0f;
|
||||
#if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
|
||||
if ( (ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_known()) && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()) )
|
||||
babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset);
|
||||
if (BABYSTEP_ALLOWED()) babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset);
|
||||
#endif
|
||||
DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(zoff_line), HMI_ValueStruct.offset_value);
|
||||
DWIN_UpdateLCD();
|
||||
|
@ -356,9 +356,9 @@ namespace ExtUI {
|
||||
bool canMove(const axis_t axis) {
|
||||
switch (axis) {
|
||||
#if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
|
||||
case X: return TEST(axis_homed, X_AXIS);
|
||||
case Y: return TEST(axis_homed, Y_AXIS);
|
||||
case Z: return TEST(axis_homed, Z_AXIS);
|
||||
case X: return axis_should_home(X_AXIS);
|
||||
case Y: return axis_should_home(Y_AXIS);
|
||||
case Z: return axis_should_home(Z_AXIS);
|
||||
#else
|
||||
case X: case Y: case Z: return true;
|
||||
#endif
|
||||
@ -889,9 +889,9 @@ namespace ExtUI {
|
||||
|
||||
bool commandsInQueue() { return (planner.movesplanned() || queue.has_commands_queued()); }
|
||||
|
||||
bool isAxisPositionKnown(const axis_t axis) { return TEST(axis_known_position, axis); }
|
||||
bool isAxisPositionKnown(const extruder_t) { return TEST(axis_known_position, E_AXIS); }
|
||||
bool isPositionKnown() { return all_axes_known(); }
|
||||
bool isAxisPositionKnown(const axis_t axis) { return axis_is_trusted((AxisEnum)axis); }
|
||||
bool isAxisPositionKnown(const extruder_t) { return axis_is_trusted(E_AXIS); }
|
||||
bool isPositionKnown() { return all_axes_trusted(); }
|
||||
bool isMachineHomed() { return all_axes_homed(); }
|
||||
|
||||
PGM_P getFirmwareName_str() {
|
||||
|
@ -188,8 +188,7 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
|
||||
doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
|
||||
}
|
||||
else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) {
|
||||
if ( (ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_known())
|
||||
&& (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()) )
|
||||
if (BABYSTEP_ALLOWED())
|
||||
screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z);
|
||||
else {
|
||||
#if ENABLED(MOVE_Z_WHEN_IDLE)
|
||||
|
@ -230,7 +230,7 @@ static inline void _lcd_level_bed_corners_homing() {
|
||||
|
||||
void _lcd_level_bed_corners() {
|
||||
ui.defer_status_screen();
|
||||
if (!all_axes_known()) {
|
||||
if (!all_axes_trusted()) {
|
||||
set_all_unhomed();
|
||||
queue.inject_P(G28_STR);
|
||||
}
|
||||
|
@ -237,7 +237,7 @@
|
||||
* Save Settings (Req: EEPROM_SETTINGS)
|
||||
*/
|
||||
void menu_bed_leveling() {
|
||||
const bool is_homed = all_axes_known(),
|
||||
const bool is_homed = all_axes_trusted(),
|
||||
is_valid = leveling_is_valid();
|
||||
|
||||
START_MENU();
|
||||
|
@ -164,7 +164,7 @@ void menu_advanced_settings();
|
||||
void menu_tool_offsets() {
|
||||
|
||||
auto _recalc_offsets = []{
|
||||
if (active_extruder && all_axes_known()) { // For the 2nd extruder re-home so the next tool-change gets the new offsets.
|
||||
if (active_extruder && all_axes_trusted()) { // For the 2nd extruder re-home so the next tool-change gets the new offsets.
|
||||
queue.inject_P(G28_STR); // In future, we can babystep the 2nd extruder (if active), making homing unnecessary.
|
||||
active_extruder = 0;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ void _ubl_map_screen_homing() {
|
||||
*/
|
||||
void _ubl_goto_map_screen() {
|
||||
if (planner.movesplanned()) return; // The ACTION_ITEM will do nothing
|
||||
if (!all_axes_known()) {
|
||||
if (!all_axes_trusted()) {
|
||||
set_all_unhomed();
|
||||
queue.inject_P(G28_STR);
|
||||
}
|
||||
|
@ -257,42 +257,37 @@ void MarlinUI::draw_status_screen() {
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_rectangle(0, 0, 312, 24, COLOR_AXIS_HOMED);
|
||||
|
||||
uint16_t color;
|
||||
uint16_t offset;
|
||||
bool is_homed;
|
||||
|
||||
tft.add_text( 10, 3, COLOR_AXIS_HOMED , "X");
|
||||
tft.add_text(127, 3, COLOR_AXIS_HOMED , "Y");
|
||||
tft.add_text(219, 3, COLOR_AXIS_HOMED , "Z");
|
||||
|
||||
is_homed = TEST(axis_homed, X_AXIS);
|
||||
tft_string.set(blink & !is_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||
tft.add_text( 68 - tft_string.width(), 3, is_homed ? COLOR_AXIS_HOMED : COLOR_AXIS_NOT_HOMED, tft_string);
|
||||
bool not_homed = axis_should_home(X_AXIS);
|
||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||
tft.add_text( 68 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
|
||||
is_homed = TEST(axis_homed, Y_AXIS);
|
||||
tft_string.set(blink & !is_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||
tft.add_text(185 - tft_string.width(), 3, is_homed ? COLOR_AXIS_HOMED : COLOR_AXIS_NOT_HOMED, tft_string);
|
||||
not_homed = axis_should_home(Y_AXIS);
|
||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||
tft.add_text(185 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
|
||||
is_homed = TEST(axis_homed, Z_AXIS);
|
||||
if (blink & !is_homed) {
|
||||
not_homed = axis_should_home(Z_AXIS);
|
||||
uint16_t offset = 25;
|
||||
if (blink && not_homed)
|
||||
tft_string.set("?");
|
||||
offset = 25; // ".00"
|
||||
}
|
||||
else {
|
||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||
tft_string.set(ftostr52sp((int16_t)z));
|
||||
tft_string.rtrim();
|
||||
offset = tft_string.width();
|
||||
offset += tft_string.width();
|
||||
|
||||
tft_string.set(ftostr52sp(z));
|
||||
offset += 25 - tft_string.width();
|
||||
offset -= tft_string.width();
|
||||
}
|
||||
tft.add_text(301 - tft_string.width() - offset, 3, is_homed ? COLOR_AXIS_HOMED : COLOR_AXIS_NOT_HOMED, tft_string);
|
||||
tft.add_text(301 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
|
||||
// feed rate
|
||||
tft.canvas(70, 136, 80, 32);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||
uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||
tft.add_image(0, 0, imgFeedRate, color);
|
||||
tft_string.set(i16tostr3rj(feedrate_percentage));
|
||||
tft_string.add('%');
|
||||
|
@ -262,43 +262,38 @@ void MarlinUI::draw_status_screen() {
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_rectangle(0, 0, TFT_WIDTH - 8, 34, COLOR_AXIS_HOMED);
|
||||
|
||||
uint16_t color;
|
||||
uint16_t offset;
|
||||
bool is_homed;
|
||||
|
||||
tft.add_text( 16, 3, COLOR_AXIS_HOMED , "X");
|
||||
tft.add_text(192, 3, COLOR_AXIS_HOMED , "Y");
|
||||
tft.add_text(330, 3, COLOR_AXIS_HOMED , "Z");
|
||||
|
||||
is_homed = TEST(axis_homed, X_AXIS);
|
||||
tft_string.set(blink & !is_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||
tft.add_text(102 - tft_string.width(), 3, is_homed ? COLOR_AXIS_HOMED : COLOR_AXIS_NOT_HOMED, tft_string);
|
||||
bool not_homed = axis_should_home(X_AXIS);
|
||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||
tft.add_text(102 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
|
||||
is_homed = TEST(axis_homed, Y_AXIS);
|
||||
tft_string.set(blink & !is_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||
tft.add_text(280 - tft_string.width(), 3, is_homed ? COLOR_AXIS_HOMED : COLOR_AXIS_NOT_HOMED, tft_string);
|
||||
not_homed = axis_should_home(Y_AXIS);
|
||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||
tft.add_text(280 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
|
||||
is_homed = TEST(axis_homed, Z_AXIS);
|
||||
if (blink & !is_homed) {
|
||||
uint16_t offset = 32;
|
||||
not_homed = axis_should_home(Z_AXIS);
|
||||
if (blink && not_homed)
|
||||
tft_string.set("?");
|
||||
offset = 32; // ".00"
|
||||
}
|
||||
else {
|
||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||
tft_string.set(ftostr52sp((int16_t)z));
|
||||
tft_string.rtrim();
|
||||
offset = tft_string.width();
|
||||
offset += tft_string.width();
|
||||
|
||||
tft_string.set(ftostr52sp(z));
|
||||
offset += 32 - tft_string.width();
|
||||
offset -= tft_string.width();
|
||||
}
|
||||
tft.add_text(455 - tft_string.width() - offset, 3, is_homed ? COLOR_AXIS_HOMED : COLOR_AXIS_NOT_HOMED, tft_string);
|
||||
tft.add_text(455 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, 132, TFT_WIDTH - 8, 34));
|
||||
|
||||
// feed rate
|
||||
tft.canvas(96, 180, 100, 32);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||
uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||
tft.add_image(0, 0, imgFeedRate, color);
|
||||
tft_string.set(i16tostr3rj(feedrate_percentage));
|
||||
tft_string.add('%');
|
||||
|
Reference in New Issue
Block a user