diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index d451f7246f..86a08afbff 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -38,7 +38,7 @@ #include "../../../gcode/gcode.h" #include "../../../libs/least_squares_fit.h" - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #include "../../../module/tool_change.h" #endif diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 37d82eec6a..77d0047a5c 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -366,11 +366,11 @@ void PrintJobRecovery::resume() { #endif // Restore all hotend temperatures - #if HOTENDS + #if HAS_HOTEND HOTEND_LOOP() { const int16_t et = info.target_temperature[e]; if (et) { - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND sprintf_P(cmd, PSTR("T%i"), e); gcode.process_subcommands_now(cmd); #endif @@ -517,7 +517,7 @@ void PrintJobRecovery::resume() { DEBUG_ECHOLNPAIR("active_extruder: ", int(info.active_extruder)); #endif - #if HOTENDS + #if HAS_HOTEND DEBUG_ECHOPGM("target_temperature: "); HOTEND_LOOP() { DEBUG_ECHO(info.target_temperature[e]); diff --git a/Marlin/src/feature/powerloss.h b/Marlin/src/feature/powerloss.h index 0496560785..34a26b6eb9 100644 --- a/Marlin/src/feature/powerloss.h +++ b/Marlin/src/feature/powerloss.h @@ -68,7 +68,7 @@ typedef struct { #endif #endif - #if HOTENDS + #if HAS_HOTEND int16_t target_temperature[HOTENDS]; #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index de69545983..f316b4a7a1 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -60,7 +60,7 @@ #include "../../../lcd/extui/ui_api.h" #endif -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND #include "../../../module/tool_change.h" #endif @@ -283,7 +283,7 @@ G29_TYPE GcodeSuite::G29() { */ if (!g29_in_progress) { - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND if (active_extruder != 0) tool_change(0); #endif diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 3437e33942..8c699b5fd3 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -27,7 +27,7 @@ #include "../../module/stepper.h" #include "../../module/endstops.h" -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND #include "../../module/tool_change.h" #endif @@ -285,7 +285,7 @@ void GcodeSuite::G28() { #endif // Always home with tool 0 active - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE) const uint8_t old_tool_index = active_extruder; #endif @@ -474,7 +474,7 @@ void GcodeSuite::G28() { restore_feedrate_and_scaling(); // Restore the active tool after homing - #if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)) + #if HAS_MULTI_HOTEND && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)) tool_change(old_tool_index, NONE(PARKING_EXTRUDER, DUAL_X_CARRIAGE)); // Do move if one of these #endif diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index ac2cdf7d4d..6f0f8a5562 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -35,7 +35,7 @@ #include "../../module/probe.h" #endif -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND #include "../../module/tool_change.h" #endif diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index d1b828d079..091619c6ff 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -32,7 +32,7 @@ #include "../../module/motion.h" #include "../../module/probe.h" -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND #include "../../module/tool_change.h" #endif @@ -124,7 +124,7 @@ void GcodeSuite::G34() { #endif // Always home with tool 0 active - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND const uint8_t old_tool_index = active_extruder; tool_change(0, true); #endif @@ -386,7 +386,7 @@ void GcodeSuite::G34() { #endif // Restore the active tool after homing - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER)); // Fetch previous tool for parking extruder #endif diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index 6ac3c70c48..b9dcc8f284 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -126,7 +126,7 @@ inline void park_above_object(measurements_t &m, const float uncertainty) { calibration_move(); } -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND inline void set_nozzle(measurements_t &m, const uint8_t extruder) { if (extruder != active_extruder) { park_above_object(m, CALIBRATION_MEASUREMENT_UNKNOWN); @@ -505,7 +505,7 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const TEMPORARY_BACKLASH_CORRECTION(all_on); TEMPORARY_BACKLASH_SMOOTHING(0.0f); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND set_nozzle(m, extruder); #else UNUSED(extruder); @@ -548,7 +548,7 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty) normalize_hotend_offsets(); #endif - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND set_nozzle(m, 0); #endif } @@ -582,7 +582,7 @@ inline void calibrate_all() { #endif // Cycle the toolheads so the servos settle into their "natural" positions - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND HOTEND_LOOP() set_nozzle(m, e); #endif diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 7adb08a4e6..ac44e832d6 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -466,6 +466,14 @@ #define E_MANUAL EXTRUDERS #endif +#if HOTENDS + #define HAS_HOTEND 1 + #if HOTENDS > 1 + #define HAS_MULTI_HOTEND 1 + #define HAS_HOTEND_OFFSET 1 + #endif +#endif + // Helper macros for extruder and hotend arrays #define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++) #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V) @@ -481,10 +489,6 @@ #define SWITCHING_NOZZLE_TWO_SERVOS 1 #endif -#if HOTENDS > 1 - #define HAS_HOTEND_OFFSET 1 -#endif - /** * Default hotend offsets, if not defined */ diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index ee41c4af67..48490b75a5 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -386,7 +386,7 @@ #endif #if !defined(PSU_POWERUP_DELAY) && ENABLED(PSU_CONTROL) - #define PSU_POWERUP_DELAY 100 + #define PSU_POWERUP_DELAY 250 #endif /** @@ -1255,94 +1255,238 @@ */ // Steppers -#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X))) -#define HAS_X_DIR (PIN_EXISTS(X_DIR)) -#define HAS_X_STEP (PIN_EXISTS(X_STEP)) -#define HAS_X_MICROSTEPS (PIN_EXISTS(X_MS1)) +#if PIN_EXISTS(X_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X)) + #define HAS_X_ENABLE 1 +#endif +#if PIN_EXISTS(X_DIR) + #define HAS_X_DIR 1 +#endif +#if PIN_EXISTS(X_STEP) + #define HAS_X_STEP 1 +#endif +#if PIN_EXISTS(X_MS1) + #define HAS_X_MICROSTEPS 1 +#endif -#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2))) -#define HAS_X2_DIR (PIN_EXISTS(X2_DIR)) -#define HAS_X2_STEP (PIN_EXISTS(X2_STEP)) -#define HAS_X2_MICROSTEPS (PIN_EXISTS(X2_MS1)) +#if PIN_EXISTS(X2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2)) + #define HAS_X2_ENABLE 1 +#endif +#if PIN_EXISTS(X2_DIR) + #define HAS_X2_DIR 1 +#endif +#if PIN_EXISTS(X2_STEP) + #define HAS_X2_STEP 1 +#endif +#if PIN_EXISTS(X2_MS1) + #define HAS_X2_MICROSTEPS 1 +#endif -#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y))) -#define HAS_Y_DIR (PIN_EXISTS(Y_DIR)) -#define HAS_Y_STEP (PIN_EXISTS(Y_STEP)) -#define HAS_Y_MICROSTEPS (PIN_EXISTS(Y_MS1)) +#if PIN_EXISTS(Y_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y)) + #define HAS_Y_ENABLE 1 +#endif +#if PIN_EXISTS(Y_DIR) + #define HAS_Y_DIR 1 +#endif +#if PIN_EXISTS(Y_STEP) + #define HAS_Y_STEP 1 +#endif +#if PIN_EXISTS(Y_MS1) + #define HAS_Y_MICROSTEPS 1 +#endif -#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2))) -#define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR)) -#define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP)) -#define HAS_Y2_MICROSTEPS (PIN_EXISTS(Y2_MS1)) +#if PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2)) + #define HAS_Y2_ENABLE 1 +#endif +#if PIN_EXISTS(Y2_DIR) + #define HAS_Y2_DIR 1 +#endif +#if PIN_EXISTS(Y2_STEP) + #define HAS_Y2_STEP 1 +#endif +#if PIN_EXISTS(Y2_MS1) + #define HAS_Y2_MICROSTEPS 1 +#endif -#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z))) -#define HAS_Z_DIR (PIN_EXISTS(Z_DIR)) -#define HAS_Z_STEP (PIN_EXISTS(Z_STEP)) -#define HAS_Z_MICROSTEPS (PIN_EXISTS(Z_MS1)) +#if PIN_EXISTS(Z_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z)) + #define HAS_Z_ENABLE 1 +#endif +#if PIN_EXISTS(Z_DIR) + #define HAS_Z_DIR 1 +#endif +#if PIN_EXISTS(Z_STEP) + #define HAS_Z_STEP 1 +#endif +#if PIN_EXISTS(Z_MS1) + #define HAS_Z_MICROSTEPS 1 +#endif -#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2))) -#define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR)) -#define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP)) -#define HAS_Z2_MICROSTEPS (PIN_EXISTS(Z2_MS1)) +#if PIN_EXISTS(Z2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)) + #define HAS_Z2_ENABLE 1 +#endif +#if PIN_EXISTS(Z2_DIR) + #define HAS_Z2_DIR 1 +#endif +#if PIN_EXISTS(Z2_STEP) + #define HAS_Z2_STEP 1 +#endif +#if PIN_EXISTS(Z2_MS1) + #define HAS_Z2_MICROSTEPS 1 +#endif -#define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3))) -#define HAS_Z3_DIR (PIN_EXISTS(Z3_DIR)) -#define HAS_Z3_STEP (PIN_EXISTS(Z3_STEP)) -#define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1)) +#if PIN_EXISTS(Z3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3)) + #define HAS_Z3_ENABLE 1 +#endif +#if PIN_EXISTS(Z3_DIR) + #define HAS_Z3_DIR 1 +#endif +#if PIN_EXISTS(Z3_STEP) + #define HAS_Z3_STEP 1 +#endif +#if PIN_EXISTS(Z3_MS1) + #define HAS_Z3_MICROSTEPS 1 +#endif -#define HAS_Z4_ENABLE (PIN_EXISTS(Z4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z4))) -#define HAS_Z4_DIR (PIN_EXISTS(Z4_DIR)) -#define HAS_Z4_STEP (PIN_EXISTS(Z4_STEP)) -#define HAS_Z4_MICROSTEPS (PIN_EXISTS(Z4_MS1)) +#if PIN_EXISTS(Z4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z4)) + #define HAS_Z4_ENABLE 1 +#endif +#if PIN_EXISTS(Z4_DIR) + #define HAS_Z4_DIR 1 +#endif +#if PIN_EXISTS(Z4_STEP) + #define HAS_Z4_STEP 1 +#endif +#if PIN_EXISTS(Z4_MS1) + #define HAS_Z4_MICROSTEPS 1 +#endif // Extruder steppers and solenoids -#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0))) -#define HAS_E0_DIR (PIN_EXISTS(E0_DIR)) -#define HAS_E0_STEP (PIN_EXISTS(E0_STEP)) -#define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1)) -#define HAS_SOLENOID_0 (PIN_EXISTS(SOL0)) +#if PIN_EXISTS(E0_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)) + #define HAS_E0_ENABLE 1 +#endif +#if PIN_EXISTS(E0_DIR) + #define HAS_E0_DIR 1 +#endif +#if PIN_EXISTS(E0_STEP) + #define HAS_E0_STEP 1 +#endif +#if PIN_EXISTS(E0_MS1) + #define HAS_E0_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL0) + #define HAS_SOLENOID_0 1 +#endif -#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1))) -#define HAS_E1_DIR (PIN_EXISTS(E1_DIR)) -#define HAS_E1_STEP (PIN_EXISTS(E1_STEP)) -#define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1)) -#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1)) +#if PIN_EXISTS(E1_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)) + #define HAS_E1_ENABLE 1 +#endif +#if PIN_EXISTS(E1_DIR) + #define HAS_E1_DIR 1 +#endif +#if PIN_EXISTS(E1_STEP) + #define HAS_E1_STEP 1 +#endif +#if PIN_EXISTS(E1_MS1) + #define HAS_E1_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL1) + #define HAS_SOLENOID_1 1 +#endif -#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2))) -#define HAS_E2_DIR (PIN_EXISTS(E2_DIR)) -#define HAS_E2_STEP (PIN_EXISTS(E2_STEP)) -#define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1)) -#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2)) +#if PIN_EXISTS(E2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)) + #define HAS_E2_ENABLE 1 +#endif +#if PIN_EXISTS(E2_DIR) + #define HAS_E2_DIR 1 +#endif +#if PIN_EXISTS(E2_STEP) + #define HAS_E2_STEP 1 +#endif +#if PIN_EXISTS(E2_MS1) + #define HAS_E2_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL2) + #define HAS_SOLENOID_2 1 +#endif -#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3))) -#define HAS_E3_DIR (PIN_EXISTS(E3_DIR)) -#define HAS_E3_STEP (PIN_EXISTS(E3_STEP)) -#define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1)) -#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3)) +#if PIN_EXISTS(E3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)) + #define HAS_E3_ENABLE 1 +#endif +#if PIN_EXISTS(E3_DIR) + #define HAS_E3_DIR 1 +#endif +#if PIN_EXISTS(E3_STEP) + #define HAS_E3_STEP 1 +#endif +#if PIN_EXISTS(E3_MS1) + #define HAS_E3_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL3) + #define HAS_SOLENOID_3 1 +#endif -#define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4))) -#define HAS_E4_DIR (PIN_EXISTS(E4_DIR)) -#define HAS_E4_STEP (PIN_EXISTS(E4_STEP)) -#define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1)) -#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4)) +#if PIN_EXISTS(E4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)) + #define HAS_E4_ENABLE 1 +#endif +#if PIN_EXISTS(E4_DIR) + #define HAS_E4_DIR 1 +#endif +#if PIN_EXISTS(E4_STEP) + #define HAS_E4_STEP 1 +#endif +#if PIN_EXISTS(E4_MS1) + #define HAS_E4_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL4) + #define HAS_SOLENOID_4 1 +#endif -#define HAS_E5_ENABLE (PIN_EXISTS(E5_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5))) -#define HAS_E5_DIR (PIN_EXISTS(E5_DIR)) -#define HAS_E5_STEP (PIN_EXISTS(E5_STEP)) -#define HAS_E5_MICROSTEPS (PIN_EXISTS(E5_MS1)) -#define HAS_SOLENOID_5 (PIN_EXISTS(SOL5)) +#if PIN_EXISTS(E5_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)) + #define HAS_E5_ENABLE 1 +#endif +#if PIN_EXISTS(E5_DIR) + #define HAS_E5_DIR 1 +#endif +#if PIN_EXISTS(E5_STEP) + #define HAS_E5_STEP 1 +#endif +#if PIN_EXISTS(E5_MS1) + #define HAS_E5_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL5) + #define HAS_SOLENOID_5 1 +#endif -#define HAS_E6_ENABLE (PIN_EXISTS(E6_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E6))) -#define HAS_E6_DIR (PIN_EXISTS(E6_DIR)) -#define HAS_E6_STEP (PIN_EXISTS(E6_STEP)) -#define HAS_E6_MICROSTEPS (PIN_EXISTS(E6_MS1)) -#define HAS_SOLENOID_6 (PIN_EXISTS(SOL6)) +#if PIN_EXISTS(E6_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E6)) + #define HAS_E6_ENABLE 1 +#endif +#if PIN_EXISTS(E6_DIR) + #define HAS_E6_DIR 1 +#endif +#if PIN_EXISTS(E6_STEP) + #define HAS_E6_STEP 1 +#endif +#if PIN_EXISTS(E6_MS1) + #define HAS_E6_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL6) + #define HAS_SOLENOID_6 1 +#endif -#define HAS_E7_ENABLE (PIN_EXISTS(E7_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E7))) -#define HAS_E7_DIR (PIN_EXISTS(E7_DIR)) -#define HAS_E7_STEP (PIN_EXISTS(E7_STEP)) -#define HAS_E7_MICROSTEPS (PIN_EXISTS(E7_MS1)) -#define HAS_SOLENOID_7 (PIN_EXISTS(SOL7)) +#if PIN_EXISTS(E7_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E7)) + #define HAS_E7_ENABLE 1 +#endif +#if PIN_EXISTS(E7_DIR) + #define HAS_E7_DIR 1 +#endif +#if PIN_EXISTS(E7_STEP) + #define HAS_E7_STEP 1 +#endif +#if PIN_EXISTS(E7_MS1) + #define HAS_E7_MICROSTEPS 1 +#endif +#if PIN_EXISTS(SOL7) + #define HAS_SOLENOID_7 1 +#endif // Trinamic Stepper Drivers #if HAS_TRINAMIC_CONFIG @@ -1405,62 +1549,146 @@ #define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_) #define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M)) -#define HAS_X_MIN _HAS_STOP(X,MIN) -#define HAS_X_MAX _HAS_STOP(X,MAX) -#define HAS_Y_MIN _HAS_STOP(Y,MIN) -#define HAS_Y_MAX _HAS_STOP(Y,MAX) -#define HAS_Z_MIN _HAS_STOP(Z,MIN) -#define HAS_Z_MAX _HAS_STOP(Z,MAX) -#define HAS_X2_MIN (PIN_EXISTS(X2_MIN)) -#define HAS_X2_MAX (PIN_EXISTS(X2_MAX)) -#define HAS_Y2_MIN (PIN_EXISTS(Y2_MIN)) -#define HAS_Y2_MAX (PIN_EXISTS(Y2_MAX)) -#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN)) -#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX)) -#define HAS_Z3_MIN (PIN_EXISTS(Z3_MIN)) -#define HAS_Z3_MAX (PIN_EXISTS(Z3_MAX)) -#define HAS_Z4_MIN (PIN_EXISTS(Z4_MIN)) -#define HAS_Z4_MAX (PIN_EXISTS(Z4_MAX)) -#define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE)) +#if _HAS_STOP(X,MIN) + #define HAS_X_MIN 1 +#endif +#if _HAS_STOP(X,MAX) + #define HAS_X_MAX 1 +#endif +#if _HAS_STOP(Y,MIN) + #define HAS_Y_MIN 1 +#endif +#if _HAS_STOP(Y,MAX) + #define HAS_Y_MAX 1 +#endif +#if _HAS_STOP(Z,MIN) + #define HAS_Z_MIN 1 +#endif +#if _HAS_STOP(Z,MAX) + #define HAS_Z_MAX 1 +#endif +#if PIN_EXISTS(X2_MIN) + #define HAS_X2_MIN 1 +#endif +#if PIN_EXISTS(X2_MAX) + #define HAS_X2_MAX 1 +#endif +#if PIN_EXISTS(Y2_MIN) + #define HAS_Y2_MIN 1 +#endif +#if PIN_EXISTS(Y2_MAX) + #define HAS_Y2_MAX 1 +#endif +#if PIN_EXISTS(Z2_MIN) + #define HAS_Z2_MIN 1 +#endif +#if PIN_EXISTS(Z2_MAX) + #define HAS_Z2_MAX 1 +#endif +#if PIN_EXISTS(Z3_MIN) + #define HAS_Z3_MIN 1 +#endif +#if PIN_EXISTS(Z3_MAX) + #define HAS_Z3_MAX 1 +#endif +#if PIN_EXISTS(Z4_MIN) + #define HAS_Z4_MIN 1 +#endif +#if PIN_EXISTS(Z4_MAX) + #define HAS_Z4_MAX 1 +#endif +#if HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE) + #define HAS_Z_MIN_PROBE_PIN 1 +#endif // // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface) // #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675)) -#define HAS_TEMP_ADC_0 HAS_ADC_TEST(0) -#define HAS_TEMP_ADC_1 HAS_ADC_TEST(1) -#define HAS_TEMP_ADC_2 HAS_ADC_TEST(2) -#define HAS_TEMP_ADC_3 HAS_ADC_TEST(3) -#define HAS_TEMP_ADC_4 HAS_ADC_TEST(4) -#define HAS_TEMP_ADC_5 HAS_ADC_TEST(5) -#define HAS_TEMP_ADC_6 HAS_ADC_TEST(6) -#define HAS_TEMP_ADC_7 HAS_ADC_TEST(7) -#define HAS_TEMP_ADC_BED HAS_ADC_TEST(BED) -#define HAS_TEMP_ADC_PROBE HAS_ADC_TEST(PROBE) -#define HAS_TEMP_ADC_CHAMBER HAS_ADC_TEST(CHAMBER) +#if HAS_ADC_TEST(0) + #define HAS_TEMP_ADC_0 1 +#endif +#if HAS_ADC_TEST(1) + #define HAS_TEMP_ADC_1 1 +#endif +#if HAS_ADC_TEST(2) + #define HAS_TEMP_ADC_2 1 +#endif +#if HAS_ADC_TEST(3) + #define HAS_TEMP_ADC_3 1 +#endif +#if HAS_ADC_TEST(4) + #define HAS_TEMP_ADC_4 1 +#endif +#if HAS_ADC_TEST(5) + #define HAS_TEMP_ADC_5 1 +#endif +#if HAS_ADC_TEST(6) + #define HAS_TEMP_ADC_6 1 +#endif +#if HAS_ADC_TEST(7) + #define HAS_TEMP_ADC_7 1 +#endif +#if HAS_ADC_TEST(BED) + #define HAS_TEMP_ADC_BED 1 +#endif +#if HAS_ADC_TEST(PROBE) + #define HAS_TEMP_ADC_PROBE 1 +#endif +#if HAS_ADC_TEST(CHAMBER) + #define HAS_TEMP_ADC_CHAMBER 1 +#endif -#define HAS_TEMP_HOTEND ((HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)) && HOTENDS) +#if HOTENDS && (HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)) + #define HAS_TEMP_HOTEND 1 +#endif #define HAS_TEMP_BED HAS_TEMP_ADC_BED #define HAS_TEMP_PROBE HAS_TEMP_ADC_PROBE #define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER #if ENABLED(JOYSTICK) - #define HAS_JOY_ADC_X PIN_EXISTS(JOY_X) - #define HAS_JOY_ADC_Y PIN_EXISTS(JOY_Y) - #define HAS_JOY_ADC_Z PIN_EXISTS(JOY_Z) - #define HAS_JOY_ADC_EN PIN_EXISTS(JOY_EN) + #if PIN_EXISTS(JOY_X) + #define HAS_JOY_ADC_X 1 +#endif + #if PIN_EXISTS(JOY_Y) + #define HAS_JOY_ADC_Y 1 +#endif + #if PIN_EXISTS(JOY_Z) + #define HAS_JOY_ADC_Z 1 +#endif + #if PIN_EXISTS(JOY_EN) + #define HAS_JOY_ADC_EN 1 +#endif #endif // Heaters -#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) -#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1)) -#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2)) -#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3)) -#define HAS_HEATER_4 (PIN_EXISTS(HEATER_4)) -#define HAS_HEATER_5 (PIN_EXISTS(HEATER_5)) -#define HAS_HEATER_6 (PIN_EXISTS(HEATER_6)) -#define HAS_HEATER_7 (PIN_EXISTS(HEATER_7)) -#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) +#if PIN_EXISTS(HEATER_0) + #define HAS_HEATER_0 1 +#endif +#if PIN_EXISTS(HEATER_1) + #define HAS_HEATER_1 1 +#endif +#if PIN_EXISTS(HEATER_2) + #define HAS_HEATER_2 1 +#endif +#if PIN_EXISTS(HEATER_3) + #define HAS_HEATER_3 1 +#endif +#if PIN_EXISTS(HEATER_4) + #define HAS_HEATER_4 1 +#endif +#if PIN_EXISTS(HEATER_5) + #define HAS_HEATER_5 1 +#endif +#if PIN_EXISTS(HEATER_6) + #define HAS_HEATER_6 1 +#endif +#if PIN_EXISTS(HEATER_7) + #define HAS_HEATER_7 1 +#endif +#if PIN_EXISTS(HEATER_BED) + #define HAS_HEATER_BED 1 +#endif // Shorthand for common combinations #if HAS_TEMP_BED && HAS_HEATER_BED @@ -1507,15 +1735,33 @@ #endif // Auto fans -#define HAS_AUTO_FAN_0 (HOTENDS > 0 && PIN_EXISTS(E0_AUTO_FAN)) -#define HAS_AUTO_FAN_1 (HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN)) -#define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN)) -#define HAS_AUTO_FAN_3 (HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN)) -#define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN)) -#define HAS_AUTO_FAN_5 (HOTENDS > 5 && PIN_EXISTS(E5_AUTO_FAN)) -#define HAS_AUTO_FAN_6 (HOTENDS > 6 && PIN_EXISTS(E6_AUTO_FAN)) -#define HAS_AUTO_FAN_7 (HOTENDS > 7 && PIN_EXISTS(E7_AUTO_FAN)) -#define HAS_AUTO_CHAMBER_FAN (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_AUTO_FAN)) +#if HAS_HOTEND && PIN_EXISTS(E0_AUTO_FAN) + #define HAS_AUTO_FAN_0 1 +#endif +#if HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN) + #define HAS_AUTO_FAN_1 1 +#endif +#if HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN) + #define HAS_AUTO_FAN_2 1 +#endif +#if HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN) + #define HAS_AUTO_FAN_3 1 +#endif +#if HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN) + #define HAS_AUTO_FAN_4 1 +#endif +#if HOTENDS > 5 && PIN_EXISTS(E5_AUTO_FAN) + #define HAS_AUTO_FAN_5 1 +#endif +#if HOTENDS > 6 && PIN_EXISTS(E6_AUTO_FAN) + #define HAS_AUTO_FAN_6 1 +#endif +#if HOTENDS > 7 && PIN_EXISTS(E7_AUTO_FAN) + #define HAS_AUTO_FAN_7 1 +#endif +#if HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_AUTO_FAN) + #define HAS_AUTO_CHAMBER_FAN 1 +#endif #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_FAN_6 || HAS_AUTO_FAN_7 || HAS_AUTO_CHAMBER_FAN) #define _FANOVERLAP(A,B) (A##_AUTO_FAN_PIN == E##B##_AUTO_FAN_PIN) @@ -1535,24 +1781,52 @@ // Other fans #define HAS_FAN0 (PIN_EXISTS(FAN)) #define _HAS_FAN(P) (PIN_EXISTS(FAN##P) && CONTROLLER_FAN_PIN != FAN##P##_PIN && E0_AUTO_FAN_PIN != FAN##P##_PIN && E1_AUTO_FAN_PIN != FAN##P##_PIN && E2_AUTO_FAN_PIN != FAN##P##_PIN && E3_AUTO_FAN_PIN != FAN##P##_PIN && E4_AUTO_FAN_PIN != FAN##P##_PIN && E5_AUTO_FAN_PIN != FAN##P##_PIN && E6_AUTO_FAN_PIN != FAN##P##_PIN && E7_AUTO_FAN_PIN != FAN##P##_PIN) -#define HAS_FAN1 _HAS_FAN(1) -#define HAS_FAN2 _HAS_FAN(2) -#define HAS_FAN3 _HAS_FAN(3) -#define HAS_FAN4 _HAS_FAN(4) -#define HAS_FAN5 _HAS_FAN(5) -#define HAS_FAN6 _HAS_FAN(6) -#define HAS_FAN7 _HAS_FAN(7) -#define HAS_CONTROLLER_FAN (PIN_EXISTS(CONTROLLER_FAN)) +#if _HAS_FAN(1) + #define HAS_FAN1 1 +#endif +#if _HAS_FAN(2) + #define HAS_FAN2 1 +#endif +#if _HAS_FAN(3) + #define HAS_FAN3 1 +#endif +#if _HAS_FAN(4) + #define HAS_FAN4 1 +#endif +#if _HAS_FAN(5) + #define HAS_FAN5 1 +#endif +#if _HAS_FAN(6) + #define HAS_FAN6 1 +#endif +#if _HAS_FAN(7) + #define HAS_FAN7 1 +#endif +#if PIN_EXISTS(CONTROLLER_FAN) + #define HAS_CONTROLLER_FAN 1 +#endif // Servos -#define HAS_SERVO_0 (PIN_EXISTS(SERVO0) && NUM_SERVOS > 0) -#define HAS_SERVO_1 (PIN_EXISTS(SERVO1) && NUM_SERVOS > 1) -#define HAS_SERVO_2 (PIN_EXISTS(SERVO2) && NUM_SERVOS > 2) -#define HAS_SERVO_3 (PIN_EXISTS(SERVO3) && NUM_SERVOS > 3) -#define HAS_SERVOS (NUM_SERVOS > 0) +#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0 + #define HAS_SERVO_0 1 +#endif +#if PIN_EXISTS(SERVO1) && NUM_SERVOS > 1 + #define HAS_SERVO_1 1 +#endif +#if PIN_EXISTS(SERVO2) && NUM_SERVOS > 2 + #define HAS_SERVO_2 1 +#endif +#if PIN_EXISTS(SERVO3) && NUM_SERVOS > 3 + #define HAS_SERVO_3 1 +#endif +#if NUM_SERVOS > 0 + #define HAS_SERVOS 1 +#endif // Sensors -#define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH)) +#if PIN_EXISTS(FILWIDTH) + #define HAS_FILAMENT_WIDTH_SENSOR 1 +#endif // User Interface #if PIN_EXISTS(HOME) @@ -1638,14 +1912,30 @@ #endif #endif - #define HAS_MICROSTEP1 defined(MICROSTEP1) - #define HAS_MICROSTEP2 defined(MICROSTEP2) - #define HAS_MICROSTEP4 defined(MICROSTEP4) - #define HAS_MICROSTEP8 defined(MICROSTEP8) - #define HAS_MICROSTEP16 defined(MICROSTEP16) - #define HAS_MICROSTEP32 defined(MICROSTEP32) - #define HAS_MICROSTEP64 defined(MICROSTEP64) - #define HAS_MICROSTEP128 defined(MICROSTEP128) + #ifdef MICROSTEP1 + #define HAS_MICROSTEP1 1 + #endif + #ifdef MICROSTEP2 + #define HAS_MICROSTEP2 1 + #endif + #ifdef MICROSTEP4 + #define HAS_MICROSTEP4 1 + #endif + #ifdef MICROSTEP8 + #define HAS_MICROSTEP8 1 + #endif + #ifdef MICROSTEP16 + #define HAS_MICROSTEP16 1 + #endif + #ifdef MICROSTEP32 + #define HAS_MICROSTEP32 1 + #endif + #ifdef MICROSTEP64 + #define HAS_MICROSTEP64 1 + #endif + #ifdef MICROSTEP128 + #define HAS_MICROSTEP128 1 + #endif #endif // HAS_MICROSTEPS @@ -1896,8 +2186,12 @@ #undef NO_FAN_SLOWING_IN_PID_TUNING #endif -#define QUIET_PROBING (HAS_BED_PROBE && (EITHER(PROBING_HEATERS_OFF, PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0)) -#define HEATER_IDLE_HANDLER EITHER(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF) +#if HAS_BED_PROBE && (EITHER(PROBING_HEATERS_OFF, PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0) + #define QUIET_PROBING 1 +#endif +#if EITHER(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF) + #define HEATER_IDLE_HANDLER 1 +#endif #if ENABLED(ADVANCED_PAUSE_FEATURE) && !defined(FILAMENT_CHANGE_SLOW_LOAD_LENGTH) #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 1b2f7fd2fb..fd81f8e4f6 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1591,11 +1591,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board." #elif HOTENDS && !HAS_TEMP_HOTEND #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board." -#elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1 +#elif (HAS_MULTI_HOTEND || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1 #error "HEATER_1_PIN not defined for this board." #endif -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND #if ENABLED(HEATER_1_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS2) #error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board." #elif TEMP_SENSOR_1 == 0 diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp index 3c89d1803c..905a72b053 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp @@ -745,7 +745,7 @@ void MarlinUI::draw_status_screen() { // // Hotend 1 or Bed Temperature // - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND lcd_moveto(8, 0); _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink); #elif HAS_HEATED_BED @@ -763,7 +763,7 @@ void MarlinUI::draw_status_screen() { // // Hotend 1 or Bed Temperature // - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND lcd_moveto(10, 0); _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink); #elif HAS_HEATED_BED @@ -791,7 +791,7 @@ void MarlinUI::draw_status_screen() { // If the first line has two extruder temps, // show more temperatures on the next line - #if HOTENDS > 2 || (HOTENDS > 1 && HAS_HEATED_BED) + #if HOTENDS > 2 || (HAS_MULTI_HOTEND && HAS_HEATED_BED) #if HOTENDS > 2 _draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink); @@ -924,7 +924,7 @@ void MarlinUI::draw_status_screen() { lcd_moveto(LCD_WIDTH - 9, 0); _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink); - #if HAS_LEVELING && (HOTENDS > 1 || !HAS_HEATED_BED) + #if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED) lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' '); #endif @@ -934,7 +934,7 @@ void MarlinUI::draw_status_screen() { // Hotend 1 or Bed Temperature // lcd_moveto(0, 1); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink); #elif HAS_HEATED_BED _draw_bed_status(blink); @@ -952,7 +952,7 @@ void MarlinUI::draw_status_screen() { lcd_moveto(0, 2); #if HOTENDS > 2 _draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink); - #elif HOTENDS > 1 && HAS_HEATED_BED + #elif HAS_MULTI_HOTEND && HAS_HEATED_BED _draw_bed_status(blink); #elif HAS_PRINT_PROGRESS #define DREW_PRINT_PROGRESS @@ -1077,7 +1077,7 @@ void MarlinUI::draw_status_screen() { if (thermalManager.degTargetBed() > 0) leds |= LED_A; #endif - #if HOTENDS + #if HAS_HOTEND if (thermalManager.degTargetHotend(0) > 0) leds |= LED_B; #endif @@ -1110,7 +1110,7 @@ void MarlinUI::draw_status_screen() { ) leds |= LED_C; #endif // FAN_COUNT > 0 - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND if (thermalManager.degTargetHotend(1) > 0) leds |= LED_C; #endif diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index 8295e9e058..741f07330f 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -278,7 +278,7 @@ // // Status Screen Hotends bitmaps // - #if HOTENDS + #if HAS_HOTEND #define STATUS_HOTEND1_WIDTH 16 @@ -1343,7 +1343,7 @@ #undef STATUS_LOGO_WIDTH #endif - #if (HOTENDS > 1 && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN) + #if (HAS_MULTI_HOTEND && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN) #define _STATUS_HEATERS_X(H,S,N) ((LCD_PIXEL_WIDTH - (H * (S + N)) - (_EXTRA_WIDTH) + (STATUS_LOGO_WIDTH)) / 2) #if STATUS_HOTEND1_WIDTH #if HOTENDS > 2 @@ -1474,7 +1474,7 @@ constexpr uint8_t status_hotend_x[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_X, STATUS_HOTEND2_X, STATUS_HOTEND3_X, STATUS_HOTEND4_X, STATUS_HOTEND5_X, STATUS_HOTEND6_X); #define STATUS_HOTEND_X(N) status_hotend_x[N] - #elif HOTENDS > 1 + #elif HAS_MULTI_HOTEND #define STATUS_HOTEND_X(N) ((N) ? STATUS_HOTEND2_X : STATUS_HOTEND1_X) #else #define STATUS_HOTEND_X(N) STATUS_HOTEND1_X diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index e623776b31..64c6711fe8 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -431,7 +431,7 @@ void ST7920_Lite_Status_Screen::draw_static_elements() { // Draw the static icons in GDRAM draw_gdram_icon(0, 0, nozzle_icon); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND draw_gdram_icon(0, 1, nozzle_icon); draw_gdram_icon(0, 2, bed_icon); #else @@ -584,7 +584,7 @@ void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const i #if HAS_HEATED_BED void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) { const bool show_target = target && FAR(temp, target); - draw_temps(HOTENDS > 1 ? 2 : 1, temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate); + draw_temps(HAS_MULTI_HOTEND ? 2 : 1, temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate); display_state.bed_show_target = show_target; } #endif @@ -704,7 +704,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { const uint16_t feedrate_perc = feedrate_percentage; const uint16_t fs = thermalManager.scaledFanSpeed(0); const int16_t extruder_1_target = thermalManager.degTargetHotend(0); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND const int16_t extruder_2_target = thermalManager.degTargetHotend(1); #endif #if HAS_HEATED_BED @@ -731,7 +731,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { const uint16_t feedrate_perc = feedrate_percentage; const int16_t extruder_1_temp = thermalManager.degHotend(0), extruder_1_target = thermalManager.degTargetHotend(0); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND const int16_t extruder_2_temp = thermalManager.degHotend(1), extruder_2_target = thermalManager.degTargetHotend(1); #endif @@ -741,7 +741,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { #endif draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate); #endif #if HAS_HEATED_BED diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp index c5f69504d4..e625325d44 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp @@ -115,7 +115,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { ) .tag(14).button( TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS)) .enabled( - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND 1 #endif ) @@ -157,7 +157,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { case 2: GOTO_SCREEN(ZOffsetScreen); break; #endif case 3: GOTO_SCREEN(StepsScreen); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case 4: GOTO_SCREEN(NozzleOffsetScreen); break; #endif case 5: GOTO_SCREEN(MaxVelocityScreen); break; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp index ed8bcee557..d2c5c6658c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp @@ -58,7 +58,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(4) .button( BTN_POS(1,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_HOMING_THRS)) .tag(5) .button( BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_LCD_ENDSTOPS)) .enabled( - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND 1 #endif ) @@ -105,7 +105,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { case 4: GOTO_SCREEN(StepperBumpSensitivityScreen); break; #endif case 5: GOTO_SCREEN(EndstopStatesScreen); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case 6: GOTO_SCREEN(NozzleOffsetScreen); break; #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp index 2b5963fdf6..a013949814 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp @@ -172,8 +172,8 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { const bool tog3 = screen_data.ChangeFilamentScreen.t_tag == 3; const bool tog4 = screen_data.ChangeFilamentScreen.t_tag == 4; const bool tog10 = screen_data.ChangeFilamentScreen.e_tag == 10; - #if HOTENDS > 1 - const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11; + #if HAS_MULTI_HOTEND + const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11; #endif #ifdef TOUCH_UI_PORTRAIT diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp index ae224e9c11..9ac402e197 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp @@ -22,7 +22,7 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && HOTENDS > 1 +#if ENABLED(TOUCH_UI_FTDI_EVE) && HAS_MULTI_HOTEND #include "screens.h" diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp index d9910ffa04..0865b8ccbc 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp @@ -72,7 +72,7 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) { w.text_field(0, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), str); #endif - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND format_position(str, getNozzleOffset_mm(X, E1), getNozzleOffset_mm(Y, E1), getNozzleOffset_mm(Z, E1)); w.text_field(0, GET_TEXT_F(MSG_OFFSETS_MENU), str); #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp index 5f59843bbe..53d9d7a5ba 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp @@ -68,7 +68,7 @@ SCREEN_TABLE { #if HAS_BED_PROBE DECL_SCREEN(ZOffsetScreen), #endif -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND DECL_SCREEN(NozzleOffsetScreen), #endif #if ENABLED(BACKLASH_GCODE) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h index 06f64d38cb..c659f50fc1 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h @@ -514,7 +514,7 @@ class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen 1 +#if HAS_MULTI_HOTEND class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen { public: static void onEntry(); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp index 81cde5a341..4025d16bbd 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp @@ -78,7 +78,7 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) { case 2: UI_DECREMENT(TargetTemp_celsius, E0); break; case 3: UI_INCREMENT(TargetTemp_celsius, E0); break; #endif - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case 4: UI_DECREMENT(TargetTemp_celsius, E1); break; case 5: UI_INCREMENT(TargetTemp_celsius, E1); break; #endif diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index b5f94539fe..55ae020616 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -192,7 +192,7 @@ namespace ExtUI { case CHAMBER: return; // Chamber has no idle timer #endif default: - #if HOTENDS + #if HAS_HOTEND thermalManager.reset_hotend_idle_timer(heater - H0); #endif break; @@ -258,7 +258,7 @@ namespace ExtUI { case CHAMBER: return false; // Chamber has no idle timer #endif default: - #if HOTENDS + #if HAS_HOTEND return thermalManager.hotend_idle[heater - H0].timed_out; #else return false; @@ -985,7 +985,7 @@ namespace ExtUI { else #endif { - #if HOTENDS + #if HAS_HOTEND static constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP); const int16_t e = heater - H0; thermalManager.setTargetHotend(LROUND(constrain(value, 0, heater_maxtemp[e] - 15)), e); @@ -997,7 +997,7 @@ namespace ExtUI { #ifdef TOUCH_UI_LCD_TEMP_SCALING value *= TOUCH_UI_LCD_TEMP_SCALING; #endif - #if HOTENDS + #if HAS_HOTEND constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP); const int16_t e = extruder - E0; enableHeater(extruder); diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 5d4b655167..5f3e6d965a 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -29,7 +29,7 @@ extern int8_t encoderLine, encoderTopLine, screen_items; -#if HOTENDS +#if HAS_HOTEND constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP); #endif diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index ac755af7c4..f0bbfdfed1 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -233,9 +233,9 @@ void menu_cancelobject(); #define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N); #endif -#if HOTENDS +#if HAS_HOTEND DEFINE_PIDTEMP_FUNCS(0); - #if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND) + #if HAS_MULTI_HOTEND && ENABLED(PID_PARAMS_PER_HOTEND) REPEAT_S(1, HOTENDS, DEFINE_PIDTEMP_FUNCS) #endif #endif @@ -308,7 +308,7 @@ void menu_cancelobject(); #endif PID_EDIT_MENU_ITEMS(0); - #if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND) + #if HAS_MULTI_HOTEND && ENABLED(PID_PARAMS_PER_HOTEND) REPEAT_S(1, HOTENDS, PID_EDIT_MENU_ITEMS) #endif diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index b00a3d964a..5229093fd6 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -48,7 +48,7 @@ uint8_t MarlinUI::preheat_fan_speed[2]; // void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) { - #if HOTENDS + #if HAS_HOTEND if (temph > 0) thermalManager.setTargetHotend(_MIN(heater_maxtemp[endnum] - 15, temph), endnum); #endif #if HAS_HEATED_BED @@ -107,7 +107,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb #else ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); }); #endif - #elif HOTENDS > 1 + #elif HAS_MULTI_HOTEND #if HAS_HEATED_BED _PREHEAT_ITEMS(1,0); #endif @@ -118,7 +118,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb #endif HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], e); }); - #endif // HOTENDS > 1 + #endif // HAS_MULTI_HOTEND #if HAS_HEATED_BED ACTION_ITEM(MSG_PREHEAT_1_BEDONLY, []{ _preheat_bed(0); }); #endif @@ -135,7 +135,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb #else ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 0); }); #endif - #elif HOTENDS > 1 + #elif HAS_MULTI_HOTEND #if HAS_HEATED_BED _PREHEAT_ITEMS(2,0); #endif @@ -146,7 +146,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb #endif HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], e); }); - #endif // HOTENDS > 1 + #endif // HAS_MULTI_HOTEND #if HAS_HEATED_BED ACTION_ITEM(MSG_PREHEAT_2_BEDONLY, []{ _preheat_bed(1); }); #endif @@ -171,7 +171,7 @@ void menu_temperature() { // #if HOTENDS == 1 EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(0); }); - #elif HOTENDS > 1 + #elif HAS_MULTI_HOTEND HOTEND_LOOP() EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, heater_maxtemp[e] - 15, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); #endif diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index ac18e89df4..a36f6afc90 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -127,7 +127,7 @@ void menu_tune() { // #if HOTENDS == 1 EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(0); }); - #elif HOTENDS > 1 + #elif HAS_MULTI_HOTEND HOTEND_LOOP() EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, heater_maxtemp[e] - 15, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); #endif diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 0211c303eb..cdc4432a53 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -3194,7 +3194,7 @@ void MarlinSettings::reset() { HOTEND_LOOP() { CONFIG_ECHO_START(); SERIAL_ECHOPAIR_P( - #if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND) + #if HAS_MULTI_HOTEND && ENABLED(PID_PARAMS_PER_HOTEND) PSTR(" M301 E"), e, SP_P_STR #else diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 650cda51f3..0ca7535ec7 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -140,7 +140,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, bool Temperature::adaptive_fan_slowing = true; #endif -#if HOTENDS +#if HAS_HOTEND hotend_info_t Temperature::temp_hotend[HOTEND_TEMPS]; // = { 0 } #endif @@ -298,7 +298,7 @@ volatile bool Temperature::raw_temps_ready = false; #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) < (HEATER_##N##_RAW_HI_TEMP) ? 1 : -1) -#if HOTENDS +#if HAS_HOTEND // Init mintemp and maxtemp with extreme values to prevent false errors during startup constexpr temp_range_t sensor_heater_0 { HEATER_0_RAW_LO_TEMP, HEATER_0_RAW_HI_TEMP, 0, 16383 }, sensor_heater_1 { HEATER_1_RAW_LO_TEMP, HEATER_1_RAW_HI_TEMP, 0, 16383 }, @@ -655,7 +655,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { #endif default: return (0 - #if HOTENDS + #if HAS_HOTEND + temp_hotend[heater_id].soft_pwm_amount #endif ); @@ -672,7 +672,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { #define _EFAN(B,A) _EFANOVERLAP(A,B) ? B : static const uint8_t fanBit[] PROGMEM = { 0 - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #define _NEXT_FAN(N) , REPEAT2(N,_EFAN,N) N RREPEAT_S(1, HOTENDS, _NEXT_FAN) #endif @@ -821,7 +821,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) { _temp_error(heater, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP)); } -#if HOTENDS +#if HAS_HOTEND #if ENABLED(PID_DEBUG) extern bool pid_debug_flag; #endif @@ -1036,7 +1036,7 @@ void Temperature::manage_heater() { millis_t ms = millis(); - #if HOTENDS + #if HAS_HOTEND HOTEND_LOOP() { #if ENABLED(THERMAL_PROTECTION_HOTENDS) @@ -1384,7 +1384,7 @@ void Temperature::manage_heater() { } #endif -#if HOTENDS +#if HAS_HOTEND // Derived from RepRap FiveD extruder::getTemperature() // For hot end temperature measurement. float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { @@ -1575,7 +1575,7 @@ void Temperature::updateTemperaturesFromRawValues() { #if ENABLED(HEATER_1_USES_MAX6675) temp_hotend[1].raw = READ_MAX6675(1); #endif - #if HOTENDS + #if HAS_HOTEND HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e); #endif #if HAS_HEATED_BED @@ -1836,7 +1836,7 @@ void Temperature::init() { // Wait for temperature measurement to settle delay(250); - #if HOTENDS + #if HAS_HOTEND #define _TEMP_MIN_E(NR) do{ \ temp_range[NR].mintemp = HEATER_ ##NR## _MINTEMP; \ @@ -1855,7 +1855,7 @@ void Temperature::init() { #ifdef HEATER_0_MAXTEMP _TEMP_MAX_E(0); #endif - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #ifdef HEATER_1_MINTEMP _TEMP_MIN_E(1); #endif @@ -1910,7 +1910,7 @@ void Temperature::init() { #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 - #endif // HOTENDS > 1 + #endif // HAS_MULTI_HOTEND #endif // HOTENDS @@ -2070,7 +2070,7 @@ void Temperature::disable_all_heaters() { planner.autotemp_enabled = false; #endif - #if HOTENDS + #if HAS_HOTEND HOTEND_LOOP() setTargetHotend(0, e); #endif @@ -2113,7 +2113,7 @@ void Temperature::disable_all_heaters() { #if ENABLED(PRINTJOB_TIMER_AUTOSTART) bool Temperature::over_autostart_threshold() { - #if HOTENDS + #if HAS_HOTEND HOTEND_LOOP() if (degTargetHotend(e) > (EXTRUDE_MINTEMP) / 2) return true; #endif #if HAS_HEATED_BED @@ -2358,7 +2358,7 @@ void Temperature::readings_ready() { filwidth.reading_ready(); #endif - #if HOTENDS + #if HAS_HOTEND HOTEND_LOOP() temp_hotend[e].reset(); #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) temp_hotend[1].reset(); @@ -2387,7 +2387,7 @@ void Temperature::readings_ready() { joystick.z.reset(); #endif - #if HOTENDS + #if HAS_HOTEND static constexpr int8_t temp_dir[] = { #if ENABLED(HEATER_0_USES_MAX6675) @@ -2395,7 +2395,7 @@ void Temperature::readings_ready() { #else TEMPDIR(0) #endif - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #define _TEMPDIR(N) , TEMPDIR(N) #if ENABLED(HEATER_1_USES_MAX6675) , 0 @@ -2405,7 +2405,7 @@ void Temperature::readings_ready() { #if HOTENDS > 2 REPEAT_S(2, HOTENDS, _TEMPDIR) #endif // HOTENDS > 2 - #endif // HOTENDS > 1 + #endif // HAS_MULTI_HOTEND }; LOOP_L_N(e, COUNT(temp_dir)) { @@ -2531,7 +2531,7 @@ void Temperature::tick() { static bool ADCKey_pressed = false; #endif - #if HOTENDS + #if HAS_HOTEND static SoftPWM soft_pwm_hotend[HOTENDS]; #endif @@ -2565,7 +2565,7 @@ void Temperature::tick() { if (pwm_count_tmp >= 127) { pwm_count_tmp -= 127; - #if HOTENDS + #if HAS_HOTEND #define _PWM_MOD_E(N) _PWM_MOD(N,soft_pwm_hotend[N],temp_hotend[N]); REPEAT(HOTENDS, _PWM_MOD_E); #endif @@ -2612,7 +2612,7 @@ void Temperature::tick() { } else { #define _PWM_LOW(N,S) do{ if (S.count <= pwm_count_tmp) WRITE_HEATER_##N(LOW); }while(0) - #if HOTENDS + #if HAS_HOTEND #define _PWM_LOW_E(N) _PWM_LOW(N, soft_pwm_hotend[N]); REPEAT(HOTENDS, _PWM_LOW_E); #endif @@ -2678,7 +2678,7 @@ void Temperature::tick() { if (slow_pwm_count == 0) { - #if HOTENDS + #if HAS_HOTEND #define _SLOW_PWM_E(N) _SLOW_PWM(N, soft_pwm_hotend[N], temp_hotend[N]); REPEAT(HOTENDS, _SLOW_PWM_E); #endif @@ -2689,7 +2689,7 @@ void Temperature::tick() { } // slow_pwm_count == 0 - #if HOTENDS + #if HAS_HOTEND #define _PWM_OFF_E(N) _PWM_OFF(N, soft_pwm_hotend[N]); REPEAT(HOTENDS, _PWM_OFF_E); #endif @@ -2772,7 +2772,7 @@ void Temperature::tick() { slow_pwm_count++; slow_pwm_count &= 0x7F; - #if HOTENDS + #if HAS_HOTEND HOTEND_LOOP() soft_pwm_hotend[e].dec(); #endif #if HAS_HEATED_BED @@ -2990,7 +2990,7 @@ void Temperature::tick() { } SERIAL_CHAR(' '); SERIAL_CHAR(k); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND if (e >= 0) SERIAL_CHAR('0' + e); #endif SERIAL_CHAR(':'); @@ -3052,7 +3052,7 @@ void Temperature::tick() { , H_PROBE ); #endif // HAS_TEMP_PROBE - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND HOTEND_LOOP() print_heater_state(degHotend(e), degTargetHotend(e) #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawHotendTemp(e) @@ -3067,7 +3067,7 @@ void Temperature::tick() { #if HAS_HEATED_CHAMBER SERIAL_ECHOPAIR(" C@:", getHeaterPower(H_CHAMBER)); #endif - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND HOTEND_LOOP() { SERIAL_ECHOPAIR(" @", e); SERIAL_CHAR(':'); @@ -3096,7 +3096,7 @@ void Temperature::tick() { void Temperature::set_heating_message(const uint8_t e) { const bool heating = isHeatingHotend(e); ui.status_printf_P(0, - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND PSTR("E%c " S_FMT), '1' + e #else PSTR("E " S_FMT) diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index cba1642afd..981615c1b4 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -317,12 +317,12 @@ class Temperature { public: - #if HOTENDS #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #define HOTEND_TEMPS (HOTENDS + 1) #else #define HOTEND_TEMPS HOTENDS #endif + #if HAS_HOTEND static hotend_info_t temp_hotend[HOTEND_TEMPS]; #endif #if HAS_HEATED_BED @@ -496,7 +496,7 @@ class Temperature { } #endif - #if HOTENDS + #if HAS_HOTEND static float analog_to_celsius_hotend(const int raw, const uint8_t e); #endif @@ -624,7 +624,7 @@ class Temperature { static inline void start_watching_hotend(const uint8_t=0) {} #endif - #if HOTENDS + #if HAS_HOTEND static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) { const uint8_t ee = HOTEND_INDEX; diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 0bfbaabdcd..27d9bc11cc 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -142,7 +142,7 @@ // Augmentation for auto-assigning RAMPS plugs // #if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #if TEMP_SENSOR_BED #define IS_RAMPS_EEB #else diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index b8b04a348c..52dd9b2eb5 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -184,7 +184,7 @@ // Augmentation for auto-assigning RAMPS plugs // #if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #if TEMP_SENSOR_BED #define IS_RAMPS_EEB #else diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index 3282216819..f3d338aa2a 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -159,7 +159,7 @@ #define HBP_PIN 45 // L4 #define EXTRA_FET_PIN 44 // L5 -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND #if TEMP_SENSOR_BED #define IS_EEB #else diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h index 75d647fed5..8993d0ff57 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h @@ -124,7 +124,7 @@ // Augmentation for auto-assigning RAMPS plugs // #if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #if TEMP_SENSOR_BED #define IS_RAMPS_EEB #else diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h index 5176c699ee..4e62c67aaf 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h @@ -130,7 +130,7 @@ // Augmentation for auto-assigning RAMPS plugs // #if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #if TEMP_SENSOR_BED #define IS_RAMPS_EEB #else diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index ffe7f7bb1e..be3f33ebfd 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -180,7 +180,7 @@ // Augmentation for auto-assigning RAMPS plugs // #if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #if TEMP_SENSOR_BED #define IS_RAMPS_EEB #else diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index adbacfbf4d..cfb9acb054 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -59,7 +59,7 @@ #define RAMPS_D10_PIN TG_HEATER_0_PIN // HEATER_0_PIN is always RAMPS_D10_PIN in pins_RAMPS.h -#if HOTENDS > 1 // EEF and EEB +#if HAS_MULTI_HOTEND // EEF and EEB #define RAMPS_D9_PIN TG_HEATER_1_PIN #if !TEMP_SENSOR_BED // EEF @@ -79,7 +79,7 @@ #define RAMPS_D8_PIN TG_FAN0_PIN #endif -#if HOTENDS > 1 || TEMP_SENSOR_BED // EEF, EEB, EFB +#if HAS_MULTI_HOTEND || TEMP_SENSOR_BED // EEF, EEB, EFB #define FAN1_PIN TG_FAN1_PIN #endif #define FAN2_PIN TG_FAN2_PIN diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h index 12cadcbd9c..9ca5aa1ee2 100644 --- a/Marlin/src/pins/sensitive_pins.h +++ b/Marlin/src/pins/sensitive_pins.h @@ -423,10 +423,10 @@ #define _H6_PINS #define _H7_PINS -#if HOTENDS +#if HAS_HOTEND #undef _H0_PINS #define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN), - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND #undef _H1_PINS #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN), #if HOTENDS > 2 @@ -453,7 +453,7 @@ #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 - #endif // HOTENDS > 1 + #endif // HAS_MULTI_HOTEND #endif // HOTENDS //