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:
@ -305,7 +305,7 @@ void print_line_from_here_to_there(const float &sx, const float &sy, const float
|
||||
|
||||
// If the end point of the line is closer to the nozzle, flip the direction,
|
||||
// moving from the end to the start. On very small lines the optimization isn't worth it.
|
||||
if (dist_end < dist_start && (INTERSECTION_CIRCLE_RADIUS) < FABS(line_length))
|
||||
if (dist_end < dist_start && (INTERSECTION_CIRCLE_RADIUS) < ABS(line_length))
|
||||
return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
||||
|
||||
// Decide whether to retract & bump
|
||||
@ -427,7 +427,7 @@ inline bool turn_on_heaters() {
|
||||
#endif
|
||||
#endif
|
||||
thermalManager.setTargetBed(g26_bed_temp);
|
||||
while (abs(thermalManager.degBed() - g26_bed_temp) > 3) {
|
||||
while (ABS(thermalManager.degBed() - g26_bed_temp) > 3) {
|
||||
|
||||
#if ENABLED(NEWPANEL)
|
||||
if (is_lcd_clicked()) return exit_from_g26();
|
||||
@ -450,7 +450,7 @@ inline bool turn_on_heaters() {
|
||||
|
||||
// Start heating the nozzle and wait for it to reach temperature.
|
||||
thermalManager.setTargetHotend(g26_hotend_temp, 0);
|
||||
while (abs(thermalManager.degHotend(0) - g26_hotend_temp) > 3) {
|
||||
while (ABS(thermalManager.degHotend(0) - g26_hotend_temp) > 3) {
|
||||
|
||||
#if ENABLED(NEWPANEL)
|
||||
if (is_lcd_clicked()) return exit_from_g26();
|
||||
|
@ -471,7 +471,7 @@ void GcodeSuite::G29() {
|
||||
if (verbose_level || seenQ) {
|
||||
SERIAL_PROTOCOLPGM("Manual G29 ");
|
||||
if (g29_in_progress) {
|
||||
SERIAL_PROTOCOLPAIR("point ", min(abl_probe_index + 1, abl_points));
|
||||
SERIAL_PROTOCOLPAIR("point ", MIN(abl_probe_index + 1, abl_points));
|
||||
SERIAL_PROTOCOLLNPAIR(" of ", abl_points);
|
||||
}
|
||||
else
|
||||
|
@ -205,7 +205,7 @@ void GcodeSuite::G29() {
|
||||
} // switch(state)
|
||||
|
||||
if (state == MeshNext) {
|
||||
SERIAL_PROTOCOLPAIR("MBL G29 point ", min(mbl_probe_index, GRID_MAX_POINTS));
|
||||
SERIAL_PROTOCOLPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
|
||||
SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user