🐛 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

@@ -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();
}