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:
@ -39,8 +39,8 @@ static bool G38_run_probe() {
|
||||
// Get direction of move and retract
|
||||
float retract_mm[XYZ];
|
||||
LOOP_XYZ(i) {
|
||||
float dist = destination[i] - current_position[i];
|
||||
retract_mm[i] = FABS(dist) < G38_MINIMUM_MOVE ? 0 : home_bump_mm((AxisEnum)i) * (dist > 0 ? -1 : 1);
|
||||
const float dist = destination[i] - current_position[i];
|
||||
retract_mm[i] = ABS(dist) < G38_MINIMUM_MOVE ? 0 : home_bump_mm((AxisEnum)i) * (dist > 0 ? -1 : 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -105,7 +105,7 @@ void GcodeSuite::G38(const bool is_38_2) {
|
||||
|
||||
// If any axis has enough movement, do the move
|
||||
LOOP_XYZ(i)
|
||||
if (FABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
|
||||
if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
|
||||
if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
|
||||
// If G38.2 fails throw an error
|
||||
if (!G38_run_probe() && is_38_2) {
|
||||
|
Reference in New Issue
Block a user