Skip to content

Commit

Permalink
🔧 Fix build with no Y axis (MarlinFirmware#25311)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored Jan 31, 2023
1 parent d0a965a commit 087e19a
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 149 deletions.
6 changes: 3 additions & 3 deletions Marlin/src/HAL/AVR/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,11 @@ enum ClockSource2 : uint8_t {

#if HAS_MOTOR_CURRENT_PWM
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1 || P == MOTOR_CURRENT_PWM_Z || P == MOTOR_CURRENT_PWM_XY)
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN || P == MOTOR_CURRENT_PWM_XY_PIN)
#elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1 || P == MOTOR_CURRENT_PWM_Z)
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN)
#else
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1)
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN)
#endif
#else
#define PWM_CHK_MOTOR_CURRENT(P) false
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ void serial_offset(const_float_t v, const uint8_t sp=0); // For v==0 draw space
void print_bin(const uint16_t val);
void print_pos(NUM_AXIS_ARGS(const_float_t), FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr);

inline void print_pos(const xyz_pos_t &xyz, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) {
print_pos(NUM_AXIS_ELEM(xyz), prefix, suffix);
inline void print_pos(const xyze_pos_t &xyze, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) {
print_pos(NUM_AXIS_ELEM(xyze), prefix, suffix);
}

#define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, F(" " STRINGIFY(VAR) "="), F(" : " SUFFIX "\n")); }while(0)
Expand Down
117 changes: 67 additions & 50 deletions Marlin/src/core/types.h

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ void GcodeSuite::G28() {
UNUSED(needZ); UNUSED(homeZZ);
#else
constexpr bool doZ = false;
#if !HAS_Y_AXIS
constexpr bool doY = false;
#endif
#endif

TERN_(HOME_Z_FIRST, if (doZ) homeaxis(Z_AXIS));
Expand All @@ -420,9 +423,11 @@ void GcodeSuite::G28() {
// Diagonal move first if both are homing
TERN_(QUICK_HOME, if (doX && doY) quick_home_xy());

// Home Y (before X)
if (ENABLED(HOME_Y_BEFORE_X) && (doY || TERN0(CODEPENDENT_XY_HOMING, doX)))
homeaxis(Y_AXIS);
#if HAS_Y_AXIS
// Home Y (before X)
if (ENABLED(HOME_Y_BEFORE_X) && (doY || TERN0(CODEPENDENT_XY_HOMING, doX)))
homeaxis(Y_AXIS);
#endif

// Home X
if (doX || (doY && ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X))) {
Expand Down Expand Up @@ -455,9 +460,11 @@ void GcodeSuite::G28() {
if (doI) homeaxis(I_AXIS);
#endif

// Home Y (after X)
if (DISABLED(HOME_Y_BEFORE_X) && doY)
homeaxis(Y_AXIS);
#if HAS_Y_AXIS
// Home Y (after X)
if (DISABLED(HOME_Y_BEFORE_X) && doY)
homeaxis(Y_AXIS);
#endif

#if BOTH(FOAMCUTTER_XYUV, HAS_J_AXIS)
// Home J (after Y)
Expand Down
60 changes: 26 additions & 34 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -603,12 +603,26 @@
#else
#undef EXTRUDERS
#define EXTRUDERS 0
#undef TEMP_SENSOR_0
#undef TEMP_SENSOR_1
#undef TEMP_SENSOR_2
#undef TEMP_SENSOR_3
#undef TEMP_SENSOR_4
#undef TEMP_SENSOR_5
#undef TEMP_SENSOR_6
#undef TEMP_SENSOR_7
#undef SINGLENOZZLE
#undef SWITCHING_EXTRUDER
#undef SWITCHING_NOZZLE
#undef MIXING_EXTRUDER
#undef HOTEND_IDLE_TIMEOUT
#undef DISABLE_E
#undef THERMAL_PROTECTION_HOTENDS
#undef PREVENT_COLD_EXTRUSION
#undef PREVENT_LENGTHY_EXTRUDE
#undef FILAMENT_RUNOUT_SENSOR
#undef FILAMENT_RUNOUT_DISTANCE_MM
#undef DISABLE_INACTIVE_EXTRUDER
#endif

#define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N)
Expand Down Expand Up @@ -682,20 +696,28 @@

#if E_STEPPERS <= 7
#undef INVERT_E7_DIR
#undef E7_DRIVER_TYPE
#if E_STEPPERS <= 6
#undef INVERT_E6_DIR
#undef E6_DRIVER_TYPE
#if E_STEPPERS <= 5
#undef INVERT_E5_DIR
#undef E5_DRIVER_TYPE
#if E_STEPPERS <= 4
#undef INVERT_E4_DIR
#undef E4_DRIVER_TYPE
#if E_STEPPERS <= 3
#undef INVERT_E3_DIR
#undef E3_DRIVER_TYPE
#if E_STEPPERS <= 2
#undef INVERT_E2_DIR
#undef E2_DRIVER_TYPE
#if E_STEPPERS <= 1
#undef INVERT_E1_DIR
#undef E1_DRIVER_TYPE
#if E_STEPPERS == 0
#undef INVERT_E0_DIR
#undef E0_DRIVER_TYPE
#endif
#endif
#endif
Expand Down Expand Up @@ -733,6 +755,7 @@
#else
#define NUM_AXES 1
#endif
#define HAS_X_AXIS 1
#if NUM_AXES >= XY
#define HAS_Y_AXIS 1
#if NUM_AXES >= XYZ
Expand Down Expand Up @@ -767,31 +790,6 @@
#endif
#endif

#if E_STEPPERS <= 0
#undef E0_DRIVER_TYPE
#endif
#if E_STEPPERS <= 1
#undef E1_DRIVER_TYPE
#endif
#if E_STEPPERS <= 2
#undef E2_DRIVER_TYPE
#endif
#if E_STEPPERS <= 3
#undef E3_DRIVER_TYPE
#endif
#if E_STEPPERS <= 4
#undef E4_DRIVER_TYPE
#endif
#if E_STEPPERS <= 5
#undef E5_DRIVER_TYPE
#endif
#if E_STEPPERS <= 6
#undef E6_DRIVER_TYPE
#endif
#if E_STEPPERS <= 7
#undef E7_DRIVER_TYPE
#endif

#if !HAS_Y_AXIS
#undef ENDSTOPPULLUP_YMIN
#undef ENDSTOPPULLUP_YMAX
Expand All @@ -807,7 +805,6 @@
#undef MANUAL_Y_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_Y
#undef MAX_SOFTWARE_ENDSTOP_Y
#undef SAFE_BED_LEVELING_START_Y
#endif

#if !HAS_Z_AXIS
Expand All @@ -827,7 +824,6 @@
#undef MANUAL_Z_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_Z
#undef MAX_SOFTWARE_ENDSTOP_Z
#undef SAFE_BED_LEVELING_START_Z
#endif

#if !HAS_I_AXIS
Expand All @@ -844,7 +840,6 @@
#undef MANUAL_I_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_I
#undef MAX_SOFTWARE_ENDSTOP_I
#undef SAFE_BED_LEVELING_START_I
#endif

#if !HAS_J_AXIS
Expand All @@ -861,7 +856,6 @@
#undef MANUAL_J_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_J
#undef MAX_SOFTWARE_ENDSTOP_J
#undef SAFE_BED_LEVELING_START_J
#endif

#if !HAS_K_AXIS
Expand All @@ -878,7 +872,6 @@
#undef MANUAL_K_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_K
#undef MAX_SOFTWARE_ENDSTOP_K
#undef SAFE_BED_LEVELING_START_K
#endif

#if !HAS_U_AXIS
Expand All @@ -895,7 +888,6 @@
#undef MANUAL_U_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_U
#undef MAX_SOFTWARE_ENDSTOP_U
#undef SAFE_BED_LEVELING_START_U
#endif

#if !HAS_V_AXIS
Expand All @@ -912,7 +904,6 @@
#undef MANUAL_V_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_V
#undef MAX_SOFTWARE_ENDSTOP_V
#undef SAFE_BED_LEVELING_START_V
#endif

#if !HAS_W_AXIS
Expand All @@ -929,7 +920,6 @@
#undef MANUAL_W_HOME_POS
#undef MIN_SOFTWARE_ENDSTOP_W
#undef MAX_SOFTWARE_ENDSTOP_W
#undef SAFE_BED_LEVELING_START_W
#endif

#ifdef X2_DRIVER_TYPE
Expand Down Expand Up @@ -1665,7 +1655,9 @@
#endif
#endif

#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) || (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR)
#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) \
|| (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR) \
|| (HAS_U_AXIS && U_HOME_DIR) || (HAS_V_AXIS && V_HOME_DIR) || (HAS_W_AXIS && W_HOME_DIR)
#define HAS_ENDSTOPS 1
#define COORDINATE_OKAY(N,L,H) WITHIN(N,L,H)
#else
Expand Down
51 changes: 31 additions & 20 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,47 @@
#undef PROBE_DEPLOY_STOW_MENU
#endif

// Some options are disallowed without required axes
#if !HAS_Y_AXIS
#undef SAFE_BED_LEVELING_START_Y
#undef ARC_SUPPORT
#undef INPUT_SHAPING_Y
#undef SHAPING_FREQ_Y
#undef SHAPING_BUFFER_Y
#endif
#if !HAS_Z_AXIS
#undef SAFE_BED_LEVELING_START_Z
#endif
#if !HAS_I_AXIS
#undef SAFE_BED_LEVELING_START_I
#endif
#if !HAS_J_AXIS
#undef SAFE_BED_LEVELING_START_J
#endif
#if !HAS_K_AXIS
#undef SAFE_BED_LEVELING_START_K
#endif
#if !HAS_U_AXIS
#undef SAFE_BED_LEVELING_START_U
#endif
#if !HAS_V_AXIS
#undef SAFE_BED_LEVELING_START_V
#endif
#if !HAS_W_AXIS
#undef SAFE_BED_LEVELING_START_W
#endif

// Disallowed with no extruders
#if !HAS_EXTRUDERS
#define NO_VOLUMETRICS
#undef TEMP_SENSOR_0
#undef TEMP_SENSOR_1
#undef TEMP_SENSOR_2
#undef TEMP_SENSOR_3
#undef TEMP_SENSOR_4
#undef TEMP_SENSOR_5
#undef TEMP_SENSOR_6
#undef TEMP_SENSOR_7
#undef FWRETRACT
#undef PIDTEMP
#undef AUTOTEMP
#undef PID_EXTRUSION_SCALING
#undef LIN_ADVANCE
#undef FILAMENT_RUNOUT_SENSOR
#undef ADVANCED_PAUSE_FEATURE
#undef FILAMENT_RUNOUT_DISTANCE_MM
#undef FILAMENT_LOAD_UNLOAD_GCODES
#undef DISABLE_INACTIVE_EXTRUDER
#undef FILAMENT_LOAD_UNLOAD_GCODES
#undef EXTRUDER_RUNOUT_PREVENT
#undef PREVENT_COLD_EXTRUSION
#undef PREVENT_LENGTHY_EXTRUDE
#undef THERMAL_PROTECTION_HOTENDS
#undef THERMAL_PROTECTION_PERIOD
#undef WATCH_TEMP_PERIOD
#undef SHOW_TEMP_ADC_VALUES
Expand Down Expand Up @@ -1127,11 +1143,6 @@
#endif

// Input shaping
#if !HAS_Y_AXIS
#undef INPUT_SHAPING_Y
#undef SHAPING_FREQ_Y
#undef SHAPING_BUFFER_Y
#endif
#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y)
#define HAS_SHAPING 1
#endif
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@
#define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_)
#define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 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_STOP(A,M) (HAS_##A##_AXIS && 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))
#if _HAS_STOP(X,MIN)
#define HAS_X_MIN 1
#endif
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,9 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
* Validate that the bed size fits
*/
static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS) are too narrow to contain X_BED_SIZE.");
static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE.");
#if HAS_Y_AXIS
static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE.");
#endif

/**
* Granular software endstops (Marlin >= 1.1.7)
Expand Down
Loading

0 comments on commit 087e19a

Please sign in to comment.