M919 : Chopper Timing (#23400)

This commit is contained in:
Scott Lahteine 2022-01-01 22:54:27 -06:00 committed by Scott Lahteine
parent 6d7ffa6add
commit 5ec384f40c
10 changed files with 387 additions and 80 deletions

View File

@ -2975,6 +2975,9 @@
//#define CHOPPER_TIMING_Z2 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_Z3 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_Z4 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_I CHOPPER_TIMING
//#define CHOPPER_TIMING_J CHOPPER_TIMING
//#define CHOPPER_TIMING_K CHOPPER_TIMING
//#define CHOPPER_TIMING_E CHOPPER_TIMING // For Extruders (override below)
//#define CHOPPER_TIMING_E1 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E2 CHOPPER_TIMING_E

View File

@ -64,13 +64,13 @@ class TMCStorage {
uint8_t otpw_count = 0,
error_count = 0;
bool flag_otpw = false;
inline bool getOTPW() { return flag_otpw; }
inline void clear_otpw() { flag_otpw = 0; }
bool getOTPW() { return flag_otpw; }
void clear_otpw() { flag_otpw = 0; }
#endif
inline uint16_t getMilliamps() { return val_mA; }
uint16_t getMilliamps() { return val_mA; }
inline void printLabel() {
void printLabel() {
SERIAL_CHAR(AXIS_LETTER);
if (DRIVER_ID > '0') SERIAL_CHAR(DRIVER_ID);
}
@ -97,25 +97,31 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
TMCMarlin(const uint16_t CS, const float RS, const uint16_t pinMOSI, const uint16_t pinMISO, const uint16_t pinSCK, const uint8_t axis_chain_index) :
TMC(CS, RS, pinMOSI, pinMISO, pinSCK, axis_chain_index)
{}
inline uint16_t rms_current() { return TMC::rms_current(); }
inline void rms_current(uint16_t mA) {
uint16_t rms_current() { return TMC::rms_current(); }
void rms_current(uint16_t mA) {
this->val_mA = mA;
TMC::rms_current(mA);
}
inline void rms_current(const uint16_t mA, const float mult) {
void rms_current(const uint16_t mA, const float mult) {
this->val_mA = mA;
TMC::rms_current(mA, mult);
}
inline uint16_t get_microstep_counter() { return TMC::MSCNT(); }
uint16_t get_microstep_counter() { return TMC::MSCNT(); }
#if HAS_STEALTHCHOP
inline bool get_stealthChop() { return this->en_pwm_mode(); }
inline bool get_stored_stealthChop() { return this->stored.stealthChop_enabled; }
inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); }
inline void set_stealthChop(const bool stch) { this->stored.stealthChop_enabled = stch; refresh_stepping_mode(); }
inline bool toggle_stepping_mode() { set_stealthChop(!this->stored.stealthChop_enabled); return get_stealthChop(); }
bool get_stealthChop() { return this->en_pwm_mode(); }
bool get_stored_stealthChop() { return this->stored.stealthChop_enabled; }
void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); }
void set_stealthChop(const bool stch) { this->stored.stealthChop_enabled = stch; refresh_stepping_mode(); }
bool toggle_stepping_mode() { set_stealthChop(!this->stored.stealthChop_enabled); return get_stealthChop(); }
#endif
void set_chopper_times(const chopper_timing_t &ct) {
TMC::toff(ct.toff);
TMC::hysteresis_end(ct.hend);
TMC::hysteresis_start(ct.hstrt);
}
#if ENABLED(HYBRID_THRESHOLD)
uint32_t get_pwm_thrs() {
return _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
@ -127,7 +133,7 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
#endif
#if USE_SENSORLESS
inline int16_t homing_threshold() { return TMC::sgt(); }
int16_t homing_threshold() { return TMC::sgt(); }
void homing_threshold(int16_t sgt_val) {
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
TMC::sgt(sgt_val);
@ -139,13 +145,13 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
#endif
#if HAS_LCD_MENU
inline void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }
#if ENABLED(HYBRID_THRESHOLD)
inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#if USE_SENSORLESS
inline void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif
#endif
@ -167,24 +173,30 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
{}
uint16_t rms_current() { return TMC2208Stepper::rms_current(); }
inline void rms_current(const uint16_t mA) {
void rms_current(const uint16_t mA) {
this->val_mA = mA;
TMC2208Stepper::rms_current(mA);
}
inline void rms_current(const uint16_t mA, const float mult) {
void rms_current(const uint16_t mA, const float mult) {
this->val_mA = mA;
TMC2208Stepper::rms_current(mA, mult);
}
inline uint16_t get_microstep_counter() { return TMC2208Stepper::MSCNT(); }
uint16_t get_microstep_counter() { return TMC2208Stepper::MSCNT(); }
#if HAS_STEALTHCHOP
inline bool get_stealthChop() { return !this->en_spreadCycle(); }
inline bool get_stored_stealthChop() { return this->stored.stealthChop_enabled; }
inline void refresh_stepping_mode() { this->en_spreadCycle(!this->stored.stealthChop_enabled); }
inline void set_stealthChop(const bool stch) { this->stored.stealthChop_enabled = stch; refresh_stepping_mode(); }
inline bool toggle_stepping_mode() { set_stealthChop(!this->stored.stealthChop_enabled); return get_stealthChop(); }
bool get_stealthChop() { return !this->en_spreadCycle(); }
bool get_stored_stealthChop() { return this->stored.stealthChop_enabled; }
void refresh_stepping_mode() { this->en_spreadCycle(!this->stored.stealthChop_enabled); }
void set_stealthChop(const bool stch) { this->stored.stealthChop_enabled = stch; refresh_stepping_mode(); }
bool toggle_stepping_mode() { set_stealthChop(!this->stored.stealthChop_enabled); return get_stealthChop(); }
#endif
void set_chopper_times(const chopper_timing_t &ct) {
TMC2208Stepper::toff(ct.toff);
TMC2208Stepper::hysteresis_end(ct.hend);
TMC2208Stepper::hysteresis_start(ct.hstrt);
}
#if ENABLED(HYBRID_THRESHOLD)
uint32_t get_pwm_thrs() {
return _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
@ -196,10 +208,10 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
#endif
#if HAS_LCD_MENU
inline void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }
#if ENABLED(HYBRID_THRESHOLD)
inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#endif
};
@ -215,24 +227,30 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
{}
uint8_t get_address() { return slave_address; }
uint16_t rms_current() { return TMC2209Stepper::rms_current(); }
inline void rms_current(const uint16_t mA) {
void rms_current(const uint16_t mA) {
this->val_mA = mA;
TMC2209Stepper::rms_current(mA);
}
inline void rms_current(const uint16_t mA, const float mult) {
void rms_current(const uint16_t mA, const float mult) {
this->val_mA = mA;
TMC2209Stepper::rms_current(mA, mult);
}
inline uint16_t get_microstep_counter() { return TMC2209Stepper::MSCNT(); }
uint16_t get_microstep_counter() { return TMC2209Stepper::MSCNT(); }
#if HAS_STEALTHCHOP
inline bool get_stealthChop() { return !this->en_spreadCycle(); }
inline bool get_stored_stealthChop() { return this->stored.stealthChop_enabled; }
inline void refresh_stepping_mode() { this->en_spreadCycle(!this->stored.stealthChop_enabled); }
inline void set_stealthChop(const bool stch) { this->stored.stealthChop_enabled = stch; refresh_stepping_mode(); }
inline bool toggle_stepping_mode() { set_stealthChop(!this->stored.stealthChop_enabled); return get_stealthChop(); }
bool get_stealthChop() { return !this->en_spreadCycle(); }
bool get_stored_stealthChop() { return this->stored.stealthChop_enabled; }
void refresh_stepping_mode() { this->en_spreadCycle(!this->stored.stealthChop_enabled); }
void set_stealthChop(const bool stch) { this->stored.stealthChop_enabled = stch; refresh_stepping_mode(); }
bool toggle_stepping_mode() { set_stealthChop(!this->stored.stealthChop_enabled); return get_stealthChop(); }
#endif
void set_chopper_times(const chopper_timing_t &ct) {
TMC2209Stepper::toff(ct.toff);
TMC2209Stepper::hysteresis_end(ct.hend);
TMC2209Stepper::hysteresis_start(ct.hstrt);
}
#if ENABLED(HYBRID_THRESHOLD)
uint32_t get_pwm_thrs() {
return _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
@ -243,7 +261,7 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
}
#endif
#if USE_SENSORLESS
inline int16_t homing_threshold() { return TMC2209Stepper::SGTHRS(); }
int16_t homing_threshold() { return TMC2209Stepper::SGTHRS(); }
void homing_threshold(int16_t sgt_val) {
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
TMC2209Stepper::SGTHRS(sgt_val);
@ -252,13 +270,13 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
#endif
#if HAS_LCD_MENU
inline void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }
#if ENABLED(HYBRID_THRESHOLD)
inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#if USE_SENSORLESS
inline void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif
#endif
@ -275,15 +293,21 @@ class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC266
TMCMarlin(const uint16_t CS, const float RS, const uint16_t pinMOSI, const uint16_t pinMISO, const uint16_t pinSCK, const uint8_t) :
TMC2660Stepper(CS, RS, pinMOSI, pinMISO, pinSCK)
{}
inline uint16_t rms_current() { return TMC2660Stepper::rms_current(); }
inline void rms_current(const uint16_t mA) {
uint16_t rms_current() { return TMC2660Stepper::rms_current(); }
void rms_current(const uint16_t mA) {
this->val_mA = mA;
TMC2660Stepper::rms_current(mA);
}
inline uint16_t get_microstep_counter() { return TMC2660Stepper::mstep(); }
uint16_t get_microstep_counter() { return TMC2660Stepper::mstep(); }
void set_chopper_times(const chopper_timing_t &ct) {
TMC2660Stepper::toff(ct.toff);
TMC2660Stepper::hysteresis_end(ct.hend);
TMC2660Stepper::hysteresis_start(ct.hstrt);
}
#if USE_SENSORLESS
inline int16_t homing_threshold() { return TMC2660Stepper::sgt(); }
int16_t homing_threshold() { return TMC2660Stepper::sgt(); }
void homing_threshold(int16_t sgt_val) {
sgt_val = (int16_t)constrain(sgt_val, sgt_min, sgt_max);
TMC2660Stepper::sgt(sgt_val);
@ -292,10 +316,10 @@ class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC266
#endif
#if HAS_LCD_MENU
inline void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }
#if USE_SENSORLESS
inline void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif
#endif

View File

@ -63,16 +63,18 @@ void GcodeSuite::M906() {
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
report = false;
switch (i) {
case X_AXIS:
#if AXIS_IS_TMC(X)
if (index < 0 || index == 0) TMC_SET_CURRENT(X);
#endif
#if AXIS_IS_TMC(X2)
if (index < 0 || index == 1) TMC_SET_CURRENT(X2);
#endif
break;
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)
case X_AXIS:
#if AXIS_IS_TMC(X)
if (index < 0 || index == 0) TMC_SET_CURRENT(X);
#endif
#if AXIS_IS_TMC(X2)
if (index < 0 || index == 1) TMC_SET_CURRENT(X2);
#endif
break;
#endif
#if HAS_Y_AXIS
#if AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2)
case Y_AXIS:
#if AXIS_IS_TMC(Y)
if (index < 0 || index == 0) TMC_SET_CURRENT(Y);
@ -83,7 +85,7 @@ void GcodeSuite::M906() {
break;
#endif
#if HAS_Z_AXIS
#if AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) || AXIS_IS_TMC(Z4)
case Z_AXIS:
#if AXIS_IS_TMC(Z)
if (index < 0 || index == 0) TMC_SET_CURRENT(Z);
@ -110,7 +112,7 @@ void GcodeSuite::M906() {
case K_AXIS: TMC_SET_CURRENT(K); break;
#endif
#if E_STEPPERS
#if AXIS_IS_TMC(E0) || AXIS_IS_TMC(E1) || AXIS_IS_TMC(E2) || AXIS_IS_TMC(E3) || AXIS_IS_TMC(E4) || AXIS_IS_TMC(E5) || AXIS_IS_TMC(E6) || AXIS_IS_TMC(E7)
case E_AXIS: {
const int8_t eindex = get_target_e_stepper_from_command(-2);
#if AXIS_IS_TMC(E0)

View File

@ -264,14 +264,28 @@
LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(axis_codes[i])) {
report = false;
switch (i) {
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));
break;
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));
break;
#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));
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));
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));
break;
#endif
#if I_HAS_STEALTHCHOP
case I_AXIS: TMC_SET_PWMTHRS(I,I); break;
@ -283,13 +297,7 @@
case K_AXIS: TMC_SET_PWMTHRS(K,K); break;
#endif
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));
break;
#if E_STEPPERS
#if E0_HAS_STEALTHCHOP || E1_HAS_STEALTHCHOP || E2_HAS_STEALTHCHOP || E3_HAS_STEALTHCHOP || E4_HAS_STEALTHCHOP || E5_HAS_STEALTHCHOP || E6_HAS_STEALTHCHOP || E7_HAS_STEALTHCHOP
case E_AXIS: {
const int8_t eindex = get_target_e_stepper_from_command(-2);
TERN_(E0_HAS_STEALTHCHOP, if (eindex < 0 || eindex == 0) TMC_SET_PWMTHRS_E(0));

View File

@ -0,0 +1,266 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_TRINAMIC_CONFIG
#if AXIS_COLLISION('I')
#error "M919 parameter collision with axis name."
#endif
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
#include "../../../module/stepper/indirection.h"
#define DEBUG_OUT ENABLED(MARLIN_DEV_MODE)
#include "../../../core/debug_out.h"
template<typename TMC>
static void tmc_print_chopper_time(TMC &st) {
st.printLabel();
SERIAL_ECHOLNPGM(" chopper .toff: ", st.toff(),
" .hend: ", st.hysteresis_end(),
" .hstrt: ", st.hysteresis_start());
}
/**
* M919: Set TMC stepper driver chopper times
*
* Parameters:
* XYZ...E - Selected axes
* I[index] - Axis sub-index (Omit for all XYZ steppers, 1 for X2, Y2, Z2; 2 for Z3; 3 for Z4)
* T[index] - Extruder index (Zero-based. Omit for all extruders.)
* O - time-off [ 1..15]
* P - hysteresis_end [-3..12]
* S - hysteresis_start [ 1...8]
*
* With no parameters report chopper times for all axes
*/
void GcodeSuite::M919() {
bool err = false;
int8_t toff = int8_t(parser.intval('O', -127));
if (toff != -127) {
if (WITHIN(toff, 1, 15))
DEBUG_ECHOLNPGM(".toff: ", toff);
else {
SERIAL_ECHOLNPGM("?O out of range (1..15)");
err = true;
}
}
int8_t hend = int8_t(parser.intval('P', -127));
if (hend != -127) {
if (WITHIN(hend, -3, 12))
DEBUG_ECHOLNPGM(".hend: ", hend);
else {
SERIAL_ECHOLNPGM("?P out of range (-3..12)");
err = true;
}
}
int8_t hstrt = int8_t(parser.intval('S', -127));
if (hstrt != -127) {
if (WITHIN(hstrt, 1, 8))
DEBUG_ECHOLNPGM(".hstrt: ", hstrt);
else {
SERIAL_ECHOLNPGM("?S out of range (1..8)");
err = true;
}
}
if (err) return;
#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');
#else
constexpr int8_t index = -1;
#endif
auto make_chopper_timing = [](chopper_timing_t bct, const int8_t toff, const int8_t hend, const int8_t hstrt) {
chopper_timing_t uct = bct;
if (toff != -127) uct.toff = toff;
if (hend != -127) uct.hend = hend;
if (hstrt != -127) uct.hstrt = hstrt;
return uct;
};
#define TMC_SET_CHOPPER_TIME(Q) stepper##Q.set_chopper_times(make_chopper_timing(CHOPPER_TIMING_##Q, toff, hend, hstrt))
#if AXIS_IS_TMC(E0) || AXIS_IS_TMC(E1) || AXIS_IS_TMC(E2) || AXIS_IS_TMC(E3) || AXIS_IS_TMC(E4) || AXIS_IS_TMC(E5) || AXIS_IS_TMC(E6) || AXIS_IS_TMC(E7)
#define HAS_E_CHOPPER 1
int8_t eindex = -1;
#endif
bool report = true;
LOOP_LOGICAL_AXES(i) if (parser.seen_test(axis_codes[i])) {
report = false;
// Get the chopper timing for the specified axis and index
switch (i) {
default: // A specified axis isn't Trinamic
SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(axis_codes[i]), " has no TMC drivers.");
break;
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)
case X_AXIS:
#if AXIS_IS_TMC(X)
if (index <= 0) TMC_SET_CHOPPER_TIME(X);
#endif
#if AXIS_IS_TMC(X2)
if (index < 0 || index == 1) TMC_SET_CHOPPER_TIME(X2);
#endif
break;
#endif
#if AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2)
case Y_AXIS:
#if AXIS_IS_TMC(Y)
if (index <= 0) TMC_SET_CHOPPER_TIME(Y);
#endif
#if AXIS_IS_TMC(Y2)
if (index < 0 || index == 1) TMC_SET_CHOPPER_TIME(Y2);
#endif
break;
#endif
#if AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) || AXIS_IS_TMC(Z4)
case Z_AXIS:
#if AXIS_IS_TMC(Z)
if (index <= 0) TMC_SET_CHOPPER_TIME(Z);
#endif
#if AXIS_IS_TMC(Z2)
if (index < 0 || index == 1) TMC_SET_CHOPPER_TIME(Z2);
#endif
#if AXIS_IS_TMC(Z3)
if (index < 0 || index == 2) TMC_SET_CHOPPER_TIME(Z3);
#endif
#if AXIS_IS_TMC(Z4)
if (index < 0 || index == 3) TMC_SET_CHOPPER_TIME(Z4);
#endif
break;
#endif
#if AXIS_IS_TMC(I)
case I_AXIS: TMC_SET_CHOPPER_TIME(I); break;
#endif
#if AXIS_IS_TMC(J)
case J_AXIS: TMC_SET_CHOPPER_TIME(J); break;
#endif
#if AXIS_IS_TMC(K)
case K_AXIS: TMC_SET_CHOPPER_TIME(K); break;
#endif
#if HAS_E_CHOPPER
case E_AXIS: {
#if AXIS_IS_TMC(E0)
if (eindex <= 0) TMC_SET_CHOPPER_TIME(E0);
#endif
#if AXIS_IS_TMC(E1)
if (eindex < 0 || eindex == 1) TMC_SET_CHOPPER_TIME(E1);
#endif
#if AXIS_IS_TMC(E2)
if (eindex < 0 || eindex == 2) TMC_SET_CHOPPER_TIME(E2);
#endif
#if AXIS_IS_TMC(E3)
if (eindex < 0 || eindex == 3) TMC_SET_CHOPPER_TIME(E3);
#endif
#if AXIS_IS_TMC(E4)
if (eindex < 0 || eindex == 4) TMC_SET_CHOPPER_TIME(E4);
#endif
#if AXIS_IS_TMC(E5)
if (eindex < 0 || eindex == 5) TMC_SET_CHOPPER_TIME(E5);
#endif
#if AXIS_IS_TMC(E6)
if (eindex < 0 || eindex == 6) TMC_SET_CHOPPER_TIME(E6);
#endif
#if AXIS_IS_TMC(E7)
if (eindex < 0 || eindex == 7) TMC_SET_CHOPPER_TIME(E7);
#endif
} break;
#endif
}
}
if (report) {
#define TMC_SAY_CHOPPER_TIME(Q) tmc_print_chopper_time(stepper##Q)
#if AXIS_IS_TMC(X)
TMC_SAY_CHOPPER_TIME(X);
#endif
#if AXIS_IS_TMC(X2)
TMC_SAY_CHOPPER_TIME(X2);
#endif
#if AXIS_IS_TMC(Y)
TMC_SAY_CHOPPER_TIME(Y);
#endif
#if AXIS_IS_TMC(Y2)
TMC_SAY_CHOPPER_TIME(Y2);
#endif
#if AXIS_IS_TMC(Z)
TMC_SAY_CHOPPER_TIME(Z);
#endif
#if AXIS_IS_TMC(Z2)
TMC_SAY_CHOPPER_TIME(Z2);
#endif
#if AXIS_IS_TMC(Z3)
TMC_SAY_CHOPPER_TIME(Z3);
#endif
#if AXIS_IS_TMC(Z4)
TMC_SAY_CHOPPER_TIME(Z4);
#endif
#if AXIS_IS_TMC(I)
TMC_SAY_CHOPPER_TIME(I);
#endif
#if AXIS_IS_TMC(J)
TMC_SAY_CHOPPER_TIME(J);
#endif
#if AXIS_IS_TMC(K)
TMC_SAY_CHOPPER_TIME(K);
#endif
#if AXIS_IS_TMC(E0)
TMC_SAY_CHOPPER_TIME(E0);
#endif
#if AXIS_IS_TMC(E1)
TMC_SAY_CHOPPER_TIME(E1);
#endif
#if AXIS_IS_TMC(E2)
TMC_SAY_CHOPPER_TIME(E2);
#endif
#if AXIS_IS_TMC(E3)
TMC_SAY_CHOPPER_TIME(E3);
#endif
#if AXIS_IS_TMC(E4)
TMC_SAY_CHOPPER_TIME(E4);
#endif
#if AXIS_IS_TMC(E5)
TMC_SAY_CHOPPER_TIME(E5);
#endif
#if AXIS_IS_TMC(E6)
TMC_SAY_CHOPPER_TIME(E6);
#endif
#if AXIS_IS_TMC(E7)
TMC_SAY_CHOPPER_TIME(E7);
#endif
}
}
#endif // HAS_TRINAMIC_CONFIG

