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 and improve Polargraph #24847

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -822,15 +822,17 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
* Granular software endstops (Marlin >= 1.1.7)
*/
#if ENABLED(MIN_SOFTWARE_ENDSTOPS) && DISABLED(MIN_SOFTWARE_ENDSTOP_Z)
#if IS_KINEMATIC
#if ENABLED(POLARGRAPH)
#elif IS_KINEMATIC
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
#error "MIN_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MIN_SOFTWARE_ENDSTOP_Z."
#elif NONE(MIN_SOFTWARE_ENDSTOP_X, MIN_SOFTWARE_ENDSTOP_Y)
#error "MIN_SOFTWARE_ENDSTOPS requires at least one of the MIN_SOFTWARE_ENDSTOP_[XYZ] options."
#endif
#endif

#if ENABLED(MAX_SOFTWARE_ENDSTOPS) && DISABLED(MAX_SOFTWARE_ENDSTOP_Z)
#if IS_KINEMATIC
#if ENABLED(POLARGRAPH)
#elif IS_KINEMATIC
i-make-robots marked this conversation as resolved.
Show resolved Hide resolved
#error "MAX_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MAX_SOFTWARE_ENDSTOP_Z."
#elif NONE(MAX_SOFTWARE_ENDSTOP_X, MAX_SOFTWARE_ENDSTOP_Y)
#error "MAX_SOFTWARE_ENDSTOPS requires at least one of the MAX_SOFTWARE_ENDSTOP_[XYZ] options."
Expand Down
21 changes: 14 additions & 7 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ void report_current_position_projected() {
can_reach = (
a < polargraph_max_belt_len + 1
&& b < polargraph_max_belt_len + 1
&& (a + b) > _MIN(draw_area_size.x, draw_area_size.y)
);

#endif
Expand Down Expand Up @@ -562,7 +561,8 @@ void do_blocking_move_to(NUM_AXIS_ARGS(const float), const_feedRate_t fr_mm_s/*=
const feedRate_t w_feedrate = fr_mm_s ?: homing_feedrate(W_AXIS)
);

#if IS_KINEMATIC
#if IS_KINEMATIC && !ENABLED(POLARGRAPH)
// kinematic machines are expected to home to a point 1.5x their range? never reachable.
if (!position_is_reachable(x, y)) return;
destination = current_position; // sync destination at the start
#endif
Expand Down Expand Up @@ -919,11 +919,18 @@ void restore_feedrate_and_scaling() {
constexpr xy_pos_t offs{0};
#endif

if (TERN1(IS_SCARA, axis_was_homed(X_AXIS) && axis_was_homed(Y_AXIS))) {
const float dist_2 = HYPOT2(target.x - offs.x, target.y - offs.y);
if (dist_2 > delta_max_radius_2)
target *= float(delta_max_radius / SQRT(dist_2)); // 200 / 300 = 0.66
}
#if ENABLED(POLARGRAPH)
target.x = _MIN(target.x, draw_area_max.x);
target.x = _MAX(target.x, draw_area_min.x);
target.y = _MIN(target.y, draw_area_max.y);
target.y = _MAX(target.y, draw_area_min.y);
#else
if (TERN1(IS_SCARA, axis_was_homed(X_AXIS) && axis_was_homed(Y_AXIS))) {
const float dist_2 = HYPOT2(target.x - offs.x, target.y - offs.y);
if (dist_2 > delta_max_radius_2)
target *= float(delta_max_radius / SQRT(dist_2)); // 200 / 300 = 0.66
}
#endif

#else

Expand Down