Skip to content

Commit

Permalink
🚸 MarlinUI Endstop Test Screen, and more (#25667)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored Apr 22, 2023
1 parent 98277f2 commit 4233e48
Show file tree
Hide file tree
Showing 22 changed files with 960 additions and 799 deletions.
3 changes: 3 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,9 @@
// Insert a menu for preheating at the top level to allow for quick access
//#define PREHEAT_SHORTCUT_MENU_ITEM

// Add Configuration > Debug Menu > Endstop Test for endstop/probe/runout testing
//#define LCD_ENDSTOP_TEST

#endif // HAS_MARLINUI_MENU

#if HAS_DISPLAY
Expand Down
36 changes: 18 additions & 18 deletions Marlin/src/gcode/calibrate/G425.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,33 +271,33 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t
#if AXIS_CAN_CALIBRATE(X)
_ACASE(X, RIGHT, LEFT);
#endif
#if HAS_Y_AXIS && AXIS_CAN_CALIBRATE(Y)
#if AXIS_CAN_CALIBRATE(Y)
_ACASE(Y, BACK, FRONT);
#endif
#if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z)
#if AXIS_CAN_CALIBRATE(Z)
case TOP: {
const float measurement = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty);
m.obj_center.z = measurement - dimensions.z / 2;
m.obj_side[TOP] = measurement;
return;
}
#endif
#if HAS_I_AXIS && AXIS_CAN_CALIBRATE(I)
#if AXIS_CAN_CALIBRATE(I)
_PCASE(I);
#endif
#if HAS_J_AXIS && AXIS_CAN_CALIBRATE(J)
#if AXIS_CAN_CALIBRATE(J)
_PCASE(J);
#endif
#if HAS_K_AXIS && AXIS_CAN_CALIBRATE(K)
#if AXIS_CAN_CALIBRATE(K)
_PCASE(K);
#endif
#if HAS_U_AXIS && AXIS_CAN_CALIBRATE(U)
#if AXIS_CAN_CALIBRATE(U)
_PCASE(U);
#endif
#if HAS_V_AXIS && AXIS_CAN_CALIBRATE(V)
#if AXIS_CAN_CALIBRATE(V)
_PCASE(V);
#endif
#if HAS_W_AXIS && AXIS_CAN_CALIBRATE(W)
#if AXIS_CAN_CALIBRATE(W)
_PCASE(W);
#endif
default: return;
Expand Down Expand Up @@ -395,7 +395,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
#if ENABLED(CALIBRATION_REPORTING)
inline void report_measured_faces(const measurements_t &m) {
SERIAL_ECHOLNPGM("Sides:");
#if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z)
#if AXIS_CAN_CALIBRATE(Z)
SERIAL_ECHOLNPGM(" Top: ", m.obj_side[TOP]);
#endif
#if ENABLED(CALIBRATION_MEASURE_LEFT)
Expand Down Expand Up @@ -503,58 +503,58 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
SERIAL_ECHOLNPGM(" Right: ", m.backlash[RIGHT]);
#endif
#endif
#if HAS_Y_AXIS && AXIS_CAN_CALIBRATE(Y)
#if AXIS_CAN_CALIBRATE(Y)
#if ENABLED(CALIBRATION_MEASURE_FRONT)
SERIAL_ECHOLNPGM(" Front: ", m.backlash[FRONT]);
#endif
#if ENABLED(CALIBRATION_MEASURE_BACK)
SERIAL_ECHOLNPGM(" Back: ", m.backlash[BACK]);
#endif
#endif
#if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z)
#if AXIS_CAN_CALIBRATE(Z)
SERIAL_ECHOLNPGM(" Top: ", m.backlash[TOP]);
#endif
#if HAS_I_AXIS && AXIS_CAN_CALIBRATE(I)
#if AXIS_CAN_CALIBRATE(I)
#if ENABLED(CALIBRATION_MEASURE_IMIN)
SERIAL_ECHOLNPGM(" " STR_I_MIN ": ", m.backlash[IMINIMUM]);
#endif
#if ENABLED(CALIBRATION_MEASURE_IMAX)
SERIAL_ECHOLNPGM(" " STR_I_MAX ": ", m.backlash[IMAXIMUM]);
#endif
#endif
#if HAS_J_AXIS && AXIS_CAN_CALIBRATE(J)
#if AXIS_CAN_CALIBRATE(J)
#if ENABLED(CALIBRATION_MEASURE_JMIN)
SERIAL_ECHOLNPGM(" " STR_J_MIN ": ", m.backlash[JMINIMUM]);
#endif
#if ENABLED(CALIBRATION_MEASURE_JMAX)
SERIAL_ECHOLNPGM(" " STR_J_MAX ": ", m.backlash[JMAXIMUM]);
#endif
#endif
#if HAS_K_AXIS && AXIS_CAN_CALIBRATE(K)
#if AXIS_CAN_CALIBRATE(K)
#if ENABLED(CALIBRATION_MEASURE_KMIN)
SERIAL_ECHOLNPGM(" " STR_K_MIN ": ", m.backlash[KMINIMUM]);
#endif
#if ENABLED(CALIBRATION_MEASURE_KMAX)
SERIAL_ECHOLNPGM(" " STR_K_MAX ": ", m.backlash[KMAXIMUM]);
#endif
#endif
#if HAS_U_AXIS && AXIS_CAN_CALIBRATE(U)
#if AXIS_CAN_CALIBRATE(U)
#if ENABLED(CALIBRATION_MEASURE_UMIN)
SERIAL_ECHOLNPGM(" " STR_U_MIN ": ", m.backlash[UMINIMUM]);
#endif
#if ENABLED(CALIBRATION_MEASURE_UMAX)
SERIAL_ECHOLNPGM(" " STR_U_MAX ": ", m.backlash[UMAXIMUM]);
#endif
#endif
#if HAS_V_AXIS && AXIS_CAN_CALIBRATE(V)
#if AXIS_CAN_CALIBRATE(V)
#if ENABLED(CALIBRATION_MEASURE_VMIN)
SERIAL_ECHOLNPGM(" " STR_V_MIN ": ", m.backlash[VMINIMUM]);
#endif
#if ENABLED(CALIBRATION_MEASURE_VMAX)
SERIAL_ECHOLNPGM(" " STR_V_MAX ": ", m.backlash[VMAXIMUM]);
#endif
#endif
#if HAS_W_AXIS && AXIS_CAN_CALIBRATE(W)
#if AXIS_CAN_CALIBRATE(W)
#if ENABLED(CALIBRATION_MEASURE_WMIN)
SERIAL_ECHOLNPGM(" " STR_W_MIN ": ", m.backlash[WMINIMUM]);
#endif
Expand All @@ -575,7 +575,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
#if HAS_Y_CENTER && AXIS_CAN_CALIBRATE(Y)
SERIAL_ECHOLNPGM_P(SP_Y_STR, m.pos_error.y);
#endif
#if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z)
#if AXIS_CAN_CALIBRATE(Z)
SERIAL_ECHOLNPGM_P(SP_Z_STR, m.pos_error.z);
#endif
#if HAS_I_CENTER && AXIS_CAN_CALIBRATE(I)
Expand Down
7 changes: 4 additions & 3 deletions Marlin/src/gcode/calibrate/M425.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@
void GcodeSuite::M425() {
bool noArgs = true;

auto axis_can_calibrate = [](const uint8_t a) {
#define _CAN_CASE(N) case N##_AXIS: return AXIS_CAN_CALIBRATE(N);
auto axis_can_calibrate = [](const uint8_t a) -> bool {
#define _CAN_CASE(N) case N##_AXIS: return bool(AXIS_CAN_CALIBRATE(N));
switch (a) {
default: return false;
MAIN_AXIS_MAP(_CAN_CASE)
default: break;
}
return false;
};

LOOP_NUM_AXES(a) {
Expand Down
51 changes: 48 additions & 3 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,14 @@
// Calibration codes only for non-core axes
#if EITHER(BACKLASH_GCODE, CALIBRATION_GCODE)
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
#define CAN_CALIBRATE(A,B) (_AXIS(A) == B)
#define CAN_CALIBRATE(A,B) TERN0(HAS_##A##_AXIS, (_AXIS(A) == B))
#else
#define CAN_CALIBRATE(A,B) true
#define CAN_CALIBRATE(A,B) ENABLED(HAS_##A##_AXIS)
#endif
#define AXIS_CAN_CALIBRATE(A) CAN_CALIBRATE(A,NORMAL_AXIS)
#else
#define AXIS_CAN_CALIBRATE(A) false
#endif
#define AXIS_CAN_CALIBRATE(A) CAN_CALIBRATE(A,NORMAL_AXIS)

/**
* No adjustable bed on non-cartesians
Expand Down Expand Up @@ -2296,6 +2298,49 @@
#define HAS_Z4_MAX 1
#endif

#if HAS_X_MIN || HAS_X_MAX
#define HAS_X_ENDSTOP 1
#endif
#if HAS_X2_MIN || HAS_X2_MAX
#define HAS_X2_ENDSTOP 1
#endif
#if HAS_Y_MIN || HAS_Y_MAX
#define HAS_Y_ENDSTOP 1
#endif
#if HAS_Y2_MIN || HAS_Y2_MAX
#define HAS_Y2_ENDSTOP 1
#endif
#if HAS_Z_MIN || HAS_Z_MAX
#define HAS_Z_ENDSTOP 1
#endif
#if HAS_Z2_MIN || HAS_Z2_MAX
#define HAS_Z2_ENDSTOP 1
#endif
#if HAS_Z3_MIN || HAS_Z3_MAX
#define HAS_Z3_ENDSTOP 1
#endif
#if HAS_Z4_MIN || HAS_Z4_MAX
#define HAS_Z4_ENDSTOP 1
#endif
#if HAS_I_MIN || HAS_I_MAX
#define HAS_I_ENDSTOP 1
#endif
#if HAS_J_MIN || HAS_J_MAX
#define HAS_J_ENDSTOP 1
#endif
#if HAS_K_MIN || HAS_K_MAX
#define HAS_K_ENDSTOP 1
#endif
#if HAS_U_MIN || HAS_U_MAX
#define HAS_U_ENDSTOP 1
#endif
#if HAS_V_MIN || HAS_V_MAX
#define HAS_V_ENDSTOP 1
#endif
#if HAS_W_MIN || HAS_W_MAX
#define HAS_W_ENDSTOP 1
#endif

#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
#define HAS_Z_MIN_PROBE_PIN 1
#endif
Expand Down
Loading

0 comments on commit 4233e48

Please sign in to comment.