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:
Scott Lahteine
2018-05-13 01:10:34 -05:00
parent 083ec9963e
commit 99ecdf59af
52 changed files with 206 additions and 247 deletions

View File

@@ -74,7 +74,7 @@ void GcodeSuite::M600() {
#endif
// Initial retract before move to filament change position
const float retract = -FABS(parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
const float retract = -ABS(parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
#ifdef PAUSE_PARK_RETRACT_LENGTH
+ (PAUSE_PARK_RETRACT_LENGTH)
#endif
@@ -93,14 +93,14 @@ void GcodeSuite::M600() {
#endif
// Unload filament
const float unload_length = -FABS(parser.seen('U') ? parser.value_axis_units(E_AXIS)
const float unload_length = -ABS(parser.seen('U') ? parser.value_axis_units(E_AXIS)
: filament_change_unload_length[active_extruder]);
// Slow load filament
constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
// Fast load filament
const float fast_load_length = FABS(parser.seen('L') ? parser.value_axis_units(E_AXIS)
const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS)
: filament_change_load_length[active_extruder]);
const int beep_count = parser.intval('B',