Add support for TMC2660 (#11998)
This commit is contained in:
parent
cf0b9eb37c
commit
c447d75916
|
@ -739,7 +739,7 @@ void setup() {
|
|||
SERIAL_PROTOCOLLNPGM("start");
|
||||
SERIAL_ECHO_START();
|
||||
|
||||
#if HAS_DRIVER(TMC2130)
|
||||
#if TMC_HAS_SPI
|
||||
#if DISABLED(TMC_USE_SW_SPI)
|
||||
SPI.begin();
|
||||
#endif
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
#define TMC2208_STANDALONE 0x00A
|
||||
#define TMC26X 0x10B
|
||||
#define TMC26X_STANDALONE 0x00B
|
||||
#define TMC2660 0x10C
|
||||
#define TMC2660 2660
|
||||
#define TMC2660_STANDALONE 0x00C
|
||||
|
||||
#define _AXIS_DRIVER_TYPE(A,T) ( defined(A##_DRIVER_TYPE) && (A##_DRIVER_TYPE == T) )
|
||||
#define _AXIS_DRIVER_TYPE(A,T) (defined(A##_DRIVER_TYPE) && (A##_DRIVER_TYPE == T))
|
||||
|
||||
#define AXIS_DRIVER_TYPE_X(T) _AXIS_DRIVER_TYPE(X,T)
|
||||
#define AXIS_DRIVER_TYPE_Y(T) _AXIS_DRIVER_TYPE(Y,T)
|
||||
|
@ -67,7 +67,8 @@
|
|||
|
||||
// Test for supported TMC drivers that require advanced configuration
|
||||
// Does not match standalone configurations
|
||||
#define HAS_TRINAMIC (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208))
|
||||
#define HAS_TRINAMIC (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660))
|
||||
|
||||
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE_##A(TMC2130) || \
|
||||
AXIS_DRIVER_TYPE_##A(TMC2208) )
|
||||
AXIS_DRIVER_TYPE_##A(TMC2208) || \
|
||||
AXIS_DRIVER_TYPE_##A(TMC2660) )
|
||||
|
|
|
@ -310,7 +310,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
|||
#endif
|
||||
|
||||
// Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
|
||||
#if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN
|
||||
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660)
|
||||
disable_e_stepper(active_extruder);
|
||||
safe_delay(100);
|
||||
#endif
|
||||
|
|
|
@ -53,8 +53,10 @@
|
|||
bool is_error;
|
||||
};
|
||||
#if HAS_DRIVER(TMC2130)
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); }
|
||||
static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response & 0xF; }
|
||||
#endif
|
||||
static TMC_driver_data get_driver_data(TMC2130Stepper &st) {
|
||||
constexpr uint32_t OTPW_bm = 0x4000000UL;
|
||||
constexpr uint8_t OTPW_bp = 26;
|
||||
|
@ -71,6 +73,7 @@
|
|||
}
|
||||
#endif
|
||||
#if HAS_DRIVER(TMC2208)
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
|
||||
static uint8_t get_status_response(TMC2208Stepper &st) {
|
||||
uint32_t drv_status = st.DRV_STATUS();
|
||||
|
@ -80,6 +83,7 @@
|
|||
response |= gstat & 0b11;
|
||||
return response;
|
||||
}
|
||||
#endif
|
||||
static TMC_driver_data get_driver_data(TMC2208Stepper &st) {
|
||||
constexpr uint32_t OTPW_bm = 0b1ul;
|
||||
constexpr uint8_t OTPW_bp = 0;
|
||||
|
@ -93,6 +97,25 @@
|
|||
return data;
|
||||
}
|
||||
#endif
|
||||
#if HAS_DRIVER(TMC2660)
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
static uint32_t get_pwm_scale(TMC2660Stepper) { return 0; }
|
||||
static uint8_t get_status_response(TMC2660Stepper) { return 0; }
|
||||
#endif
|
||||
static TMC_driver_data get_driver_data(TMC2660Stepper &st) {
|
||||
constexpr uint32_t OTPW_bm = 0x4UL;
|
||||
constexpr uint8_t OTPW_bp = 2;
|
||||
constexpr uint32_t OT_bm = 0x2UL;
|
||||
constexpr uint8_t OT_bp = 1;
|
||||
constexpr uint8_t DRIVER_ERROR_bm = 0x1EUL;
|
||||
TMC_driver_data data;
|
||||
data.drv_status = st.DRVSTATUS();
|
||||
data.is_otpw = (data.drv_status & OTPW_bm) >> OTPW_bp;
|
||||
data.is_ot = (data.drv_status & OT_bm) >> OT_bp;
|
||||
data.is_error = data.drv_status & DRIVER_ERROR_bm;
|
||||
return data;
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename TMC>
|
||||
void monitor_tmc_driver(TMC &st) {
|
||||
|
@ -161,7 +184,7 @@
|
|||
#endif
|
||||
}
|
||||
|
||||
#define HAS_HW_COMMS(ST) AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL))
|
||||
#define HAS_HW_COMMS(ST) AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL))
|
||||
|
||||
void monitor_tmc_driver() {
|
||||
static millis_t next_cOT = 0;
|
||||
|
@ -217,6 +240,16 @@
|
|||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
|
||||
/**
|
||||
* M122 S[1,0] Enable periodic status reports
|
||||
*/
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
void tmc_set_report_status(const bool status) {
|
||||
if ((report_tmc_status = status))
|
||||
SERIAL_ECHOLNPGM("axis:pwm_scale |status_response|");
|
||||
}
|
||||
#endif
|
||||
|
||||
enum TMC_debug_enum : char {
|
||||
TMC_CODES,
|
||||
TMC_ENABLED,
|
||||
|
@ -291,6 +324,7 @@
|
|||
case TMC_STALLGUARD: if (st.stallguard()) SERIAL_CHAR('X'); break;
|
||||
case TMC_SG_RESULT: SERIAL_PRINT(st.sg_result(), DEC); break;
|
||||
case TMC_FSACTIVE: if (st.fsactive()) SERIAL_CHAR('X'); break;
|
||||
case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -312,11 +346,16 @@
|
|||
case TMC_T150: if (st.t150()) SERIAL_CHAR('X'); break;
|
||||
case TMC_T143: if (st.t143()) SERIAL_CHAR('X'); break;
|
||||
case TMC_T120: if (st.t120()) SERIAL_CHAR('X'); break;
|
||||
case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(TMC2660)
|
||||
static void _tmc_parse_drv_status(TMC2660Stepper, const TMC_drv_status_enum) { }
|
||||
#endif
|
||||
|
||||
template <typename TMC>
|
||||
static void tmc_status(TMC &st, const TMC_debug_enum i, const float spmm) {
|
||||
SERIAL_ECHO('\t');
|
||||
|
@ -355,7 +394,9 @@
|
|||
}
|
||||
break;
|
||||
case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
|
||||
#endif
|
||||
case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
|
||||
case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;
|
||||
case TMC_HEND: SERIAL_PRINT(st.hysteresis_end(), DEC); break;
|
||||
|
@ -364,6 +405,34 @@
|
|||
}
|
||||
}
|
||||
|
||||
#if HAS_DRIVER(TMC2660)
|
||||
template<char AXIS_LETTER, char DRIVER_ID>
|
||||
void tmc_status(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> &st, const TMC_debug_enum i, const float) {
|
||||
SERIAL_ECHO('\t');
|
||||
switch (i) {
|
||||
case TMC_CODES: st.printLabel(); break;
|
||||
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
|
||||
case TMC_RMS_CURRENT: SERIAL_PROTOCOL(st.rms_current()); break;
|
||||
case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
|
||||
case TMC_IRUN:
|
||||
SERIAL_PRINT(st.cs(), DEC);
|
||||
SERIAL_ECHOPGM("/31");
|
||||
break;
|
||||
case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
|
||||
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
|
||||
//case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
|
||||
//case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
|
||||
case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
|
||||
case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;
|
||||
case TMC_HEND: SERIAL_PRINT(st.hysteresis_end(), DEC); break;
|
||||
case TMC_HSTRT: SERIAL_PRINT(st.hysteresis_start(), DEC); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename TMC>
|
||||
static void tmc_parse_drv_status(TMC &st, const TMC_drv_status_enum i) {
|
||||
SERIAL_CHAR('\t');
|
||||
|
@ -376,7 +445,6 @@
|
|||
case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('X'); break;
|
||||
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('X'); break;
|
||||
case TMC_OT: if (st.ot()) SERIAL_CHAR('X'); break;
|
||||
case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break;
|
||||
case TMC_DRV_STATUS_HEX:
|
||||
st.printLabel();
|
||||
SERIAL_ECHOPGM("\t0x");
|
||||
|
@ -503,10 +571,6 @@
|
|||
/**
|
||||
* M122 report functions
|
||||
*/
|
||||
void tmc_set_report_status(const bool status) {
|
||||
if ((report_tmc_status = status))
|
||||
SERIAL_ECHOLNPGM("axis:pwm_scale |status_response|");
|
||||
}
|
||||
|
||||
void tmc_report_all() {
|
||||
#define TMC_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_debug_loop(ITEM); }while(0)
|
||||
|
@ -527,8 +591,10 @@
|
|||
TMC_REPORT("pwm\nthreshold\t", TMC_TPWMTHRS);
|
||||
TMC_REPORT("[mm/s]\t", TMC_TPWMTHRS_MMS);
|
||||
TMC_REPORT("OT prewarn", TMC_OTPW);
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
TMC_REPORT("OT prewarn has\n"
|
||||
"been triggered", TMC_OTPW_TRIGGERED);
|
||||
#endif
|
||||
TMC_REPORT("off time\t", TMC_TOFF);
|
||||
TMC_REPORT("blank time", TMC_TBL);
|
||||
TMC_REPORT("hysteresis\n-end\t", TMC_HEND);
|
||||
|
@ -571,53 +637,55 @@
|
|||
#endif
|
||||
st.diag1_stall(enable ? 1 : 0);
|
||||
}
|
||||
void tmc_sensorless_homing(TMC2660Stepper &st, const bool enable) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
#endif // USE_SENSORLESS
|
||||
|
||||
#if HAS_DRIVER(TMC2130)
|
||||
#define IS_TMC_SPI(ST) AXIS_DRIVER_TYPE(ST, TMC2130)
|
||||
#if TMC_HAS_SPI
|
||||
#define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
|
||||
void tmc_init_cs_pins() {
|
||||
#if IS_TMC_SPI(X)
|
||||
#if AXIS_HAS_SPI(X)
|
||||
SET_CS_PIN(X);
|
||||
#endif
|
||||
#if IS_TMC_SPI(Y)
|
||||
#if AXIS_HAS_SPI(Y)
|
||||
SET_CS_PIN(Y);
|
||||
#endif
|
||||
#if IS_TMC_SPI(Z)
|
||||
#if AXIS_HAS_SPI(Z)
|
||||
SET_CS_PIN(Z);
|
||||
#endif
|
||||
#if IS_TMC_SPI(X2)
|
||||
#if AXIS_HAS_SPI(X2)
|
||||
SET_CS_PIN(X2);
|
||||
#endif
|
||||
#if IS_TMC_SPI(Y2)
|
||||
#if AXIS_HAS_SPI(Y2)
|
||||
SET_CS_PIN(Y2);
|
||||
#endif
|
||||
#if IS_TMC_SPI(Z2)
|
||||
#if AXIS_HAS_SPI(Z2)
|
||||
SET_CS_PIN(Z2);
|
||||
#endif
|
||||
#if IS_TMC_SPI(Z3)
|
||||
#if AXIS_HAS_SPI(Z3)
|
||||
SET_CS_PIN(Z3);
|
||||
#endif
|
||||
#if IS_TMC_SPI(E0)
|
||||
#if AXIS_HAS_SPI(E0)
|
||||
SET_CS_PIN(E0);
|
||||
#endif
|
||||
#if IS_TMC_SPI(E1)
|
||||
#if AXIS_HAS_SPI(E1)
|
||||
SET_CS_PIN(E1);
|
||||
#endif
|
||||
#if IS_TMC_SPI(E2)
|
||||
#if AXIS_HAS_SPI(E2)
|
||||
SET_CS_PIN(E2);
|
||||
#endif
|
||||
#if IS_TMC_SPI(E3)
|
||||
#if AXIS_HAS_SPI(E3)
|
||||
SET_CS_PIN(E3);
|
||||
#endif
|
||||
#if IS_TMC_SPI(E4)
|
||||
#if AXIS_HAS_SPI(E4)
|
||||
SET_CS_PIN(E4);
|
||||
#endif
|
||||
#if IS_TMC_SPI(E5)
|
||||
#if AXIS_HAS_SPI(E5)
|
||||
SET_CS_PIN(E5);
|
||||
#endif
|
||||
}
|
||||
#endif // TMC2130
|
||||
#endif // TMC_HAS_SPI
|
||||
|
||||
#endif // HAS_TRINAMIC
|
||||
|
|
|
@ -158,7 +158,9 @@ void tmc_set_sgt(TMC &st, const int8_t sgt_val) {
|
|||
void monitor_tmc_driver();
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
void tmc_set_report_status(const bool status);
|
||||
#endif
|
||||
void tmc_report_all();
|
||||
#endif
|
||||
|
||||
|
@ -171,9 +173,10 @@ void monitor_tmc_driver();
|
|||
*/
|
||||
#if USE_SENSORLESS
|
||||
void tmc_stallguard(TMC2130Stepper &st, const bool enable=true);
|
||||
void tmc_stallguard(TMC2660Stepper &st, const bool enable=true);
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(TMC2130)
|
||||
#if TMC_HAS_SPI
|
||||
void tmc_init_cs_pins();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ void GcodeSuite::M18_M84() {
|
|||
if (parser.seen('X')) disable_X();
|
||||
if (parser.seen('Y')) disable_Y();
|
||||
if (parser.seen('Z')) disable_Z();
|
||||
#if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN // Only disable on boards that have separate ENABLE_PINS
|
||||
// Only disable on boards that have separate ENABLE_PINS or another method for disabling the driver
|
||||
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660)
|
||||
if (parser.seen('E')) disable_e_steppers();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -31,10 +31,14 @@
|
|||
* M122: Debug TMC drivers
|
||||
*/
|
||||
void GcodeSuite::M122() {
|
||||
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
if (parser.seen('S'))
|
||||
tmc_set_report_status(parser.value_bool());
|
||||
else
|
||||
#endif
|
||||
tmc_report_all();
|
||||
|
||||
}
|
||||
|
||||
#endif // TMC_DEBUG
|
||||
|
|
|
@ -461,7 +461,7 @@
|
|||
* Preserve this ordering when adding new drivers.
|
||||
*/
|
||||
|
||||
#define TRINAMICS (HAS_TRINAMIC || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE))
|
||||
#define TRINAMICS (HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE))
|
||||
|
||||
#ifndef MINIMUM_STEPPER_DIR_DELAY
|
||||
#if HAS_DRIVER(TB6560)
|
||||
|
@ -867,13 +867,16 @@
|
|||
#define HAS_SOLENOID_5 (PIN_EXISTS(SOL5))
|
||||
|
||||
// Trinamic Stepper Drivers
|
||||
#define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208))
|
||||
#define HAS_STALLGUARD HAS_DRIVER(TMC2130)
|
||||
#define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
|
||||
#define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130)
|
||||
#if HAS_TRINAMIC
|
||||
#define TMC_HAS_SPI (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660))
|
||||
#define HAS_STALLGUARD (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660))
|
||||
#define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208))
|
||||
#define AXIS_HAS_SPI(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660))
|
||||
#define AXIS_HAS_STALLGUARD(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660))
|
||||
#define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208))
|
||||
|
||||
#define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING))
|
||||
#if USE_SENSORLESS
|
||||
#define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING))
|
||||
#if USE_SENSORLESS
|
||||
// Disable Z axis sensorless homing if a probe is used to home the Z axis
|
||||
#if HOMING_Z_WITH_PROBE
|
||||
#undef Z_STALL_SENSITIVITY
|
||||
|
@ -881,6 +884,7 @@
|
|||
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY))
|
||||
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY))
|
||||
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Endstops and bed probe
|
||||
|
|
|
@ -487,6 +487,74 @@
|
|||
}
|
||||
#endif // TMC2208
|
||||
|
||||
//
|
||||
// TMC2660 Driver objects and inits
|
||||
//
|
||||
#if HAS_DRIVER(TMC2660)
|
||||
|
||||
#include <SPI.h>
|
||||
#include "planner.h"
|
||||
#include "../core/enum.h"
|
||||
|
||||
#if ENABLED(TMC_USE_SW_SPI)
|
||||
#define _TMC2660_DEFINE(ST, L) TMCMarlin<TMC2660Stepper, L> stepper##ST(ST##_CS_PIN, R_SENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK)
|
||||
#define TMC2660_DEFINE(ST) _TMC2660_DEFINE(ST, TMC_##ST##_LABEL)
|
||||
#else
|
||||
#define _TMC2660_DEFINE(ST, L) TMCMarlin<TMC2660Stepper, L> stepper##ST(ST##_CS_PIN, R_SENSE)
|
||||
#define TMC2660_DEFINE(ST) _TMC2660_DEFINE(ST, TMC_##ST##_LABEL)
|
||||
#endif
|
||||
|
||||
// Stepper objects of TMC2660 steppers used
|
||||
#if AXIS_DRIVER_TYPE(X, TMC2660)
|
||||
TMC2660_DEFINE(X);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(X2, TMC2660)
|
||||
TMC2660_DEFINE(X2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(Y, TMC2660)
|
||||
TMC2660_DEFINE(Y);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(Y2, TMC2660)
|
||||
TMC2660_DEFINE(Y2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(Z, TMC2660)
|
||||
TMC2660_DEFINE(Z);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(Z2, TMC2660)
|
||||
TMC2660_DEFINE(Z2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(E0, TMC2660)
|
||||
TMC2660_DEFINE(E0);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(E1, TMC2660)
|
||||
TMC2660_DEFINE(E1);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(E2, TMC2660)
|
||||
TMC2660_DEFINE(E2);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(E3, TMC2660)
|
||||
TMC2660_DEFINE(E3);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(E4, TMC2660)
|
||||
TMC2660_DEFINE(E4);
|
||||
#endif
|
||||
#if AXIS_DRIVER_TYPE(E5, TMC2660)
|
||||
TMC2660_DEFINE(E5);
|
||||
#endif
|
||||
|
||||
template<char AXIS_LETTER, char DRIVER_ID>
|
||||
void tmc_init(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const float) {
|
||||
st.begin();
|
||||
st.rms_current(mA);
|
||||
st.microsteps(microsteps);
|
||||
st.blank_time(24);
|
||||
st.toff(5); // Only enables the driver if used with stealthChop
|
||||
st.intpol(INTERPOLATE);
|
||||
//st.hysteresis_start(3);
|
||||
//st.hysteresis_end(2);
|
||||
}
|
||||
#endif // TMC2660
|
||||
|
||||
void restore_stepper_drivers() {
|
||||
#if AXIS_IS_TMC(X)
|
||||
stepperX.push();
|
||||
|
|
|
@ -101,6 +101,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define X_ENABLE_INIT NOOP
|
||||
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
|
||||
#define X_ENABLE_READ stepperX.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(X, TMC2660)
|
||||
#define X_ENABLE_INIT NOOP
|
||||
#define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? stepperX.savedToff() : 0)
|
||||
#define X_ENABLE_READ stepperX.isEnabled()
|
||||
#else
|
||||
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
|
||||
#define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
|
||||
|
@ -132,6 +136,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define Y_ENABLE_INIT NOOP
|
||||
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
|
||||
#define Y_ENABLE_READ stepperY.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(Y, TMC2660)
|
||||
#define Y_ENABLE_INIT NOOP
|
||||
#define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? stepperY.savedToff() : 0)
|
||||
#define Y_ENABLE_READ stepperY.isEnabled()
|
||||
#else
|
||||
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
|
||||
#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
|
||||
|
@ -163,6 +171,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define Z_ENABLE_INIT NOOP
|
||||
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
|
||||
#define Z_ENABLE_READ stepperZ.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(Z, TMC2660)
|
||||
#define Z_ENABLE_INIT NOOP
|
||||
#define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? stepperZ.savedToff() : 0)
|
||||
#define Z_ENABLE_READ stepperZ.isEnabled()
|
||||
#else
|
||||
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
|
||||
#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
|
||||
|
@ -195,6 +207,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define X2_ENABLE_INIT NOOP
|
||||
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
|
||||
#define X2_ENABLE_READ stepperX2.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(X2, TMC2660)
|
||||
#define X2_ENABLE_INIT NOOP
|
||||
#define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? stepperX2.savedToff() : 0)
|
||||
#define X2_ENABLE_READ stepperX2.isEnabled()
|
||||
#else
|
||||
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
|
||||
#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
|
||||
|
@ -228,6 +244,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define Y2_ENABLE_INIT NOOP
|
||||
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
|
||||
#define Y2_ENABLE_READ stepperY2.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(Y2, TMC2660)
|
||||
#define Y2_ENABLE_INIT NOOP
|
||||
#define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? stepperY2.savedToff() : 0)
|
||||
#define Y2_ENABLE_READ stepperY2.isEnabled()
|
||||
#else
|
||||
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
|
||||
#define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
|
||||
|
@ -261,6 +281,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define Z2_ENABLE_INIT NOOP
|
||||
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
|
||||
#define Z2_ENABLE_READ stepperZ2.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(Z2, TMC2660)
|
||||
#define Z2_ENABLE_INIT NOOP
|
||||
#define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? stepperZ2.savedToff() : 0)
|
||||
#define Z2_ENABLE_READ stepperZ2.isEnabled()
|
||||
#else
|
||||
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
|
||||
#define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
|
||||
|
@ -294,6 +318,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define Z3_ENABLE_INIT NOOP
|
||||
#define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE)
|
||||
#define Z3_ENABLE_READ stepperZ3.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(Z3, TMC2660)
|
||||
#define Z3_ENABLE_INIT NOOP
|
||||
#define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? stepperZ3.savedToff() : 0)
|
||||
#define Z3_ENABLE_READ stepperZ3.isEnabled()
|
||||
#else
|
||||
#define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN)
|
||||
#define Z3_ENABLE_WRITE(STATE) WRITE(Z3_ENABLE_PIN,STATE)
|
||||
|
@ -326,6 +354,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define E0_ENABLE_INIT NOOP
|
||||
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
|
||||
#define E0_ENABLE_READ stepperE0.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(E0, TMC2660)
|
||||
#define E0_ENABLE_INIT NOOP
|
||||
#define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? stepperE0.savedToff() : 0)
|
||||
#define E0_ENABLE_READ stepperE0.isEnabled()
|
||||
#else
|
||||
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
|
||||
#define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
|
||||
|
@ -357,6 +389,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define E1_ENABLE_INIT NOOP
|
||||
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
|
||||
#define E1_ENABLE_READ stepperE1.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(E1, TMC2660)
|
||||
#define E1_ENABLE_INIT NOOP
|
||||
#define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? stepperE1.savedToff() : 0)
|
||||
#define E1_ENABLE_READ stepperE1.isEnabled()
|
||||
#else
|
||||
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
|
||||
#define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
|
||||
|
@ -388,6 +424,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define E2_ENABLE_INIT NOOP
|
||||
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
|
||||
#define E2_ENABLE_READ stepperE2.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(E2, TMC2660)
|
||||
#define E2_ENABLE_INIT NOOP
|
||||
#define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? stepperE2.savedToff() : 0)
|
||||
#define E2_ENABLE_READ stepperE2.isEnabled()
|
||||
#else
|
||||
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
|
||||
#define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
|
||||
|
@ -419,6 +459,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define E3_ENABLE_INIT NOOP
|
||||
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
|
||||
#define E3_ENABLE_READ stepperE3.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(E3, TMC2660)
|
||||
#define E3_ENABLE_INIT NOOP
|
||||
#define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? stepperE3.savedToff() : 0)
|
||||
#define E3_ENABLE_READ stepperE3.isEnabled()
|
||||
#else
|
||||
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
|
||||
#define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
|
||||
|
@ -450,6 +494,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define E4_ENABLE_INIT NOOP
|
||||
#define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
|
||||
#define E4_ENABLE_READ stepperE4.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(E4, TMC2660)
|
||||
#define E4_ENABLE_INIT NOOP
|
||||
#define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? stepperE4.savedToff() : 0)
|
||||
#define E4_ENABLE_READ stepperE4.isEnabled()
|
||||
#else
|
||||
#define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
|
||||
#define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE)
|
||||
|
@ -481,6 +529,10 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|||
#define E5_ENABLE_INIT NOOP
|
||||
#define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE)
|
||||
#define E5_ENABLE_READ stepperE5.isEnabled()
|
||||
#elif AXIS_DRIVER_TYPE(E5, TMC2660)
|
||||
#define E5_ENABLE_INIT NOOP
|
||||
#define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? stepperE5.savedToff() : 0)
|
||||
#define E5_ENABLE_READ stepperE5.isEnabled()
|
||||
#else
|
||||
#define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN)
|
||||
#define E5_ENABLE_WRITE(STATE) WRITE(E5_ENABLE_PIN,STATE)
|
||||
|
|
|
@ -58,22 +58,37 @@
|
|||
#define X_STEP_PIN P2_01
|
||||
#define X_DIR_PIN P0_11
|
||||
#define X_ENABLE_PIN P0_10
|
||||
#ifndef X_CS_PIN
|
||||
#define X_CS_PIN P0_10 // BSD2660 default
|
||||
#endif
|
||||
|
||||
#define Y_STEP_PIN P2_02
|
||||
#define Y_DIR_PIN P0_20
|
||||
#define Y_ENABLE_PIN P0_19
|
||||
#ifndef Y_CS_PIN
|
||||
#define Y_CS_PIN P0_19 // BSD2660 default
|
||||
#endif
|
||||
|
||||
#define Z_STEP_PIN P2_03
|
||||
#define Z_DIR_PIN P0_22
|
||||
#define Z_ENABLE_PIN P0_21
|
||||
#ifndef Z_CS_PIN
|
||||
#define Z_CS_PIN P0_21 // BSD2660 default
|
||||
#endif
|
||||
|
||||
#define E0_STEP_PIN P2_00
|
||||
#define E0_DIR_PIN P0_05
|
||||
#define E0_ENABLE_PIN P0_04
|
||||
#ifndef E0_CS_PIN
|
||||
#define E0_CS_PIN P0_04 // BSD2660 default
|
||||
#endif
|
||||
|
||||
#define E1_STEP_PIN P2_08
|
||||
#define E1_DIR_PIN P2_13
|
||||
#define E1_ENABLE_PIN P4_29
|
||||
#ifndef E1_CS_PIN
|
||||
#define E1_CS_PIN P4_29 // BSD2660 default
|
||||
#endif
|
||||
|
||||
//
|
||||
// Temperature Sensors
|
||||
|
|
Loading…
Reference in a new issue