diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index bbb152174f..f5dc231289 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -610,9 +610,9 @@ struct XYZval { // If any element is true then it's true FI constexpr operator bool() const { return 0 NUM_AXIS_GANG(|| x, || y, || z, || i, || j, || k, || u, || v, || w); } // Smallest element - FI constexpr T small() const { return TERN(HAS_X_AXIS, _MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)), 0); } + FI constexpr T small() const { return TERN0(HAS_X_AXIS, _MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w))); } // Largest element - FI constexpr T large() const { return TERN(HAS_X_AXIS, _MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)), 0); } + FI constexpr T large() const { return TERN0(HAS_X_AXIS, _MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w))); } // Explicit copy and copies with conversion FI constexpr XYZval copy() const { XYZval o = *this; return o; } diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index 585b706a82..12e175420d 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -49,7 +49,7 @@ */ void GcodeSuite::M306() { - const uint8_t e = TERN(HAS_MULTI_EXTRUDER, parser.intval('E', active_extruder), 0); + const uint8_t e = TERN0(HAS_MULTI_EXTRUDER, parser.intval('E', active_extruder)); if (e >= (EXTRUDERS)) { SERIAL_ECHOLNPGM("?(E)xtruder index out of range (0-", (EXTRUDERS) - 1, ")."); return; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_screen.cpp index aeff0d95f8..c192860f4a 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_screen.cpp @@ -43,7 +43,7 @@ void ZOffsetScreen::onRedraw(draw_mode_t what) { } bool ZOffsetScreen::onTouchHeld(uint8_t tag) { - const int16_t steps = TERN(BABYSTEPPING, mmToWholeSteps(getIncrement(), Z), 0); + const int16_t steps = TERN0(BABYSTEPPING, mmToWholeSteps(getIncrement(), Z)); const float increment = TERN(BABYSTEPPING, mmFromWholeSteps(steps, Z), getIncrement()); switch (tag) { case 2: ZOffsetWizard::runWizard(); break; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp index eb36798794..1ba048b9cc 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp @@ -95,7 +95,7 @@ bool ZOffsetScreen::wizardRunning() { } bool ZOffsetScreen::onTouchHeld(uint8_t tag) { - const int16_t steps = TERN(BABYSTEPPING, mmToWholeSteps(getIncrement(), Z), 0); + const int16_t steps = TERN0(BABYSTEPPING, mmToWholeSteps(getIncrement(), Z)); const float increment = TERN(BABYSTEPPING, mmFromWholeSteps(steps, Z), getIncrement()); switch (tag) { case 2: runWizard(); break; diff --git a/Marlin/src/lcd/menu/menu_bed_tramming.cpp b/Marlin/src/lcd/menu/menu_bed_tramming.cpp index 81372db50a..f33b8b812c 100644 --- a/Marlin/src/lcd/menu/menu_bed_tramming.cpp +++ b/Marlin/src/lcd/menu/menu_bed_tramming.cpp @@ -274,7 +274,7 @@ static void _lcd_goto_next_corner() { } void _lcd_test_corners() { - bed_corner = TERN(BED_TRAMMING_INCLUDE_CENTER, center_index, 0); + bed_corner = TERN0(BED_TRAMMING_INCLUDE_CENTER, center_index); last_z = BED_TRAMMING_HEIGHT; endstops.enable_z_probe(true); good_points = 0; diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 64c9cc382b..2d28d44991 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -446,7 +446,7 @@ void ubl_map_screen() { do { // Now, keep the encoder position within range if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = GRID_MAX_POINTS + TERN(TOUCH_SCREEN, ui.encoderPosition, -1); - if (int32_t(ui.encoderPosition) > GRID_MAX_POINTS - 1) ui.encoderPosition = TERN(TOUCH_SCREEN, ui.encoderPosition - GRID_MAX_POINTS, 0); + if (int32_t(ui.encoderPosition) > GRID_MAX_POINTS - 1) ui.encoderPosition = TERN0(TOUCH_SCREEN, ui.encoderPosition - GRID_MAX_POINTS); // Draw the grid point based on the encoder x = ui.encoderPosition % (GRID_MAX_POINTS_X); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index dddcd81d6c..cb0c1bf5d8 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -2186,7 +2186,7 @@ void prepare_line_to_destination() { // Move away from the endstop by the axis HOMING_BUMP_MM if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away: ", -bump, "mm"); - do_homing_move(axis, -bump, TERN(HOMING_Z_WITH_PROBE, (axis == Z_AXIS ? z_probe_fast_mm_s : 0), 0), false); + do_homing_move(axis, -bump, TERN0(HOMING_Z_WITH_PROBE, (axis == Z_AXIS ? z_probe_fast_mm_s : 0)), false); #if ENABLED(DETECT_BROKEN_ENDSTOP) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 0b236b8a10..6b4f63fb00 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1429,7 +1429,7 @@ void Planner::check_axes_activity() { */ void Planner::autotemp_update() { _autotemp_update_from_hotend(); - autotemp.factor = TERN(AUTOTEMP_PROPORTIONAL, AUTOTEMP_FACTOR_P, 0); + autotemp.factor = TERN0(AUTOTEMP_PROPORTIONAL, AUTOTEMP_FACTOR_P); autotemp.enabled = autotemp.factor != 0; } @@ -1445,7 +1445,7 @@ void Planner::check_axes_activity() { // When AUTOTEMP_PROPORTIONAL is enabled, F0 disables autotemp. // Normally, leaving off F also disables autotemp. - autotemp.factor = parser.seen('F') ? parser.value_float() : TERN(AUTOTEMP_PROPORTIONAL, AUTOTEMP_FACTOR_P, 0); + autotemp.factor = parser.seen('F') ? parser.value_float() : TERN0(AUTOTEMP_PROPORTIONAL, AUTOTEMP_FACTOR_P); autotemp.enabled = autotemp.factor != 0; } diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index f6a7705c3b..b08f8ccb7e 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2681,7 +2681,7 @@ hal_timer_t Stepper::block_phase_isr() { #if ENABLED(ADAPTIVE_STEP_SMOOTHING) // Nonlinear Extrusion needs at least 2x oversampling to permit increase of E step rate // Otherwise assume no axis smoothing (via oversampling) - oversampling_factor = TERN(NONLINEAR_EXTRUSION, 1, 0); + oversampling_factor = TERN0(NONLINEAR_EXTRUSION, 1); // Decide if axis smoothing is possible if (stepper.adaptive_step_smoothing_enabled) { diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 16d4a38e08..15cfeac911 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -43,7 +43,7 @@ //#define ERR_INCLUDE_TEMP -#define HOTEND_INDEX TERN(HAS_MULTI_HOTEND, e, 0) +#define HOTEND_INDEX TERN0(HAS_MULTI_HOTEND, e) #define E_NAME TERN_(HAS_MULTI_HOTEND, e) #if HAS_FAN