🐛 Fix compile without Y/Z (#24858)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
karliss 2022-10-18 04:01:18 +03:00 committed by Scott Lahteine
parent ca1968a842
commit 256ac01ca2
7 changed files with 122 additions and 71 deletions

View File

@ -197,8 +197,12 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
if (chop_x2 || chop_y2 || chop_z2) {
say_M569(forReplay, F("I1"));
if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR);
if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR);
if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR);
#if HAS_Y_AXIS
if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR);
#endif
#if HAS_Z_AXIS
if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR);
#endif
SERIAL_EOL();
}

View File

@ -222,24 +222,41 @@ void GcodeSuite::M115() {
// Machine Geometry
#if ENABLED(M115_GEOMETRY_REPORT)
const xyz_pos_t bmin = { 0, 0, 0 },
bmax = { X_BED_SIZE , Y_BED_SIZE, Z_MAX_POS },
dmin = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
dmax = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
constexpr xyz_pos_t bmin{0},
bmax = ARRAY_N(NUM_AXES, X_BED_SIZE, Y_BED_SIZE, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS),
dmin = ARRAY_N(NUM_AXES, X_MIN_POS, Y_MIN_POS, Z_MIN_POS, I_MIN_POS, J_MIN_POS, K_MIN_POS, U_MIN_POS, V_MIN_POS, W_MIN_POS),
dmax = ARRAY_N(NUM_AXES, X_MAX_POS, Y_MAX_POS, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS);
xyz_pos_t cmin = bmin, cmax = bmax;
apply_motion_limits(cmin);
apply_motion_limits(cmax);
const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(),
wmin = cmin.asLogical(), wmax = cmax.asLogical();
SERIAL_ECHOLNPGM(
"area:{"
"full:{"
"min:{x:", lmin.x, ",y:", lmin.y, ",z:", lmin.z, "},"
"max:{x:", lmax.x, ",y:", lmax.y, ",z:", lmax.z, "}"
LIST_N(DOUBLE(NUM_AXES),
"min:{x:", lmin.x, ",y:", lmin.y, ",z:", lmin.z,
",i:", lmin.i, ",j:", lmin.j, ",k:", lmin.k,
",u:", lmin.u, ",v:", lmin.v, ",w:", lmin.w
),
LIST_N(DOUBLE(NUM_AXES),
"max:{x:", lmax.x, ",y:", lmax.y, ",z:", lmax.z,
",i:", lmax.i, ",j:", lmax.j, ",k:", lmax.k,
",u:", lmax.u, ",v:", lmax.v, ",w:", lmax.w
),
"},"
"work:{"
"min:{x:", wmin.x, ",y:", wmin.y, ",z:", wmin.z, "},"
"max:{x:", wmax.x, ",y:", wmax.y, ",z:", wmax.z, "}",
LIST_N(DOUBLE(NUM_AXES),
"min:{x:", wmin.x, ",y:", wmin.y, ",z:", wmin.z,
",i:", wmin.i, ",j:", wmin.j, ",k:", wmin.k,
",u:", wmin.u, ",v:", wmin.v, ",w:", wmin.w
),
LIST_N(DOUBLE(NUM_AXES),
"max:{x:", wmax.x, ",y:", wmax.y, ",z:", wmax.z,
",i:", wmax.i, ",j:", wmax.j, ",k:", wmax.k,
",u:", wmax.u, ",v:", wmax.v, ",w:", wmax.w
),
"}"
"}"
);

View File

@ -1204,45 +1204,61 @@
#elif X_HOME_DIR < 0
#define X_HOME_TO_MIN 1
#endif
#if Y_HOME_DIR > 0
#define Y_HOME_TO_MAX 1
#elif Y_HOME_DIR < 0
#define Y_HOME_TO_MIN 1
#if HAS_Y_AXIS
#if Y_HOME_DIR > 0
#define Y_HOME_TO_MAX 1
#elif Y_HOME_DIR < 0
#define Y_HOME_TO_MIN 1
#endif
#endif
#if Z_HOME_DIR > 0
#define Z_HOME_TO_MAX 1
#elif Z_HOME_DIR < 0
#define Z_HOME_TO_MIN 1
#if HAS_Z_AXIS
#if Z_HOME_DIR > 0
#define Z_HOME_TO_MAX 1
#elif Z_HOME_DIR < 0
#define Z_HOME_TO_MIN 1
#endif
#endif
#if I_HOME_DIR > 0
#define I_HOME_TO_MAX 1
#elif I_HOME_DIR < 0
#define I_HOME_TO_MIN 1
#if HAS_I_AXIS
#if I_HOME_DIR > 0
#define I_HOME_TO_MAX 1
#elif I_HOME_DIR < 0
#define I_HOME_TO_MIN 1
#endif
#endif
#if J_HOME_DIR > 0
#define J_HOME_TO_MAX 1
#elif J_HOME_DIR < 0
#define J_HOME_TO_MIN 1
#if HAS_J_AXIS
#if J_HOME_DIR > 0
#define J_HOME_TO_MAX 1
#elif J_HOME_DIR < 0
#define J_HOME_TO_MIN 1
#endif
#endif
#if K_HOME_DIR > 0
#define K_HOME_TO_MAX 1
#elif K_HOME_DIR < 0
#define K_HOME_TO_MIN 1
#if HAS_K_AXIS
#if K_HOME_DIR > 0
#define K_HOME_TO_MAX 1
#elif K_HOME_DIR < 0
#define K_HOME_TO_MIN 1
#endif
#endif
#if U_HOME_DIR > 0
#define U_HOME_TO_MAX 1
#elif U_HOME_DIR < 0
#define U_HOME_TO_MIN 1
#if HAS_U_AXIS
#if U_HOME_DIR > 0
#define U_HOME_TO_MAX 1
#elif U_HOME_DIR < 0
#define U_HOME_TO_MIN 1
#endif
#endif
#if V_HOME_DIR > 0
#define V_HOME_TO_MAX 1
#elif V_HOME_DIR < 0
#define V_HOME_TO_MIN 1
#if HAS_V_AXIS
#if V_HOME_DIR > 0
#define V_HOME_TO_MAX 1
#elif V_HOME_DIR < 0
#define V_HOME_TO_MIN 1
#endif
#endif
#if W_HOME_DIR > 0
#define W_HOME_TO_MAX 1
#elif W_HOME_DIR < 0
#define W_HOME_TO_MIN 1
#if HAS_W_AXIS
#if W_HOME_DIR > 0
#define W_HOME_TO_MAX 1
#elif W_HOME_DIR < 0
#define W_HOME_TO_MIN 1
#endif
#endif
/**

View File

@ -2641,7 +2641,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#define _PLUG_UNUSED_TEST(A,P) (DISABLED(USE_##P##MIN_PLUG, USE_##P##MAX_PLUG) \
&& !(ENABLED(A##_DUAL_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) \
&& !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) )
#define _AXIS_PLUG_UNUSED_TEST(A) (1 NUM_AXIS_GANG(&& _PLUG_UNUSED_TEST(A,X), && _PLUG_UNUSED_TEST(A,Y), && _PLUG_UNUSED_TEST(A,Z), \
#define _AXIS_PLUG_UNUSED_TEST(A) (HAS_##A##_A NUM_AXIS_GANG(&& _PLUG_UNUSED_TEST(A,X), && _PLUG_UNUSED_TEST(A,Y), && _PLUG_UNUSED_TEST(A,Z), \
&& _PLUG_UNUSED_TEST(A,I), && _PLUG_UNUSED_TEST(A,J), && _PLUG_UNUSED_TEST(A,K), \
&& _PLUG_UNUSED_TEST(A,U), && _PLUG_UNUSED_TEST(A,V), && _PLUG_UNUSED_TEST(A,W) ) )
@ -2656,22 +2656,22 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if _AXIS_PLUG_UNUSED_TEST(Z)
#error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
#endif
#if HAS_I_AXIS && _AXIS_PLUG_UNUSED_TEST(I)
#if _AXIS_PLUG_UNUSED_TEST(I)
#error "You must enable USE_IMIN_PLUG or USE_IMAX_PLUG."
#endif
#if HAS_J_AXIS && _AXIS_PLUG_UNUSED_TEST(J)
#if _AXIS_PLUG_UNUSED_TEST(J)
#error "You must enable USE_JMIN_PLUG or USE_JMAX_PLUG."
#endif
#if HAS_K_AXIS && _AXIS_PLUG_UNUSED_TEST(K)
#if _AXIS_PLUG_UNUSED_TEST(K)
#error "You must enable USE_KMIN_PLUG or USE_KMAX_PLUG."
#endif
#if HAS_U_AXIS && _AXIS_PLUG_UNUSED_TEST(U)
#if _AXIS_PLUG_UNUSED_TEST(U)
#error "You must enable USE_UMIN_PLUG or USE_UMAX_PLUG."
#endif
#if HAS_V_AXIS && _AXIS_PLUG_UNUSED_TEST(V)
#if _AXIS_PLUG_UNUSED_TEST(V)
#error "You must enable USE_VMIN_PLUG or USE_VMAX_PLUG."
#endif
#if HAS_W_AXIS && _AXIS_PLUG_UNUSED_TEST(W)
#if _AXIS_PLUG_UNUSED_TEST(W)
#error "You must enable USE_WMIN_PLUG or USE_WMAX_PLUG."
#endif
@ -2685,29 +2685,29 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "Enable USE_YMIN_PLUG when homing Y to MIN."
#elif Y_HOME_TO_MAX && DISABLED(USE_YMAX_PLUG)
#error "Enable USE_YMAX_PLUG when homing Y to MAX."
#elif HAS_I_AXIS && I_HOME_TO_MIN && DISABLED(USE_IMIN_PLUG)
#elif I_HOME_TO_MIN && DISABLED(USE_IMIN_PLUG)
#error "Enable USE_IMIN_PLUG when homing I to MIN."
#elif HAS_I_AXIS && I_HOME_TO_MAX && DISABLED(USE_IMAX_PLUG)
#elif I_HOME_TO_MAX && DISABLED(USE_IMAX_PLUG)
#error "Enable USE_IMAX_PLUG when homing I to MAX."
#elif HAS_J_AXIS && J_HOME_TO_MIN && DISABLED(USE_JMIN_PLUG)
#elif J_HOME_TO_MIN && DISABLED(USE_JMIN_PLUG)
#error "Enable USE_JMIN_PLUG when homing J to MIN."
#elif HAS_J_AXIS && J_HOME_TO_MAX && DISABLED(USE_JMAX_PLUG)
#elif J_HOME_TO_MAX && DISABLED(USE_JMAX_PLUG)
#error "Enable USE_JMAX_PLUG when homing J to MAX."
#elif HAS_K_AXIS && K_HOME_TO_MIN && DISABLED(USE_KMIN_PLUG)
#elif K_HOME_TO_MIN && DISABLED(USE_KMIN_PLUG)
#error "Enable USE_KMIN_PLUG when homing K to MIN."
#elif HAS_K_AXIS && K_HOME_TO_MAX && DISABLED(USE_KMAX_PLUG)
#elif K_HOME_TO_MAX && DISABLED(USE_KMAX_PLUG)
#error "Enable USE_KMAX_PLUG when homing K to MAX."
#elif HAS_U_AXIS && U_HOME_TO_MIN && DISABLED(USE_UMIN_PLUG)
#elif U_HOME_TO_MIN && DISABLED(USE_UMIN_PLUG)
#error "Enable USE_UMIN_PLUG when homing U to MIN."
#elif HAS_U_AXIS && U_HOME_TO_MAX && DISABLED(USE_UMAX_PLUG)
#elif U_HOME_TO_MAX && DISABLED(USE_UMAX_PLUG)
#error "Enable USE_UMAX_PLUG when homing U to MAX."
#elif HAS_V_AXIS && V_HOME_TO_MIN && DISABLED(USE_VMIN_PLUG)
#elif V_HOME_TO_MIN && DISABLED(USE_VMIN_PLUG)
#error "Enable USE_VMIN_PLUG when homing V to MIN."
#elif HAS_V_AXIS && V_HOME_TO_MAX && DISABLED(USE_VMAX_PLUG)
#elif V_HOME_TO_MAX && DISABLED(USE_VMAX_PLUG)
#error "Enable USE_VMAX_PLUG when homing V to MAX."
#elif HAS_W_AXIS && W_HOME_TO_MIN && DISABLED(USE_WMIN_PLUG)
#elif W_HOME_TO_MIN && DISABLED(USE_WMIN_PLUG)
#error "Enable USE_WMIN_PLUG when homing W to MIN."
#elif HAS_W_AXIS && W_HOME_TO_MAX && DISABLED(USE_WMAX_PLUG)
#elif W_HOME_TO_MAX && DISABLED(USE_WMAX_PLUG)
#error "Enable USE_WMAX_PLUG when homing W to MAX."
#endif
#endif

View File

@ -438,7 +438,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
else if (axis_should_home(axis))
while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
lcd_put_u8str(TERN0(HAS_Z_AXIS, axis == Z_AXIS) ? F(" ") : F(" "));
else
lcd_put_u8str(value);
}
@ -500,7 +500,13 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
*/
void MarlinUI::draw_status_screen() {
constexpr int xystorage = TERN(INCH_MODE_SUPPORT, 8, 5);
static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, xystorage)], ystring[xystorage], zstring[8];
static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, xystorage)];
#if HAS_Y_AXIS
static char ystring[xystorage];
#endif
#if HAS_Z_AXIS
static char zstring[8];
#endif
#if ENABLED(FILAMENT_LCD_DISPLAY)
static char wstring[5], mstring[4];
@ -525,7 +531,9 @@ void MarlinUI::draw_status_screen() {
const xyz_pos_t lpos = current_position.asLogical();
const bool is_inch = parser.using_inch_units();
strcpy(zstring, is_inch ? ftostr42_52(LINEAR_UNIT(lpos.z)) : ftostr52sp(lpos.z));
#if HAS_Z_AXIS
strcpy(zstring, is_inch ? ftostr42_52(LINEAR_UNIT(lpos.z)) : ftostr52sp(lpos.z));
#endif
if (show_e_total) {
#if ENABLED(LCD_SHOW_E_TOTAL)
@ -535,7 +543,7 @@ void MarlinUI::draw_status_screen() {
}
else {
strcpy(xstring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.x)) : ftostr4sign(lpos.x));
strcpy(ystring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.y)) : ftostr4sign(lpos.y));
TERN_(HAS_Y_AXIS, strcpy(ystring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.y)) : ftostr4sign(lpos.y)));
}
#if ENABLED(FILAMENT_LCD_DISPLAY)
@ -858,12 +866,14 @@ void MarlinUI::draw_status_screen() {
}
else {
_draw_axis_value(X_AXIS, xstring, blink);
_draw_axis_value(Y_AXIS, ystring, blink);
TERN_(HAS_Y_AXIS, _draw_axis_value(Y_AXIS, ystring, blink));
}
#endif
_draw_axis_value(Z_AXIS, zstring, blink);
#if HAS_Z_AXIS
_draw_axis_value(Z_AXIS, zstring, blink);
#endif
#if NONE(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME)
u8g.setColorIndex(1); // black on white

