Browse Source

🐛 Update M913, M914 report

Followup to #11248, #11249, #23400
FB4S_WIFI
Scott Lahteine 3 years ago
committed by Scott Lahteine
parent
commit
7b5e2cd786
  1. 38
      Marlin/src/gcode/feature/trinamic/M911-M914.cpp
  2. 8
      Marlin/src/module/settings.cpp

38
Marlin/src/gcode/feature/trinamic/M911-M914.cpp

@ -257,33 +257,33 @@
bool report = true;
#if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) || AXIS_IS_TMC(Z4)
const int8_t index = parser.byteval('I', -1);
const uint8_t index = parser.byteval('I');
#elif AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
constexpr int8_t index = -1;
constexpr uint8_t index = 0;
#endif
LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(axis_codes[i])) {
report = false;
switch (i) {
#if X_HAS_STEALTHCHOP || X2_HAS_STEALTHCHOP
case X_AXIS:
TERN_(X_HAS_STEALTHCHOP, if (index < 0 || index == 0) TMC_SET_PWMTHRS(X,X));
TERN_(X2_HAS_STEALTHCHOP, if (index < 0 || index == 1) TMC_SET_PWMTHRS(X,X2));
TERN_(X_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(X,X));
TERN_(X2_HAS_STEALTHCHOP, if (!(index & 1)) TMC_SET_PWMTHRS(X,X2));
break;
#endif
#if Y_HAS_STEALTHCHOP || Y2_HAS_STEALTHCHOP
case Y_AXIS:
TERN_(Y_HAS_STEALTHCHOP, if (index < 0 || index == 0) TMC_SET_PWMTHRS(Y,Y));
TERN_(Y2_HAS_STEALTHCHOP, if (index < 0 || index == 1) TMC_SET_PWMTHRS(Y,Y2));
TERN_(Y_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(Y,Y));
TERN_(Y2_HAS_STEALTHCHOP, if (!(index & 1)) TMC_SET_PWMTHRS(Y,Y2));
break;
#endif
#if Z_HAS_STEALTHCHOP || Z2_HAS_STEALTHCHOP || Z3_HAS_STEALTHCHOP || Z4_HAS_STEALTHCHOP
case Z_AXIS:
TERN_(Z_HAS_STEALTHCHOP, if (index < 0 || index == 0) TMC_SET_PWMTHRS(Z,Z));
TERN_(Z2_HAS_STEALTHCHOP, if (index < 0 || index == 1) TMC_SET_PWMTHRS(Z,Z2));
TERN_(Z3_HAS_STEALTHCHOP, if (index < 0 || index == 2) TMC_SET_PWMTHRS(Z,Z3));
TERN_(Z4_HAS_STEALTHCHOP, if (index < 0 || index == 3) TMC_SET_PWMTHRS(Z,Z4));
TERN_(Z_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(Z,Z));
TERN_(Z2_HAS_STEALTHCHOP, if (!index || index == 2) TMC_SET_PWMTHRS(Z,Z2));
TERN_(Z3_HAS_STEALTHCHOP, if (!index || index == 3) TMC_SET_PWMTHRS(Z,Z3));
TERN_(Z4_HAS_STEALTHCHOP, if (!index || index == 4) TMC_SET_PWMTHRS(Z,Z4));
break;
#endif
@ -362,7 +362,7 @@
#if X2_HAS_STEALTHCHOP || Y2_HAS_STEALTHCHOP || Z2_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOPGM(" I1");
SERIAL_ECHOPGM(" I2");
#if X2_HAS_STEALTHCHOP
SERIAL_ECHOPGM_P(SP_X_STR, stepperX2.get_pwm_thrs());
#endif
@ -377,12 +377,12 @@
#if Z3_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPGM(" I2 Z", stepperZ3.get_pwm_thrs());
SERIAL_ECHOLNPGM(" I3 Z", stepperZ3.get_pwm_thrs());
#endif
#if Z4_HAS_STEALTHCHOP
say_M913(forReplay);
SERIAL_ECHOLNPGM(" I3 Z", stepperZ4.get_pwm_thrs());
SERIAL_ECHOLNPGM(" I4 Z", stepperZ4.get_pwm_thrs());
#endif
#if I_HAS_STEALTHCHOP
@ -470,9 +470,9 @@
#if Z_SENSORLESS
case Z_AXIS:
if (index < 2) stepperZ.homing_threshold(value);
TERN_(Z2_SENSORLESS, if (index == 0 || index == 2) stepperZ2.homing_threshold(value));
TERN_(Z3_SENSORLESS, if (index == 0 || index == 3) stepperZ3.homing_threshold(value));
TERN_(Z4_SENSORLESS, if (index == 0 || index == 4) stepperZ4.homing_threshold(value));
TERN_(Z2_SENSORLESS, if (!index || index == 2) stepperZ2.homing_threshold(value));
TERN_(Z3_SENSORLESS, if (!index || index == 3) stepperZ3.homing_threshold(value));
TERN_(Z4_SENSORLESS, if (!index || index == 4) stepperZ4.homing_threshold(value));
break;
#endif
#if I_SENSORLESS
@ -526,7 +526,7 @@
#if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOPGM(" I1");
SERIAL_ECHOPGM(" I2");
#if X2_SENSORLESS
SERIAL_ECHOPGM_P(SP_X_STR, stepperX2.homing_threshold());
#endif
@ -541,12 +541,12 @@
#if Z3_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOLNPGM(" I2 Z", stepperZ3.homing_threshold());
SERIAL_ECHOLNPGM(" I3 Z", stepperZ3.homing_threshold());
#endif
#if Z4_SENSORLESS
say_M914(forReplay);
SERIAL_ECHOLNPGM(" I3 Z", stepperZ4.homing_threshold());
SERIAL_ECHOLNPGM(" I4 Z", stepperZ4.homing_threshold());
#endif
#if I_SENSORLESS

8
Marlin/src/module/settings.cpp

@ -430,10 +430,10 @@ typedef struct SettingsDataStruct {
//
// HAS_TRINAMIC_CONFIG
//
tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
tmc_sgt_t tmc_sgt; // M914 X Y Z X2 Y2 Z2 Z3 Z4
tmc_stealth_enabled_t tmc_stealth_enabled; // M569 X Y Z X2 Y2 Z2 Z3 Z4 E0 E1 E2 E3 E4 E5
tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z...
tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z...
tmc_sgt_t tmc_sgt; // M914 X Y Z...
tmc_stealth_enabled_t tmc_stealth_enabled; // M569 X Y Z...
//
// LIN_ADVANCE

Loading…
Cancel
Save