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:
@ -216,7 +216,7 @@ void GcodeSuite::M109() {
|
||||
|
||||
#if TEMP_RESIDENCY_TIME > 0
|
||||
|
||||
const float temp_diff = FABS(target_temp - temp);
|
||||
const float temp_diff = ABS(target_temp - temp);
|
||||
|
||||
if (!residency_start_ms) {
|
||||
// Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
|
||||
|
@ -55,14 +55,14 @@ void GcodeSuite::M106() {
|
||||
fanSpeeds[p] = new_fanSpeeds[p];
|
||||
break;
|
||||
default:
|
||||
new_fanSpeeds[p] = min(t, 255);
|
||||
new_fanSpeeds[p] = MIN(t, 255);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif // EXTRA_FAN_SPEED
|
||||
const uint16_t s = parser.ushortval('S', 255);
|
||||
fanSpeeds[p] = min(s, 255);
|
||||
fanSpeeds[p] = MIN(s, 255U);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ void GcodeSuite::M190() {
|
||||
|
||||
#if TEMP_BED_RESIDENCY_TIME > 0
|
||||
|
||||
const float temp_diff = FABS(target_temp - temp);
|
||||
const float temp_diff = ABS(target_temp - temp);
|
||||
|
||||
if (!residency_start_ms) {
|
||||
// Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time.
|
||||
|
Reference in New Issue
Block a user