From 4a5bd47b6a8d48f6c0045399e667f2c521faa213 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 11 May 2024 13:40:29 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20MUL=5FTERN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/fwretract.cpp | 5 ++--- Marlin/src/feature/leds/neopixel.h | 2 +- Marlin/src/module/planner.cpp | 8 +++----- Marlin/src/module/planner.h | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Marlin/src/feature/fwretract.cpp b/Marlin/src/feature/fwretract.cpp index aee775bfff..fff2a1ed39 100644 --- a/Marlin/src/feature/fwretract.cpp +++ b/Marlin/src/feature/fwretract.cpp @@ -137,7 +137,7 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/)) // Retract by moving from a faux E position back to the current E position current_retract[active_extruder] = base_retract; prepare_internal_move_to_destination( // set current from destination - settings.retract_feedrate_mm_s * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS)) + MUL_TERN(RETRACT_SYNC_MIXING, settings.retract_feedrate_mm_s, MIXING_STEPPERS) ); // Is a Z hop set, and has the hop not yet been done? @@ -165,8 +165,7 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/)) // Recover E, set_current_to_destination prepare_internal_move_to_destination( - (swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s) - * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS)) + MUL_TERN(RETRACT_SYNC_MIXING, swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s, MIXING_STEPPERS) ); } diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index 6cc8b6157e..26f7a07d58 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -130,7 +130,7 @@ public: } // Accessors - static uint16_t pixels() { return adaneo1.numPixels() * TERN1(NEOPIXEL2_INSERIES, 2); } + static uint16_t pixels() { return MUL_TERN(NEOPIXEL2_INSERIES, adaneo1.numPixels(), 2); } static uint32_t pixel_color(const uint16_t n) { #if ENABLED(NEOPIXEL2_INSERIES) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 37c344bfe7..ae3b9e50a0 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2392,14 +2392,12 @@ bool Planner::_populate_block( #endif const feedRate_t cs = ABS(current_speed.e), - max_fr = settings.max_feedrate_mm_s[E_AXIS_N(extruder)] - * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1); + max_fr = MUL_TERN(HAS_MIXER_SYNC_CHANNEL, settings.max_feedrate_mm_s[E_AXIS_N(extruder)], MIXING_STEPPERS); - if (cs > max_fr) NOMORE(speed_factor, max_fr / cs); //respect max feedrate on any movement (doesn't matter if E axes only or not) + if (cs > max_fr) NOMORE(speed_factor, max_fr / cs); // Respect max feedrate on any move (travel and print) #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) - const feedRate_t max_vfr = volumetric_extruder_feedrate_limit[extruder] - * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1); + const feedRate_t max_vfr = MUL_TERN(HAS_MIXER_SYNC_CHANNEL, volumetric_extruder_feedrate_limit[extruder], MIXING_STEPPERS); // TODO: Doesn't work properly for joined segments. Set MIN_STEPS_PER_SEGMENT 1 as workaround. diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index e783b0cd0f..74a587f858 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -634,7 +634,7 @@ class Planner { #if HAS_EXTRUDERS FORCE_INLINE static void refresh_e_factor(const uint8_t e) { - e_factor[e] = flow_percentage[e] * 0.01f * TERN(NO_VOLUMETRICS, 1.0f, volumetric_multiplier[e]); + e_factor[e] = flow_percentage[e] * 0.01f IF_DISABLED(NO_VOLUMETRICS, * volumetric_multiplier[e]); } static void set_flow(const uint8_t e, const int16_t flow) {