View File

@ -477,7 +477,9 @@ void menu_backlash();
// M201 / M204 Accelerations
void menu_advanced_acceleration() {
const float max_accel = _MAX(planner.settings.max_acceleration_mm_per_s2[A_AXIS], planner.settings.max_acceleration_mm_per_s2[B_AXIS], planner.settings.max_acceleration_mm_per_s2[C_AXIS]);
float max_accel = planner.settings.max_acceleration_mm_per_s2[A_AXIS];
TERN_(HAS_Y_AXIS, NOLESS(max_accel, planner.settings.max_acceleration_mm_per_s2[B_AXIS]));
TERN_(HAS_Z_AXIS, NOLESS(max_accel, planner.settings.max_acceleration_mm_per_s2[C_AXIS]));
// M201 settings
constexpr xyze_ulong_t max_accel_edit =

View File

@ -28,7 +28,7 @@
#if HAS_MARLINUI_MENU
#define LARGE_AREA_TEST ((X_BED_SIZE) >= 1000 || (Y_BED_SIZE) >= 1000 || (Z_MAX_POS) >= 1000)
#define LARGE_AREA_TEST ((X_BED_SIZE) >= 1000 || TERN0(HAS_Y_AXIS, (Y_BED_SIZE) >= 1000) || TERN0(HAS_Z_AXIS, (Z_MAX_POS) >= 1000))
#include "menu_item.h"
#include "menu_addon.h"
@ -160,8 +160,10 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); });
SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); });
SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); });
if (axis == Z_AXIS && (FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f)
SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); });
#if HAS_Z_AXIS
if (axis == Z_AXIS && (FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f)
SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); });
#endif
}
END_MENU();
}