|
@@ -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
|
|
|
|