Smarter MIN, MAX, ABS macros
Use macros that explicitly avoid double-evaluation and can be used for any datatype, replacing `min`, `max`, `abs`, `fabs`, `labs`, and `FABS`. Co-Authored-By: ejtagle <ejtagle@hotmail.com>
This commit is contained in:
@ -61,7 +61,7 @@ void GcodeSuite::G0_G1(
|
||||
if (fwretract.autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) {
|
||||
const float echange = destination[E_AXIS] - current_position[E_AXIS];
|
||||
// Is this a retract or recover move?
|
||||
if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && fwretract.retracted[active_extruder] == (echange > 0.0)) {
|
||||
if (WITHIN(ABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && fwretract.retracted[active_extruder] == (echange > 0.0)) {
|
||||
current_position[E_AXIS] = destination[E_AXIS]; // Hide a G1-based retract/recover from calculations
|
||||
sync_plan_position_e(); // AND from the planner
|
||||
return fwretract.retract(echange < 0.0); // Firmware-based retract/recover (double-retract ignored)
|
||||
|
@ -91,7 +91,7 @@ void plan_arc(
|
||||
angular_travel = RADIANS(360);
|
||||
|
||||
const float flat_mm = radius * angular_travel,
|
||||
mm_of_travel = linear_travel ? HYPOT(flat_mm, linear_travel) : FABS(flat_mm);
|
||||
mm_of_travel = linear_travel ? HYPOT(flat_mm, linear_travel) : ABS(flat_mm);
|
||||
if (mm_of_travel < 0.001) return;
|
||||
|
||||
uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT));
|
||||
|
Reference in New Issue
Block a user