From 53bd0b55cbbba9815eab8e3ad1ec23d3e4370e21 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 16 Sep 2018 23:57:50 -0500 Subject: [PATCH] Followup for 6 extruders --- .../src/gcode/feature/trinamic/M911-M915.cpp | 6 ++-- Marlin/src/module/stepper_indirection.cpp | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp index c156cef2b..69bf070a9 100644 --- a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp +++ b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp @@ -131,8 +131,8 @@ void GcodeSuite::M912() { #endif #endif - #if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) - const int8_t eval = int8_t(parser.byteval(axis_codes[E_AXIS], 0xFF)); + #if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5) + const uint8_t eval = int8_t(parser.byteval(axis_codes[E_AXIS], 0xFF)); #if M91x_USE_E(0) if (hasNone || eval == 0 || (hasE && eval < 0)) tmc_clear_otpw(stepperE0, TMC_E0); #endif @@ -149,7 +149,7 @@ void GcodeSuite::M912() { if (hasNone || eval == 4 || (hasE && eval < 0)) tmc_clear_otpw(stepperE4, TMC_E4); #endif #if M91x_USE_E(5) - if (hasNone || eval == 5 || (hasE && eval == 10)) tmc_clear_otpw(stepperE5, TMC_E5); + if (hasNone || eval == 5 || (hasE && eval < 0)) tmc_clear_otpw(stepperE5, TMC_E5); #endif #endif } diff --git a/Marlin/src/module/stepper_indirection.cpp b/Marlin/src/module/stepper_indirection.cpp index a0ec490d7..e6bd0abf2 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -87,6 +87,9 @@ #if AXIS_DRIVER_TYPE(E4, TMC26X) _TMC26X_DEFINE(E4); #endif + #if AXIS_DRIVER_TYPE(E5, TMC26X) + _TMC26X_DEFINE(E5); + #endif #define _TMC26X_INIT(A) do{ \ stepper##A.setMicrosteps(A##_MICROSTEPS); \ @@ -130,6 +133,9 @@ #if AXIS_DRIVER_TYPE(E4, TMC26X) _TMC26X_INIT(E4); #endif + #if AXIS_DRIVER_TYPE(E5, TMC26X) + _TMC26X_INIT(E5); + #endif } #endif // TMC26X @@ -190,6 +196,9 @@ #if AXIS_DRIVER_TYPE(E4, TMC2130) _TMC2130_DEFINE(E4); #endif + #if AXIS_DRIVER_TYPE(E5, TMC2130) + _TMC2130_DEFINE(E5); + #endif // Use internal reference voltage for current calculations. This is the default. // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609) @@ -394,6 +403,13 @@ _TMC2208_DEFINE_SOFTWARE(E4); #endif #endif + #if AXIS_DRIVER_TYPE(E5, TMC2208) + #ifdef E5_HARDWARE_SERIAL + _TMC2208_DEFINE_HARDWARE(E5); + #else + _TMC2208_DEFINE_SOFTWARE(E5); + #endif + #endif void tmc2208_serial_begin() { #if AXIS_DRIVER_TYPE(X, TMC2208) @@ -480,6 +496,13 @@ stepperE4.beginSerial(115200); #endif #endif + #if AXIS_DRIVER_TYPE(E5, TMC2208) + #ifdef E5_HARDWARE_SERIAL + E5_HARDWARE_SERIAL.begin(115200); + #else + stepperE5.beginSerial(115200); + #endif + #endif } // Use internal reference voltage for current calculations. This is the default. @@ -597,6 +620,9 @@ void restore_stepper_drivers() { #if AXIS_IS_TMC(E4) stepperE4.push(); #endif + #if AXIS_IS_TMC(E5) + stepperE5.push(); + #endif } void reset_stepper_drivers() { @@ -667,6 +693,9 @@ void reset_stepper_drivers() { #if AXIS_DRIVER_TYPE(E4, L6470) _L6470_DEFINE(E4); #endif + #if AXIS_DRIVER_TYPE(E5, L6470) + _L6470_DEFINE(E5); + #endif #define _L6470_INIT(A) do{ \ stepper##A.init(); \ @@ -713,6 +742,9 @@ void reset_stepper_drivers() { #if AXIS_DRIVER_TYPE(E4, L6470) _L6470_INIT(E4); #endif + #if AXIS_DRIVER_TYPE(E5, L6470) + _L6470_INIT(E5); + #endif } #endif // L6470