TMC LCD followup (#14134)

This commit is contained in:
teemuatlut 2019-05-28 05:24:20 +03:00 committed by Scott Lahteine
parent 6d92a0a33b
commit bf4a0db97f
2 changed files with 29 additions and 32 deletions

View file

@ -565,24 +565,16 @@
case TMC_VSENSE: print_vsense(st); break; case TMC_VSENSE: print_vsense(st); break;
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
case TMC_TSTEP: { case TMC_TSTEP: {
uint32_t tstep_value = st.TSTEP(); const uint32_t tstep_value = st.TSTEP();
if (tstep_value == 0xFFFFF) SERIAL_ECHOPGM("max"); if (tstep_value != 0xFFFFF) SERIAL_ECHO(tstep_value); else SERIAL_ECHOPGM("max");
else SERIAL_ECHO(tstep_value); } break;
} #if ENABLED(HYBRID_THRESHOLD)
break; case TMC_TPWMTHRS: SERIAL_ECHO(uint32_t(st.TPWMTHRS())); break;
case TMC_TPWMTHRS: { case TMC_TPWMTHRS_MMS: {
uint32_t tpwmthrs_val = st.TPWMTHRS(); const uint32_t tpwmthrs_val = st.get_pwm_thrs();
SERIAL_ECHO(tpwmthrs_val); if (tpwmthrs_val) SERIAL_ECHO(tpwmthrs_val); else SERIAL_CHAR('-');
} } break;
break; #endif
case TMC_TPWMTHRS_MMS: {
uint32_t tpwmthrs_val = st.get_pwm_thrs();
if (tpwmthrs_val)
SERIAL_ECHO(tpwmthrs_val);
else
SERIAL_CHAR('-');
}
break;
case TMC_OTPW: serialprint_truefalse(st.otpw()); break; case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
#if ENABLED(MONITOR_DRIVER_STATUS) #if ENABLED(MONITOR_DRIVER_STATUS)
case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break; case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;

View file

@ -66,7 +66,12 @@
#define ___TMC_CLASS(MODEL, A, I, E) ____TMC_CLASS(MODEL, A, I, E) #define ___TMC_CLASS(MODEL, A, I, E) ____TMC_CLASS(MODEL, A, I, E)
#define __TMC_CLASS(MODEL, A, I, E) ___TMC_CLASS(_##MODEL, A, I, E) #define __TMC_CLASS(MODEL, A, I, E) ___TMC_CLASS(_##MODEL, A, I, E)
#define _TMC_CLASS(MODEL, L, E) __TMC_CLASS(MODEL, L, E) #define _TMC_CLASS(MODEL, L, E) __TMC_CLASS(MODEL, L, E)
#define TMC_CLASS(ST) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL, ST##_AXIS) #define TMC_CLASS(ST, A) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL, A##_AXIS)
#if ENABLED(DISTINCT_E_FACTORS)
#define TMC_CLASS_E(I) TMC_CLASS(E##I, E##I)
#else
#define TMC_CLASS_E(I) TMC_CLASS(E##I, E)
#endif
typedef struct { typedef struct {
uint8_t toff; uint8_t toff;
@ -101,7 +106,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X_DIR_READ (stepperX.getStatus() & STATUS_DIR) #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(X) #if AXIS_IS_TMC(X)
extern TMC_CLASS(X) stepperX; extern TMC_CLASS(X, X) stepperX;
#endif #endif
#if AXIS_DRIVER_TYPE_X(TMC26X) #if AXIS_DRIVER_TYPE_X(TMC26X)
extern TMC26XStepper stepperX; extern TMC26XStepper stepperX;
@ -136,7 +141,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR) #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(Y) #if AXIS_IS_TMC(Y)
extern TMC_CLASS(Y) stepperY; extern TMC_CLASS(Y, Y) stepperY;
#endif #endif
#if AXIS_DRIVER_TYPE_Y(TMC26X) #if AXIS_DRIVER_TYPE_Y(TMC26X)
extern TMC26XStepper stepperY; extern TMC26XStepper stepperY;
@ -171,7 +176,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR) #define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(Z) #if AXIS_IS_TMC(Z)
extern TMC_CLASS(Z) stepperZ; extern TMC_CLASS(Z, Z) stepperZ;
#endif #endif
#if AXIS_DRIVER_TYPE_Z(TMC26X) #if AXIS_DRIVER_TYPE_Z(TMC26X)
extern TMC26XStepper stepperZ; extern TMC26XStepper stepperZ;
@ -207,7 +212,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR) #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(X2) #if AXIS_IS_TMC(X2)
extern TMC_CLASS(X2) stepperX2; extern TMC_CLASS(X2, X) stepperX2;
#endif #endif
#if AXIS_DRIVER_TYPE_X2(TMC26X) #if AXIS_DRIVER_TYPE_X2(TMC26X)
extern TMC26XStepper stepperX2; extern TMC26XStepper stepperX2;
@ -244,7 +249,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR) #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(Y2) #if AXIS_IS_TMC(Y2)
extern TMC_CLASS(Y2) stepperY2; extern TMC_CLASS(Y2, Y) stepperY2;
#endif #endif
#if AXIS_DRIVER_TYPE_Y2(TMC26X) #if AXIS_DRIVER_TYPE_Y2(TMC26X)
extern TMC26XStepper stepperY2; extern TMC26XStepper stepperY2;
@ -283,7 +288,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR) #define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(Z2) #if AXIS_IS_TMC(Z2)
extern TMC_CLASS(Z2) stepperZ2; extern TMC_CLASS(Z2, Z) stepperZ2;
#endif #endif
#if AXIS_DRIVER_TYPE_Z2(TMC26X) #if AXIS_DRIVER_TYPE_Z2(TMC26X)
extern TMC26XStepper stepperZ2; extern TMC26XStepper stepperZ2;
@ -322,7 +327,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z3_DIR_READ (stepperZ3.getStatus() & STATUS_DIR) #define Z3_DIR_READ (stepperZ3.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(Z3) #if AXIS_IS_TMC(Z3)
extern TMC_CLASS(Z3) stepperZ3; extern TMC_CLASS(Z3, Z) stepperZ3;
#endif #endif
#if ENABLED(Z3_IS_TMC26X) #if ENABLED(Z3_IS_TMC26X)
extern TMC26XStepper stepperZ3; extern TMC26XStepper stepperZ3;
@ -360,7 +365,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR) #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(E0) #if AXIS_IS_TMC(E0)
extern TMC_CLASS(E0) stepperE0; extern TMC_CLASS_E(0) stepperE0;
#endif #endif
#if AXIS_DRIVER_TYPE_E0(TMC26X) #if AXIS_DRIVER_TYPE_E0(TMC26X)
extern TMC26XStepper stepperE0; extern TMC26XStepper stepperE0;
@ -395,7 +400,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR) #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(E1) #if AXIS_IS_TMC(E1)
extern TMC_CLASS(E1) stepperE1; extern TMC_CLASS_E(1) stepperE1;
#endif #endif
#if AXIS_DRIVER_TYPE_E1(TMC26X) #if AXIS_DRIVER_TYPE_E1(TMC26X)
extern TMC26XStepper stepperE1; extern TMC26XStepper stepperE1;
@ -430,7 +435,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR) #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(E2) #if AXIS_IS_TMC(E2)
extern TMC_CLASS(E2) stepperE2; extern TMC_CLASS_E(2) stepperE2;
#endif #endif
#if AXIS_DRIVER_TYPE_E2(TMC26X) #if AXIS_DRIVER_TYPE_E2(TMC26X)
extern TMC26XStepper stepperE2; extern TMC26XStepper stepperE2;
@ -465,7 +470,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR) #define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(E3) #if AXIS_IS_TMC(E3)
extern TMC_CLASS(E3) stepperE3; extern TMC_CLASS_E(3) stepperE3;
#endif #endif
#if AXIS_DRIVER_TYPE_E3(TMC26X) #if AXIS_DRIVER_TYPE_E3(TMC26X)
extern TMC26XStepper stepperE3; extern TMC26XStepper stepperE3;
@ -500,7 +505,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR) #define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(E4) #if AXIS_IS_TMC(E4)
extern TMC_CLASS(E4) stepperE4; extern TMC_CLASS_E(4) stepperE4;
#endif #endif
#if AXIS_DRIVER_TYPE_E4(TMC26X) #if AXIS_DRIVER_TYPE_E4(TMC26X)
extern TMC26XStepper stepperE4; extern TMC26XStepper stepperE4;
@ -535,7 +540,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E5_DIR_READ (stepperE5.getStatus() & STATUS_DIR) #define E5_DIR_READ (stepperE5.getStatus() & STATUS_DIR)
#else #else
#if AXIS_IS_TMC(E5) #if AXIS_IS_TMC(E5)
extern TMC_CLASS(E5) stepperE5; extern TMC_CLASS_E(5) stepperE5;
#endif #endif
#if AXIS_DRIVER_TYPE_E5(TMC26X) #if AXIS_DRIVER_TYPE_E5(TMC26X)
extern TMC26XStepper stepperE5; extern TMC26XStepper stepperE5;