UBL-related cleanup, spacing, standards

Reference: #6804
This commit is contained in:
Scott Lahteine
2017-05-21 05:28:38 -05:00
parent 52e20aeab3
commit 02f15f6775
3 changed files with 60 additions and 68 deletions

View File

@ -438,63 +438,56 @@ void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s
#if IS_KINEMATIC // (DELTA or SCARA)
#if ENABLED(DELTA)
#define DELTA_PRINTABLE_RADIUS_SQUARED ((float)DELTA_PRINTABLE_RADIUS * (float)DELTA_PRINTABLE_RADIUS )
#endif
#if IS_SCARA
extern const float L1, L2;
#endif
inline bool position_is_reachable_raw_xy( float raw_x, float raw_y ) {
inline bool position_is_reachable_raw_xy(const float &rx, const float &ry) {
#if ENABLED(DELTA)
return ( HYPOT2( raw_x, raw_y ) <= DELTA_PRINTABLE_RADIUS_SQUARED );
return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
#elif IS_SCARA
#if MIDDLE_DEAD_ZONE_R > 0
const float R2 = HYPOT2(raw_x - SCARA_OFFSET_X, raw_y - SCARA_OFFSET_Y);
const float R2 = HYPOT2(rx - SCARA_OFFSET_X, ry - SCARA_OFFSET_Y);
return R2 >= sq(float(MIDDLE_DEAD_ZONE_R)) && R2 <= sq(L1 + L2);
#else
return HYPOT2(raw_x - SCARA_OFFSET_X, raw_y - SCARA_OFFSET_Y) <= sq(L1 + L2);
return HYPOT2(rx - SCARA_OFFSET_X, ry - SCARA_OFFSET_Y) <= sq(L1 + L2);
#endif
#else // CARTESIAN
#error
// To be migrated from MakerArm branch in future
#endif
}
inline bool position_is_reachable_by_probe_raw_xy( float raw_x, float raw_y ) {
inline bool position_is_reachable_by_probe_raw_xy(const float &rx, const float &ry) {
// both the nozzle and the probe must be able to reach the point
// Both the nozzle and the probe must be able to reach the point.
// This won't work on SCARA since the probe offset rotates with the arm.
return ( position_is_reachable_raw_xy( raw_x, raw_y ) &&
position_is_reachable_raw_xy(
raw_x - X_PROBE_OFFSET_FROM_EXTRUDER,
raw_y - Y_PROBE_OFFSET_FROM_EXTRUDER ));
return position_is_reachable_raw_xy(rx, ry)
&& position_is_reachable_raw_xy(rx - X_PROBE_OFFSET_FROM_EXTRUDER, ry - Y_PROBE_OFFSET_FROM_EXTRUDER);
}
#else // CARTESIAN
inline bool position_is_reachable_raw_xy( float raw_x, float raw_y ) {
// note to reviewer: this +/-0.0001 logic is copied from original postion_is_reachable
return WITHIN(raw_x, X_MIN_POS - 0.0001, X_MAX_POS + 0.0001)
&& WITHIN(raw_y, Y_MIN_POS - 0.0001, Y_MAX_POS + 0.0001);
inline bool position_is_reachable_raw_xy(const float &rx, const float &ry) {
// Add 0.001 margin to deal with float imprecision
return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
&& WITHIN(ry, Y_MIN_POS - 0.001, Y_MAX_POS + 0.001);
}
inline bool position_is_reachable_by_probe_raw_xy( float raw_x, float raw_y ) {
// note to reviewer: this logic is copied from UBL_G29.cpp and does not contain the +/-0.0001 above
return WITHIN(raw_x, MIN_PROBE_X, MAX_PROBE_X)
&& WITHIN(raw_y, MIN_PROBE_Y, MAX_PROBE_Y);
inline bool position_is_reachable_by_probe_raw_xy(const float &rx, const float &ry) {
// Add 0.001 margin to deal with float imprecision
return WITHIN(rx, MIN_PROBE_X - 0.001, MAX_PROBE_X + 0.001)
&& WITHIN(ry, MIN_PROBE_Y - 0.001, MAX_PROBE_Y + 0.001);
}
#endif // CARTESIAN
inline bool position_is_reachable_by_probe_xy( float target_x, float target_y ) {
return position_is_reachable_by_probe_raw_xy(
RAW_X_POSITION( target_x ),
RAW_Y_POSITION( target_y ));
FORCE_INLINE bool position_is_reachable_by_probe_xy(const float &lx, const float &ly) {
return position_is_reachable_by_probe_raw_xy(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
}
inline bool position_is_reachable_xy( float target_x, float target_y ) {
return position_is_reachable_raw_xy( RAW_X_POSITION( target_x ), RAW_Y_POSITION( target_y ));
FORCE_INLINE bool position_is_reachable_xy(const float &lx, const float &ly) {
return position_is_reachable_raw_xy(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
}
#endif //MARLIN_H