Skip to content

Commit 251af93

Browse files
thinkyheadernisv
authored andcommitted
🔧 Fix build with no Y axis (MarlinFirmware#25311)
1 parent 5715633 commit 251af93

File tree

10 files changed

+184
-149
lines changed

10 files changed

+184
-149
lines changed

Marlin/src/HAL/AVR/fastio.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,11 @@ enum ClockSource2 : uint8_t {
293293

294294
#if HAS_MOTOR_CURRENT_PWM
295295
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
296-
#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)
296+
#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)
297297
#elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
298-
#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)
298+
#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)
299299
#else
300-
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1)
300+
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN)
301301
#endif
302302
#else
303303
#define PWM_CHK_MOTOR_CURRENT(P) false

Marlin/src/core/serial.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ void serial_offset(const_float_t v, const uint8_t sp=0); // For v==0 draw space
337337
void print_bin(const uint16_t val);
338338
void print_pos(NUM_AXIS_ARGS(const_float_t), FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr);
339339

340-
inline void print_pos(const xyz_pos_t &xyz, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) {
341-
print_pos(NUM_AXIS_ELEM(xyz), prefix, suffix);
340+
inline void print_pos(const xyze_pos_t &xyze, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) {
341+
print_pos(NUM_AXIS_ELEM(xyze), prefix, suffix);
342342
}
343343

344344
#define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, F(" " STRINGIFY(VAR) "="), F(" : " SUFFIX "\n")); }while(0)

Marlin/src/core/types.h

+67-50
Large diffs are not rendered by default.

Marlin/src/gcode/calibrate/G28.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ void GcodeSuite::G28() {
403403
UNUSED(needZ); UNUSED(homeZZ);
404404
#else
405405
constexpr bool doZ = false;
406+
#if !HAS_Y_AXIS
407+
constexpr bool doY = false;
408+
#endif
406409
#endif
407410

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

423-
// Home Y (before X)
424-
if (ENABLED(HOME_Y_BEFORE_X) && (doY || TERN0(CODEPENDENT_XY_HOMING, doX)))
425-
homeaxis(Y_AXIS);
426+
#if HAS_Y_AXIS
427+
// Home Y (before X)
428+
if (ENABLED(HOME_Y_BEFORE_X) && (doY || TERN0(CODEPENDENT_XY_HOMING, doX)))
429+
homeaxis(Y_AXIS);
430+
#endif
426431

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

458-
// Home Y (after X)
459-
if (DISABLED(HOME_Y_BEFORE_X) && doY)
460-
homeaxis(Y_AXIS);
463+
#if HAS_Y_AXIS
464+
// Home Y (after X)
465+
if (DISABLED(HOME_Y_BEFORE_X) && doY)
466+
homeaxis(Y_AXIS);
467+
#endif
461468

462469
#if BOTH(FOAMCUTTER_XYUV, HAS_J_AXIS)
463470
// Home J (after Y)

Marlin/src/inc/Conditionals_LCD.h

+26-34
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,26 @@
589589
#else
590590
#undef EXTRUDERS
591591
#define EXTRUDERS 0
592+
#undef TEMP_SENSOR_0
593+
#undef TEMP_SENSOR_1
594+
#undef TEMP_SENSOR_2
595+
#undef TEMP_SENSOR_3
596+
#undef TEMP_SENSOR_4
597+
#undef TEMP_SENSOR_5
598+
#undef TEMP_SENSOR_6
599+
#undef TEMP_SENSOR_7
592600
#undef SINGLENOZZLE
593601
#undef SWITCHING_EXTRUDER
594602
#undef SWITCHING_NOZZLE
595603
#undef MIXING_EXTRUDER
596604
#undef HOTEND_IDLE_TIMEOUT
597605
#undef DISABLE_E
606+
#undef THERMAL_PROTECTION_HOTENDS
607+
#undef PREVENT_COLD_EXTRUSION
608+
#undef PREVENT_LENGTHY_EXTRUDE
609+
#undef FILAMENT_RUNOUT_SENSOR
610+
#undef FILAMENT_RUNOUT_DISTANCE_MM
611+
#undef DISABLE_INACTIVE_EXTRUDER
598612
#endif
599613

600614
#define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N)
@@ -668,20 +682,28 @@
668682

669683
#if E_STEPPERS <= 7
670684
#undef INVERT_E7_DIR
685+
#undef E7_DRIVER_TYPE
671686
#if E_STEPPERS <= 6
672687
#undef INVERT_E6_DIR
688+
#undef E6_DRIVER_TYPE
673689
#if E_STEPPERS <= 5
674690
#undef INVERT_E5_DIR
691+
#undef E5_DRIVER_TYPE
675692
#if E_STEPPERS <= 4
676693
#undef INVERT_E4_DIR
694+
#undef E4_DRIVER_TYPE
677695
#if E_STEPPERS <= 3
678696
#undef INVERT_E3_DIR
697+
#undef E3_DRIVER_TYPE
679698
#if E_STEPPERS <= 2
680699
#undef INVERT_E2_DIR
700+
#undef E2_DRIVER_TYPE
681701
#if E_STEPPERS <= 1
682702
#undef INVERT_E1_DIR
703+
#undef E1_DRIVER_TYPE
683704
#if E_STEPPERS == 0
684705
#undef INVERT_E0_DIR
706+
#undef E0_DRIVER_TYPE
685707
#endif
686708
#endif
687709
#endif
@@ -719,6 +741,7 @@
719741
#else
720742
#define NUM_AXES 1
721743
#endif
744+
#define HAS_X_AXIS 1
722745
#if NUM_AXES >= XY
723746
#define HAS_Y_AXIS 1
724747
#if NUM_AXES >= XYZ
@@ -753,31 +776,6 @@
753776
#endif
754777
#endif
755778

756-
#if E_STEPPERS <= 0
757-
#undef E0_DRIVER_TYPE
758-
#endif
759-
#if E_STEPPERS <= 1
760-
#undef E1_DRIVER_TYPE
761-
#endif
762-
#if E_STEPPERS <= 2
763-
#undef E2_DRIVER_TYPE
764-
#endif
765-
#if E_STEPPERS <= 3
766-
#undef E3_DRIVER_TYPE
767-
#endif
768-
#if E_STEPPERS <= 4
769-
#undef E4_DRIVER_TYPE
770-
#endif
771-
#if E_STEPPERS <= 5
772-
#undef E5_DRIVER_TYPE
773-
#endif
774-
#if E_STEPPERS <= 6
775-
#undef E6_DRIVER_TYPE
776-
#endif
777-
#if E_STEPPERS <= 7
778-
#undef E7_DRIVER_TYPE
779-
#endif
780-
781779
#if !HAS_Y_AXIS
782780
#undef ENDSTOPPULLUP_YMIN
783781
#undef ENDSTOPPULLUP_YMAX
@@ -793,7 +791,6 @@
793791
#undef MANUAL_Y_HOME_POS
794792
#undef MIN_SOFTWARE_ENDSTOP_Y
795793
#undef MAX_SOFTWARE_ENDSTOP_Y
796-
#undef SAFE_BED_LEVELING_START_Y
797794
#endif
798795

799796
#if !HAS_Z_AXIS
@@ -813,7 +810,6 @@
813810
#undef MANUAL_Z_HOME_POS
814811
#undef MIN_SOFTWARE_ENDSTOP_Z
815812
#undef MAX_SOFTWARE_ENDSTOP_Z
816-
#undef SAFE_BED_LEVELING_START_Z
817813
#endif
818814

819815
#if !HAS_I_AXIS
@@ -830,7 +826,6 @@
830826
#undef MANUAL_I_HOME_POS
831827
#undef MIN_SOFTWARE_ENDSTOP_I
832828
#undef MAX_SOFTWARE_ENDSTOP_I
833-
#undef SAFE_BED_LEVELING_START_I
834829
#endif
835830

836831
#if !HAS_J_AXIS
@@ -847,7 +842,6 @@
847842
#undef MANUAL_J_HOME_POS
848843
#undef MIN_SOFTWARE_ENDSTOP_J
849844
#undef MAX_SOFTWARE_ENDSTOP_J
850-
#undef SAFE_BED_LEVELING_START_J
851845
#endif
852846

853847
#if !HAS_K_AXIS
@@ -864,7 +858,6 @@
864858
#undef MANUAL_K_HOME_POS
865859
#undef MIN_SOFTWARE_ENDSTOP_K
866860
#undef MAX_SOFTWARE_ENDSTOP_K
867-
#undef SAFE_BED_LEVELING_START_K
868861
#endif
869862

870863
#if !HAS_U_AXIS
@@ -881,7 +874,6 @@
881874
#undef MANUAL_U_HOME_POS
882875
#undef MIN_SOFTWARE_ENDSTOP_U
883876
#undef MAX_SOFTWARE_ENDSTOP_U
884-
#undef SAFE_BED_LEVELING_START_U
885877
#endif
886878

887879
#if !HAS_V_AXIS
@@ -898,7 +890,6 @@
898890
#undef MANUAL_V_HOME_POS
899891
#undef MIN_SOFTWARE_ENDSTOP_V
900892
#undef MAX_SOFTWARE_ENDSTOP_V
901-
#undef SAFE_BED_LEVELING_START_V
902893
#endif
903894

904895
#if !HAS_W_AXIS
@@ -915,7 +906,6 @@
915906
#undef MANUAL_W_HOME_POS
916907
#undef MIN_SOFTWARE_ENDSTOP_W
917908
#undef MAX_SOFTWARE_ENDSTOP_W
918-
#undef SAFE_BED_LEVELING_START_W
919909
#endif
920910

921911
#ifdef X2_DRIVER_TYPE
@@ -1638,7 +1628,9 @@
16381628
#endif
16391629
#endif
16401630

1641-
#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)
1631+
#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) \
1632+
|| (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR) \
1633+
|| (HAS_U_AXIS && U_HOME_DIR) || (HAS_V_AXIS && V_HOME_DIR) || (HAS_W_AXIS && W_HOME_DIR)
16421634
#define HAS_ENDSTOPS 1
16431635
#define COORDINATE_OKAY(N,L,H) WITHIN(N,L,H)
16441636
#else

Marlin/src/inc/Conditionals_adv.h

+31-20
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,47 @@
8686
#undef PROBE_DEPLOY_STOW_MENU
8787
#endif
8888

89+
// Some options are disallowed without required axes
90+
#if !HAS_Y_AXIS
91+
#undef SAFE_BED_LEVELING_START_Y
92+
#undef ARC_SUPPORT
93+
#undef INPUT_SHAPING_Y
94+
#undef SHAPING_FREQ_Y
95+
#undef SHAPING_BUFFER_Y
96+
#endif
97+
#if !HAS_Z_AXIS
98+
#undef SAFE_BED_LEVELING_START_Z
99+
#endif
100+
#if !HAS_I_AXIS
101+
#undef SAFE_BED_LEVELING_START_I
102+
#endif
103+
#if !HAS_J_AXIS
104+
#undef SAFE_BED_LEVELING_START_J
105+
#endif
106+
#if !HAS_K_AXIS
107+
#undef SAFE_BED_LEVELING_START_K
108+
#endif
109+
#if !HAS_U_AXIS
110+
#undef SAFE_BED_LEVELING_START_U
111+
#endif
112+
#if !HAS_V_AXIS
113+
#undef SAFE_BED_LEVELING_START_V
114+
#endif
115+
#if !HAS_W_AXIS
116+
#undef SAFE_BED_LEVELING_START_W
117+
#endif
118+
119+
// Disallowed with no extruders
89120
#if !HAS_EXTRUDERS
90121
#define NO_VOLUMETRICS
91-
#undef TEMP_SENSOR_0
92-
#undef TEMP_SENSOR_1
93-
#undef TEMP_SENSOR_2
94-
#undef TEMP_SENSOR_3
95-
#undef TEMP_SENSOR_4
96-
#undef TEMP_SENSOR_5
97-
#undef TEMP_SENSOR_6
98-
#undef TEMP_SENSOR_7
99122
#undef FWRETRACT
100123
#undef PIDTEMP
101124
#undef AUTOTEMP
102125
#undef PID_EXTRUSION_SCALING
103126
#undef LIN_ADVANCE
104-
#undef FILAMENT_RUNOUT_SENSOR
105127
#undef ADVANCED_PAUSE_FEATURE
106-
#undef FILAMENT_RUNOUT_DISTANCE_MM
107-
#undef FILAMENT_LOAD_UNLOAD_GCODES
108-
#undef DISABLE_INACTIVE_EXTRUDER
109128
#undef FILAMENT_LOAD_UNLOAD_GCODES
110129
#undef EXTRUDER_RUNOUT_PREVENT
111-
#undef PREVENT_COLD_EXTRUSION
112-
#undef PREVENT_LENGTHY_EXTRUDE
113-
#undef THERMAL_PROTECTION_HOTENDS
114130
#undef THERMAL_PROTECTION_PERIOD
115131
#undef WATCH_TEMP_PERIOD
116132
#undef SHOW_TEMP_ADC_VALUES
@@ -1123,11 +1139,6 @@
11231139
#endif
11241140

11251141
// Input shaping
1126-
#if !HAS_Y_AXIS
1127-
#undef INPUT_SHAPING_Y
1128-
#undef SHAPING_FREQ_Y
1129-
#undef SHAPING_BUFFER_Y
1130-
#endif
11311142
#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y)
11321143
#define HAS_SHAPING 1
11331144
#endif

Marlin/src/inc/Conditionals_post.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2251,7 +2251,7 @@
22512251
#define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_)
22522252
#define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_)
22532253

2254-
#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))
2254+
#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))
22552255
#if _HAS_STOP(X,MIN)
22562256
#define HAS_X_MIN 1
22572257
#endif

Marlin/src/inc/SanityCheck.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,9 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
837837
* Validate that the bed size fits
838838
*/
839839
static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS) are too narrow to contain X_BED_SIZE.");
840-
static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE.");
840+
#if HAS_Y_AXIS
841+
static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE.");
842+
#endif
841843

842844
/**
843845
* Granular software endstops (Marlin >= 1.1.7)

0 commit comments

Comments
 (0)