Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delta moves in UBL mesh edit screen #20620

Merged
2 changes: 1 addition & 1 deletion Marlin/src/feature/fwretract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void FWRetract::retract(const bool retracting
if (retracting) {
// Retract by moving from a faux E position back to the current E position
current_retract[active_extruder] = base_retract;
prepare_internal_move_to_destination( // set current to destination
prepare_internal_move_to_destination( // set current from destination
settings.retract_feedrate_mm_s * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
);

Expand Down
16 changes: 7 additions & 9 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
TERN_(IS_KINEMATIC, float ManualMove::offset = 0);
TERN_(IS_KINEMATIC, bool ManualMove::processing = false);
TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0);
uint8_t ManualMove::axis = (uint8_t)NO_AXIS;
AxisEnum ManualMove::axis = NO_AXIS;

/**
* If a manual move has been posted and its time has arrived, and if the planner
Expand All @@ -713,14 +713,14 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
if (processing) return; // Prevent re-entry from idle() calls

// Add a manual move to the queue?
if (axis != (uint8_t)NO_AXIS && ELAPSED(millis(), start_time) && !planner.is_full()) {
if (axis != NO_AXIS && ELAPSED(millis(), start_time) && !planner.is_full()) {

const feedRate_t fr_mm_s = (uint8_t(axis) <= E_AXIS) ? manual_feedrate_mm_s[axis] : XY_PROBE_FEEDRATE_MM_S;
const feedRate_t fr_mm_s = (axis <= E_AXIS) ? manual_feedrate_mm_s[axis] : XY_PROBE_FEEDRATE_MM_S;

#if IS_KINEMATIC

#if HAS_MULTI_EXTRUDER
const int8_t old_extruder = active_extruder;
REMEMBER(ae, active_extruder);
if (axis == E_AXIS) active_extruder = e_index;
#endif

Expand All @@ -730,7 +730,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {

// Reset for the next move
offset = 0;
axis = (uint8_t)NO_AXIS;
axis = NO_AXIS;

// DELTA and SCARA machines use segmented moves, which could fill the planner during the call to
// move_to_destination. This will cause idle() to be called, which can then call this function while the
Expand All @@ -740,16 +740,14 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
prepare_internal_move_to_destination(fr_mm_s); // will set current_position from destination
processing = false;

TERN_(HAS_MULTI_EXTRUDER, active_extruder = old_extruder);

#else

// For Cartesian / Core motion simply move to the current_position
planner.buffer_line(current_position, fr_mm_s, axis == E_AXIS ? e_index : active_extruder);

//SERIAL_ECHOLNPAIR("Add planner.move with Axis ", int(axis), " at FR ", fr_mm_s);

axis = (uint8_t)NO_AXIS;
axis = NO_AXIS;

#endif
}
Expand All @@ -767,7 +765,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
if (move_axis == E_AXIS) e_index = eindex >= 0 ? eindex : active_extruder;
#endif
start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
axis = (uint8_t)move_axis;
axis = move_axis;
//SERIAL_ECHOLNPAIR("Post Move with Axis ", int(axis), " soon.");
}

Expand Down
15 changes: 8 additions & 7 deletions Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,22 @@

// Manual Movement class
class ManualMove {
public:
private:
static AxisEnum axis;
#if MULTI_MANUAL
static int8_t e_index;
#else
static int8_t constexpr e_index = 0;
#endif
static millis_t start_time;
public:
static float menu_scale;
TERN_(IS_KINEMATIC, static float offset);
#if IS_KINEMATIC
static bool processing;
#else
static bool constexpr processing = false;
#endif
#if MULTI_MANUAL
static int8_t e_index;
#else
static int8_t constexpr e_index = 0;
#endif
static uint8_t axis;
static void task();
static void soon(AxisEnum axis
#if MULTI_MANUAL
Expand Down
13 changes: 8 additions & 5 deletions Marlin/src/lcd/menu/menu_ubl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ void _lcd_ubl_map_edit_cmd() {
* UBL LCD Map Movement
*/
void ubl_map_move_to_xy() {
const xy_pos_t xy = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) };

// Some printers have unreachable areas in the mesh. Skip the move if unreachable.
if (!position_is_reachable(xy)) return;

#if ENABLED(DELTA)
if (current_position.z > delta_clip_start_height) { // Make sure the delta has fully free motion
Expand All @@ -422,11 +426,10 @@ void ubl_map_move_to_xy() {
}
#endif

// Set the nozzle position to the mesh point
current_position.set(ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot));

// Use the built-in manual move handler
ui.manual_move.soon(ALL_AXES);
// Do an internal move to the mesh point
destination.set(ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot));
constexpr feedRate_t fr_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
prepare_internal_move_to_destination(fr_mm_s); // Set current_position from destination
}

inline int32_t grid_index(const uint8_t x, const uint8_t y) {
Expand Down
9 changes: 4 additions & 5 deletions Marlin/src/lcd/tft/ui_480x320.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,17 +867,16 @@ static void moveAxis(AxisEnum axis, const int8_t direction) {
NOMORE(ui.manual_move.offset, max - current_position[axis]);
#else
current_position[axis] += diff;
const char *msg = PSTR(""); // clear the error
if (direction < 0 && current_position[axis] < min) {
current_position[axis] = min;
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
}
else if (direction > 0 && current_position[axis] > max) {
current_position[axis] = max;
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
}
else {
drawMessage(""); // clear the error
msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
}
drawMessage(msg);
#endif

ui.manual_move.soon(axis
Expand Down