Extended condition macros (#13419)
Allow `ENABLED`, `DISABLED`, `PIN_EXISTS`, and `BUTTON_EXISTS` to take multiple arguments. Also add: - Alias `ANY(...)` for `!DISABLED(...)` - Alias `ANY_PIN(...)` for `PIN_EXISTS(a) || PIN_EXISTS(b) ...` - Alias `EITHER(A,B)` for `ANY(...)` - Alias `ALL(...)` and `BOTH(A,B)` for `ENABLED(...)` - `NONE(...)` for `DISABLED(...)`
This commit is contained in:
@ -56,7 +56,7 @@
|
||||
#include "../gcode/gcode.h"
|
||||
#include "../Marlin.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE)
|
||||
#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE)
|
||||
#include "../HAL/shared/persistent_store_api.h"
|
||||
#endif
|
||||
|
||||
@ -194,7 +194,7 @@ typedef struct SettingsDataStruct {
|
||||
delta_segments_per_second, // M665 S
|
||||
delta_calibration_radius, // M665 B
|
||||
delta_tower_angle_trim[ABC]; // M665 XYZ
|
||||
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
#elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
float x2_endstop_adj, // M666 X
|
||||
y2_endstop_adj, // M666 Y
|
||||
z2_endstop_adj, // M666 Z (S2)
|
||||
@ -340,7 +340,7 @@ void MarlinSettings::postprocess() {
|
||||
fwretract.refresh_autoretract();
|
||||
#endif
|
||||
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
planner.recalculate_max_e_jerk();
|
||||
#endif
|
||||
|
||||
@ -448,7 +448,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
#if HAS_CLASSIC_JERK
|
||||
EEPROM_WRITE(planner.max_jerk);
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
dummy = float(DEFAULT_EJERK);
|
||||
EEPROM_WRITE(dummy);
|
||||
#endif
|
||||
@ -624,7 +624,7 @@ void MarlinSettings::postprocess() {
|
||||
EEPROM_WRITE(delta_calibration_radius); // 1 float
|
||||
EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
|
||||
|
||||
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
#elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
|
||||
_FIELD_TEST(x2_endstop_adj);
|
||||
|
||||
@ -757,7 +757,7 @@ void MarlinSettings::postprocess() {
|
||||
const fwretract_settings_t autoretract_defaults = { 3, 45, 0, 0, 0, 13, 0, 8 };
|
||||
EEPROM_WRITE(autoretract_defaults);
|
||||
#endif
|
||||
#if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT)
|
||||
#if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT)
|
||||
EEPROM_WRITE(fwretract.autoretract_enabled);
|
||||
#else
|
||||
const bool autoretract_enabled = false;
|
||||
@ -1167,7 +1167,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
#if HAS_CLASSIC_JERK
|
||||
EEPROM_READ(planner.max_jerk);
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
EEPROM_READ(dummy);
|
||||
#endif
|
||||
#else
|
||||
@ -1340,7 +1340,7 @@ void MarlinSettings::postprocess() {
|
||||
EEPROM_READ(delta_calibration_radius); // 1 float
|
||||
EEPROM_READ(delta_tower_angle_trim); // 3 floats
|
||||
|
||||
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
#elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
|
||||
_FIELD_TEST(x2_endstop_adj);
|
||||
|
||||
@ -1472,7 +1472,7 @@ void MarlinSettings::postprocess() {
|
||||
fwretract_settings_t fwretract_settings;
|
||||
EEPROM_READ(fwretract_settings);
|
||||
#endif
|
||||
#if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT)
|
||||
#if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT)
|
||||
EEPROM_READ(fwretract.autoretract_enabled);
|
||||
#else
|
||||
bool autoretract_enabled;
|
||||
@ -2066,7 +2066,7 @@ void MarlinSettings::reset() {
|
||||
delta_calibration_radius = DELTA_CALIBRATION_RADIUS;
|
||||
COPY(delta_tower_angle_trim, dta);
|
||||
|
||||
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
#elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
endstops.x2_endstop_adj = (
|
||||
@ -2623,7 +2623,7 @@ void MarlinSettings::reset() {
|
||||
, " Z", LINEAR_UNIT(delta_tower_angle_trim[C_AXIS])
|
||||
);
|
||||
|
||||
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
#elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
|
||||
|
||||
CONFIG_ECHO_HEADING("Endstop adjustment:");
|
||||
CONFIG_ECHO_START();
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include HAL_PATH(../HAL, endstop_interrupts.h)
|
||||
#endif
|
||||
|
||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
|
||||
#if BOTH(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED, SDSUPPORT)
|
||||
#include "printcounter.h" // for print_job_timer
|
||||
#endif
|
||||
|
||||
@ -361,7 +361,7 @@ void Endstops::event_handler() {
|
||||
ui.status_printf_P(0, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP);
|
||||
#endif
|
||||
|
||||
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
|
||||
#if BOTH(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED, SDSUPPORT)
|
||||
if (planner.abort_on_endstop_hit) {
|
||||
card.stopSDPrint();
|
||||
quickstop_stepper();
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)
|
||||
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
|
||||
#include "../lcd/ultralcd.h"
|
||||
#endif
|
||||
|
||||
@ -964,7 +964,7 @@ void clean_up_after_endstop_or_probe_move() {
|
||||
void prepare_move_to_destination() {
|
||||
apply_motion_limits(destination);
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||
#if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
|
||||
|
||||
if (!DEBUGGING(DRYRUN)) {
|
||||
if (destination[E_AXIS] != current_position[E_AXIS]) {
|
||||
@ -1025,7 +1025,7 @@ bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool
|
||||
if (zz) SERIAL_CHAR('Z');
|
||||
SERIAL_ECHOLNPGM(" " MSG_FIRST);
|
||||
|
||||
#if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)
|
||||
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
|
||||
ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : "");
|
||||
#endif
|
||||
return true;
|
||||
|
@ -128,7 +128,7 @@ float Planner::steps_to_mm[XYZE_N]; // (mm) Millimeters per step
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_CLASSIC_JERK
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
float Planner::max_jerk[XYZ]; // (mm/s^2) M205 XYZ - The largest speed change requiring no acceleration.
|
||||
#else
|
||||
float Planner::max_jerk[XYZE]; // (mm/s^2) M205 XYZE - The largest speed change requiring no acceleration.
|
||||
@ -1751,7 +1751,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
SERIAL_ECHOLNPGM(" steps)");
|
||||
//*/
|
||||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||
#if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
|
||||
if (de) {
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (thermalManager.tooColdToExtrude(extruder)) {
|
||||
@ -2104,7 +2104,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
const uint8_t moves_queued = nonbusy_movesplanned();
|
||||
|
||||
// Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
|
||||
#if ENABLED(SLOWDOWN) || ENABLED(ULTRA_LCD) || defined(XY_FREQUENCY_LIMIT)
|
||||
#if EITHER(SLOWDOWN, ULTRA_LCD) || defined(XY_FREQUENCY_LIMIT)
|
||||
// Segment time im micro seconds
|
||||
uint32_t segment_time_us = LROUND(1000000.0f / inverse_secs);
|
||||
#endif
|
||||
@ -2172,7 +2172,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
// Calculate and limit speed in mm/sec for each axis
|
||||
float current_speed[NUM_AXIS], speed_factor = 1.0f; // factor <1 decreases speed
|
||||
LOOP_XYZE(i) {
|
||||
#if ENABLED(MIXING_EXTRUDER) && ENABLED(RETRACT_SYNC_MIXING)
|
||||
#if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
|
||||
// In worst case, only one extruder running, no change is needed.
|
||||
// In best case, all extruders run the same amount, we can divide by MIXING_STEPPERS
|
||||
float delta_mm_i = 0;
|
||||
@ -2485,7 +2485,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
float safe_speed = nominal_speed;
|
||||
|
||||
uint8_t limited = 0;
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
LOOP_XYZ(i)
|
||||
#else
|
||||
LOOP_XYZE(i)
|
||||
@ -2522,7 +2522,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
|
||||
// Now limit the jerk in all axes.
|
||||
const float smaller_speed_factor = vmax_junction / previous_nominal_speed;
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
LOOP_XYZ(axis)
|
||||
#else
|
||||
LOOP_XYZE(axis)
|
||||
@ -2893,7 +2893,7 @@ void Planner::reset_acceleration_rates() {
|
||||
if (AXIS_CONDITION) NOLESS(highest_rate, max_acceleration_steps_per_s2[i]);
|
||||
}
|
||||
cutoff_long = 4294967295UL / highest_rate; // 0xFFFFFFFFUL
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
recalculate_max_e_jerk();
|
||||
#endif
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ typedef struct block_t {
|
||||
|
||||
} block_t;
|
||||
|
||||
#define HAS_POSITION_FLOAT (ENABLED(LIN_ADVANCE) || ENABLED(SCARA_FEEDRATE_SCALING) || ENABLED(GRADIENT_MIX))
|
||||
#define HAS_POSITION_FLOAT ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX)
|
||||
|
||||
#define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
|
||||
|
||||
@ -253,7 +253,7 @@ class Planner {
|
||||
|
||||
#if HAS_CLASSIC_JERK
|
||||
static float max_jerk[
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
XYZ // (mm/s^2) M205 XYZ - The largest speed change requiring no acceleration.
|
||||
#else
|
||||
XYZE // (mm/s^2) M205 XYZE - The largest speed change requiring no acceleration.
|
||||
@ -861,7 +861,7 @@ class Planner {
|
||||
static void autotemp_M104_M109();
|
||||
#endif
|
||||
|
||||
#if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE)
|
||||
#if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE)
|
||||
FORCE_INLINE static void recalculate_max_e_jerk() {
|
||||
#define GET_MAX_E_JERK(N) SQRT(SQRT(0.5) * junction_deviation_mm * (N) * RECIPROCAL(1.0 - SQRT(0.5)))
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
|
@ -28,7 +28,7 @@
|
||||
// Print debug messages with M111 S2
|
||||
//#define DEBUG_PRINTCOUNTER
|
||||
|
||||
#if ENABLED(I2C_EEPROM) || ENABLED(SPI_EEPROM)
|
||||
#if EITHER(I2C_EEPROM, SPI_EEPROM)
|
||||
// round up address to next page boundary (assuming 32 byte pages)
|
||||
#define STATS_EEPROM_ADDRESS 0x40
|
||||
#else
|
||||
@ -57,7 +57,7 @@ class PrintCounter: public Stopwatch {
|
||||
private:
|
||||
typedef Stopwatch super;
|
||||
|
||||
#if ENABLED(I2C_EEPROM) || ENABLED(SPI_EEPROM) || defined(CPU_32_BIT)
|
||||
#if EITHER(I2C_EEPROM, SPI_EEPROM) || defined(CPU_32_BIT)
|
||||
typedef uint32_t eeprom_address_t;
|
||||
#else
|
||||
typedef uint16_t eeprom_address_t;
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "../gcode/gcode.h"
|
||||
#include "../lcd/ultralcd.h"
|
||||
|
||||
#if ENABLED(BLTOUCH) || ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST) || (QUIET_PROBING && ENABLED(PROBING_STEPPERS_OFF))
|
||||
#if ANY(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY, PROBE_TRIGGERED_WHEN_STOWED_TEST) || (QUIET_PROBING && ENABLED(PROBING_STEPPERS_OFF))
|
||||
#include "../Marlin.h" // for stop(), disable_e_steppers
|
||||
#endif
|
||||
|
||||
@ -416,7 +416,7 @@ bool set_probe_deployed(const bool deploy) {
|
||||
if (deploy_stow_condition && unknown_condition)
|
||||
do_probe_raise(MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
|
||||
|
||||
#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY)
|
||||
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
|
||||
#if ENABLED(Z_PROBE_SLED)
|
||||
#define _AUE_ARGS true, false, false
|
||||
#else
|
||||
@ -553,7 +553,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
|
||||
|
||||
// Check to see if the probe was triggered
|
||||
const bool probe_triggered =
|
||||
#if ENABLED(DELTA) && ENABLED(SENSORLESS_PROBING)
|
||||
#if BOTH(DELTA, SENSORLESS_PROBING)
|
||||
endstops.trigger_state() & (_BV(X_MIN) | _BV(Y_MIN) | _BV(Z_MIN))
|
||||
#else
|
||||
TEST(endstops.trigger_state(),
|
||||
|
@ -153,7 +153,7 @@ bool Stepper::abort_current_block;
|
||||
#if Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
bool Stepper::locked_Z_motor = false, Stepper::locked_Z2_motor = false;
|
||||
#endif
|
||||
#if ENABLED(Z_TRIPLE_ENDSTOPS) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS))
|
||||
#if ENABLED(Z_TRIPLE_ENDSTOPS) || BOTH(Z_STEPPER_AUTO_ALIGN, Z_TRIPLE_STEPPER_DRIVERS)
|
||||
bool Stepper::locked_Z3_motor = false;
|
||||
#endif
|
||||
|
||||
@ -1450,7 +1450,7 @@ void Stepper::stepper_pulse_phase_isr() {
|
||||
|
||||
// Pulse Extruders
|
||||
// Tick the E axis, correct error term and update position
|
||||
#if ENABLED(LIN_ADVANCE) || ENABLED(MIXING_EXTRUDER)
|
||||
#if EITHER(LIN_ADVANCE, MIXING_EXTRUDER)
|
||||
delta_error[E_AXIS] += advance_dividend[E_AXIS];
|
||||
if (delta_error[E_AXIS] >= 0) {
|
||||
count_position[E_AXIS] += count_direction[E_AXIS];
|
||||
@ -1679,7 +1679,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
|
||||
* If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z, handled below)
|
||||
* If DeltaA == DeltaB, the movement is only in the 1st axis (X)
|
||||
*/
|
||||
#if ENABLED(COREXY) || ENABLED(COREXZ)
|
||||
#if EITHER(COREXY, COREXZ)
|
||||
#define X_CMP ==
|
||||
#else
|
||||
#define X_CMP !=
|
||||
@ -1697,7 +1697,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
|
||||
* If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y)
|
||||
* If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z)
|
||||
*/
|
||||
#if ENABLED(COREYX) || ENABLED(COREYZ)
|
||||
#if EITHER(COREYX, COREYZ)
|
||||
#define Y_CMP ==
|
||||
#else
|
||||
#define Y_CMP !=
|
||||
@ -1715,7 +1715,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
|
||||
* If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y, already handled above)
|
||||
* If DeltaA == -DeltaB, the movement is only in the 2nd axis (Z)
|
||||
*/
|
||||
#if ENABLED(COREZX) || ENABLED(COREZY)
|
||||
#if EITHER(COREZX, COREZY)
|
||||
#define Z_CMP ==
|
||||
#else
|
||||
#define Z_CMP !=
|
||||
@ -2030,7 +2030,7 @@ void Stepper::init() {
|
||||
#if HAS_X_ENABLE
|
||||
X_ENABLE_INIT;
|
||||
if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH);
|
||||
#if (ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)) && HAS_X2_ENABLE
|
||||
#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) && HAS_X2_ENABLE
|
||||
X2_ENABLE_INIT;
|
||||
if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
@ -2093,7 +2093,7 @@ void Stepper::init() {
|
||||
|
||||
// Init Step Pins
|
||||
#if HAS_X_STEP
|
||||
#if ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE)
|
||||
#if EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE)
|
||||
X2_STEP_INIT;
|
||||
X2_STEP_WRITE(INVERT_X_STEP_PIN);
|
||||
#endif
|
||||
@ -2467,13 +2467,13 @@ void Stepper::report_positions() {
|
||||
if (!initialized) return;
|
||||
LOOP_L_N(i, COUNT(motor_current_setting)) {
|
||||
switch (i) {
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
|
||||
#if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y)
|
||||
case 0:
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
|
||||
case 1:
|
||||
#endif
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E) || PIN_EXISTS(MOTOR_CURRENT_PWM_E0) || PIN_EXISTS(MOTOR_CURRENT_PWM_E1)
|
||||
#if ANY_PIN(MOTOR_CURRENT_PWM_E, MOTOR_CURRENT_PWM_E0, MOTOR_CURRENT_PWM_E1)
|
||||
case 2:
|
||||
#endif
|
||||
digipot_current(i, motor_current_setting[i]);
|
||||
|
@ -267,7 +267,7 @@ class Stepper {
|
||||
#if Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN)
|
||||
static bool locked_Z_motor, locked_Z2_motor;
|
||||
#endif
|
||||
#if ENABLED(Z_TRIPLE_ENDSTOPS) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS))
|
||||
#if ENABLED(Z_TRIPLE_ENDSTOPS) || BOTH(Z_STEPPER_AUTO_ALIGN, Z_TRIPLE_STEPPER_DRIVERS)
|
||||
static bool locked_Z3_motor;
|
||||
#endif
|
||||
|
||||
@ -423,7 +423,7 @@ class Stepper {
|
||||
FORCE_INLINE static void set_z_lock(const bool state) { locked_Z_motor = state; }
|
||||
FORCE_INLINE static void set_z2_lock(const bool state) { locked_Z2_motor = state; }
|
||||
#endif
|
||||
#if ENABLED(Z_TRIPLE_ENDSTOPS) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS))
|
||||
#if ENABLED(Z_TRIPLE_ENDSTOPS) || BOTH(Z_STEPPER_AUTO_ALIGN, Z_TRIPLE_STEPPER_DRIVERS)
|
||||
FORCE_INLINE static void set_z3_lock(const bool state) { locked_Z3_motor = state; }
|
||||
#endif
|
||||
|
||||
|
@ -618,7 +618,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
#define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0)
|
||||
#endif
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(MULTI_NOZZLE_DUPLICATION)
|
||||
#if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
|
||||
|
||||
#define NDIR(N) _DUPE(DIR,!INVERT_E##N##_DIR)
|
||||
#define RDIR(N) _DUPE(DIR, INVERT_E##N##_DIR)
|
||||
|
@ -33,13 +33,13 @@
|
||||
#include "../core/language.h"
|
||||
#include "../HAL/shared/Delay.h"
|
||||
|
||||
#define MAX6675_SEPARATE_SPI (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675)) && PIN_EXISTS(MAX6675_SCK) && PIN_EXISTS(MAX6675_DO)
|
||||
#define MAX6675_SEPARATE_SPI EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PIN_EXISTS(MAX6675_SCK, MAX6675_DO)
|
||||
|
||||
#if MAX6675_SEPARATE_SPI
|
||||
#include "../libs/private_spi.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(BABYSTEPPING) || ENABLED(PID_EXTRUSION_SCALING)
|
||||
#if EITHER(BABYSTEPPING, PID_EXTRUSION_SCALING)
|
||||
#include "stepper.h"
|
||||
#endif
|
||||
|
||||
@ -360,8 +360,8 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
|
||||
#endif
|
||||
|
||||
#if WATCH_BED || WATCH_HOTENDS
|
||||
#define HAS_TP_BED (ENABLED(THERMAL_PROTECTION_BED) && ENABLED(PIDTEMPBED))
|
||||
#if HAS_TP_BED && ENABLED(THERMAL_PROTECTION_HOTENDS) && ENABLED(PIDTEMP)
|
||||
#define HAS_TP_BED BOTH(THERMAL_PROTECTION_BED, PIDTEMPBED)
|
||||
#if HAS_TP_BED && BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP)
|
||||
#define GTV(B,H) (heater < 0 ? (B) : (H))
|
||||
#elif HAS_TP_BED
|
||||
#define GTV(B,H) (B)
|
||||
@ -913,7 +913,7 @@ void Temperature::manage_heater() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
|
||||
#if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
|
||||
static bool last_pause_state;
|
||||
#endif
|
||||
|
||||
@ -1004,12 +1004,12 @@ void Temperature::manage_heater() {
|
||||
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
if (PENDING(ms, next_bed_check_ms)
|
||||
#if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
|
||||
#if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
|
||||
&& paused == last_pause_state
|
||||
#endif
|
||||
) return;
|
||||
next_bed_check_ms = ms + BED_CHECK_INTERVAL;
|
||||
#if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
|
||||
#if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING)
|
||||
last_pause_state = paused;
|
||||
#endif
|
||||
#endif
|
||||
@ -1334,7 +1334,7 @@ void Temperature::init() {
|
||||
#endif
|
||||
|
||||
#if MB(RUMBA)
|
||||
#define _AD(N) (ENABLED(HEATER_##N##_USES_AD595) || ENABLED(HEATER_##N##_USES_AD8495))
|
||||
#define _AD(N) (ANY(HEATER_##N##_USES_AD595, HEATER_##N##_USES_AD8495))
|
||||
#if _AD(0) || _AD(1) || _AD(2) || _AD(3) || _AD(4) || _AD(5) || _AD(BED) || _AD(CHAMBER)
|
||||
// Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
|
||||
MCUCR = _BV(JTD);
|
||||
@ -1342,7 +1342,7 @@ void Temperature::init() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(PIDTEMP) && ENABLED(PID_EXTRUSION_SCALING)
|
||||
#if BOTH(PIDTEMP, PID_EXTRUSION_SCALING)
|
||||
last_e_position = 0;
|
||||
#endif
|
||||
|
||||
@ -2743,7 +2743,7 @@ void Temperature::isr() {
|
||||
//
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
#if ENABLED(BABYSTEP_XY) || ENABLED(I2C_POSITION_ENCODERS)
|
||||
#if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
|
||||
LOOP_XYZ(axis) {
|
||||
const int16_t curTodo = babystepsTodo[axis]; // get rid of volatile for performance
|
||||
if (curTodo) {
|
||||
@ -2942,7 +2942,7 @@ void Temperature::isr() {
|
||||
|
||||
#endif // AUTO_REPORT_TEMPERATURES
|
||||
|
||||
#if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)
|
||||
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
|
||||
void Temperature::set_heating_message(const uint8_t e) {
|
||||
const bool heating = isHeatingHotend(e);
|
||||
#if HOTENDS > 1
|
||||
|
@ -739,7 +739,7 @@ class Temperature {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)
|
||||
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
|
||||
static void set_heating_message(const uint8_t e);
|
||||
#endif
|
||||
|
||||
@ -778,9 +778,9 @@ class Temperature {
|
||||
|
||||
static void updateTemperaturesFromRawValues();
|
||||
|
||||
#define HAS_MAX6675 (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675))
|
||||
#define HAS_MAX6675 EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
|
||||
#if HAS_MAX6675
|
||||
#if ENABLED(HEATER_0_USES_MAX6675) && ENABLED(HEATER_1_USES_MAX6675)
|
||||
#if BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
|
||||
#define COUNT_6675 2
|
||||
#else
|
||||
#define COUNT_6675 1
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "../gcode/gcode.h" // for dwell()
|
||||
#endif
|
||||
|
||||
#if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) || ENABLED(SWITCHING_TOOLHEAD)
|
||||
#if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, SWITCHING_TOOLHEAD)
|
||||
#include "servo.h"
|
||||
#endif
|
||||
|
||||
@ -740,7 +740,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
||||
singlenozzle_temp[active_extruder] = thermalManager.temp_hotend[0].target;
|
||||
if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) {
|
||||
thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0);
|
||||
#if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)
|
||||
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
|
||||
thermalManager.set_heating_message(0);
|
||||
#endif
|
||||
(void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling
|
||||
|
Reference in New Issue
Block a user