|
|
@ -472,11 +472,14 @@ float filament_size[EXTRUDERS], volumetric_multiplier[EXTRUDERS];
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Software Endstops are based on the configured limits.
|
|
|
|
// Software Endstops are based on the configured limits.
|
|
|
|
|
|
|
|
float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
|
|
|
|
|
|
|
|
soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS };
|
|
|
|
#if HAS_SOFTWARE_ENDSTOPS
|
|
|
|
#if HAS_SOFTWARE_ENDSTOPS
|
|
|
|
bool soft_endstops_enabled = true;
|
|
|
|
bool soft_endstops_enabled = true;
|
|
|
|
|
|
|
|
#if IS_KINEMATIC
|
|
|
|
|
|
|
|
float soft_endstop_radius, soft_endstop_radius_2;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
|
|
|
|
|
|
|
|
soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if FAN_COUNT > 0
|
|
|
|
#if FAN_COUNT > 0
|
|
|
|
int16_t fanSpeeds[FAN_COUNT] = { 0 };
|
|
|
|
int16_t fanSpeeds[FAN_COUNT] = { 0 };
|
|
|
@ -1464,8 +1467,17 @@ bool get_target_extruder_from_command(const uint16_t code) {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
if (axis == Z_AXIS)
|
|
|
|
switch(axis) {
|
|
|
|
delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
|
|
|
|
case X_AXIS:
|
|
|
|
|
|
|
|
case Y_AXIS:
|
|
|
|
|
|
|
|
// Get a minimum radius for clamping
|
|
|
|
|
|
|
|
soft_endstop_radius = MIN3(FABS(max(soft_endstop_min[X_AXIS], soft_endstop_min[Y_AXIS])), soft_endstop_max[X_AXIS], soft_endstop_max[Y_AXIS]);
|
|
|
|
|
|
|
|
soft_endstop_radius_2 = sq(soft_endstop_radius);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Z_AXIS:
|
|
|
|
|
|
|
|
delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -12045,33 +12057,38 @@ void ok_to_send() {
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_SOFTWARE_ENDSTOPS
|
|
|
|
#if HAS_SOFTWARE_ENDSTOPS
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Constrain the given coordinates to the software endstops.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Constrain the given coordinates to the software endstops.
|
|
|
|
* Constrain the given coordinates to the software endstops.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* NOTE: This will only apply to Z on DELTA and SCARA. XY is
|
|
|
|
* For DELTA/SCARA the XY constraint is based on the smallest
|
|
|
|
* constrained to a circle on these kinematic systems.
|
|
|
|
* radius within the set software endstops.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void clamp_to_software_endstops(float target[XYZ]) {
|
|
|
|
void clamp_to_software_endstops(float target[XYZ]) {
|
|
|
|
if (!soft_endstops_enabled) return;
|
|
|
|
if (!soft_endstops_enabled) return;
|
|
|
|
#if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
|
|
|
|
#if IS_KINEMATIC
|
|
|
|
NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]);
|
|
|
|
const float dist_2 = HYPOT2(target[X_AXIS], target[Y_AXIS]);
|
|
|
|
#endif
|
|
|
|
if (dist_2 > soft_endstop_radius_2) {
|
|
|
|
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
|
|
|
|
const float ratio = soft_endstop_radius / SQRT(dist_2); // 200 / 300 = 0.66
|
|
|
|
NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]);
|
|
|
|
target[X_AXIS] *= ratio;
|
|
|
|
|
|
|
|
target[Y_AXIS] *= ratio;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
|
|
|
|
|
|
|
|
NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
|
|
|
|
|
|
|
|
NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
|
|
|
|
|
|
|
|
NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
|
|
|
|
|
|
|
|
NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
|
|
|
|
#if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
|
|
|
|
NOLESS(target[Z_AXIS], soft_endstop_min[Z_AXIS]);
|
|
|
|
NOLESS(target[Z_AXIS], soft_endstop_min[Z_AXIS]);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
|
|
|
|
|
|
|
|
NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
|
|
|
|
|
|
|
|
NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
|
|
|
|
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
|
|
|
|
NOMORE(target[Z_AXIS], soft_endstop_max[Z_AXIS]);
|
|
|
|
NOMORE(target[Z_AXIS], soft_endstop_max[Z_AXIS]);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|