View File

@ -971,6 +971,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#if USE_SENSORLESS
case 914: M914(); break; // M914: Set StallGuard sensitivity.
#endif
case 919: M919(); break; // M919: Set stepper Chopper Times
#endif
#if HAS_L64XX

View File

@ -296,6 +296,7 @@
* M916 - L6470 tuning: Increase KVAL_HOLD until thermal warning. (Requires at least one _DRIVER_TYPE L6470)
* M917 - L6470 tuning: Find minimum current thresholds. (Requires at least one _DRIVER_TYPE L6470)
* M918 - L6470 tuning: Increase speed until max or error. (Requires at least one _DRIVER_TYPE L6470)
* M919 - Get or Set motor Chopper Times (time_off, hysteresis_end, hysteresis_start) using axis codes XYZE, etc. If no parameters are given, report. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
* M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER)
* M3426 - Read MCP3426 ADC over I2C. (Requires HAS_MCP3426_ADC)
* M7219 - Control Max7219 Matrix LEDs. (Requires MAX7219_GCODE)
@ -1140,6 +1141,7 @@ private:
static void M914();
static void M914_report(const bool forReplay=true);
#endif
static void M919();
#endif
#if HAS_L64XX

View File

@ -2395,28 +2395,28 @@
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
//
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && NONE(TEMP_SENSOR_##P##_IS_MAX_TC, TEMP_SENSOR_##P##_IS_DUMMY))
#if HAS_ADC_TEST(0)
#if HOTENDS > 0 && HAS_ADC_TEST(0)
#define HAS_TEMP_ADC_0 1
#endif
#if HAS_ADC_TEST(1)
#if HOTENDS > 1 && HAS_ADC_TEST(1)
#define HAS_TEMP_ADC_1 1
#endif
#if HAS_ADC_TEST(2)
#if HOTENDS > 2 && HAS_ADC_TEST(2)
#define HAS_TEMP_ADC_2 1
#endif
#if HAS_ADC_TEST(3)
#if HOTENDS > 3 && HAS_ADC_TEST(3)
#define HAS_TEMP_ADC_3 1
#endif
#if HAS_ADC_TEST(4)
#if HOTENDS > 4 && HAS_ADC_TEST(4)
#define HAS_TEMP_ADC_4 1
#endif
#if HAS_ADC_TEST(5)
#if HOTENDS > 5 && HAS_ADC_TEST(5)
#define HAS_TEMP_ADC_5 1
#endif
#if HAS_ADC_TEST(6)
#if HOTENDS > 6 && HAS_ADC_TEST(6)
#define HAS_TEMP_ADC_6 1
#endif
#if HAS_ADC_TEST(7)
#if HOTENDS > 7 && HAS_ADC_TEST(7)
#define HAS_TEMP_ADC_7 1
#endif
#if HAS_ADC_TEST(BED)

View File

@ -18,7 +18,7 @@ POSTMORTEM_DEBUGGING = src_filter=+<src/HAL/shared/cpu_excepti
build_flags=-funwind-tables
MKS_WIFI_MODULE = QRCode=https://github.com/makerbase-mks/QRCode/archive/master.zip
HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.3
src_filter=+<src/feature/tmc_util.cpp> +<src/module/stepper/trinamic.cpp> +<src/gcode/feature/trinamic/M122.cpp> +<src/gcode/feature/trinamic/M906.cpp> +<src/gcode/feature/trinamic/M911-M914.cpp>
src_filter=+<src/feature/tmc_util.cpp> +<src/module/stepper/trinamic.cpp> +<src/gcode/feature/trinamic/M122.cpp> +<src/gcode/feature/trinamic/M906.cpp> +<src/gcode/feature/trinamic/M911-M914.cpp> +<src/gcode/feature/trinamic/M919.cpp>
HAS_STEALTHCHOP = src_filter=+<src/gcode/feature/trinamic/M569.cpp>
SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
HAS_MOTOR_CURRENT_I2C = SlowSoftI2CMaster

View File

@ -204,6 +204,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
-<src/gcode/feature/trinamic/M569.cpp>
-<src/gcode/feature/trinamic/M906.cpp>
-<src/gcode/feature/trinamic/M911-M914.cpp>
-<src/gcode/feature/trinamic/M919.cpp>
-<src/gcode/geometry/G17-G19.cpp>
-<src/gcode/geometry/G53-G59.cpp>
-<src/gcode/geometry/M206_M428.cpp>