Skip to content

Commit

Permalink
TMC Low Power Standby
Browse files Browse the repository at this point in the history
A future PR will be submitted for this feature.
  • Loading branch information
thisiskeithb committed Sep 24, 2020
1 parent d3466e8 commit 86cde40
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,24 @@ void stop() {
*/
void setup() {

// TMC Low Power Standby pins need to be set as early as possible or they won't be usable
TERN_(HAS_X_TMC_STDBY,SET_INPUT_PULLDOWN(X_STDBY_PIN));
TERN_(HAS_X2_TMC_STDBY,SET_INPUT_PULLDOWN(X2_STDBY_PIN));
TERN_(HAS_Y_TMC_STDBY,SET_INPUT_PULLDOWN(Y_STDBY_PIN));
TERN_(HAS_Y2_TMC_STDBY,SET_INPUT_PULLDOWN(Y2_STDBY_PIN));
TERN_(HAS_Z_TMC_STDBY,SET_INPUT_PULLDOWN(Z_STDBY_PIN));
TERN_(HAS_Z2_TMC_STDBY,SET_INPUT_PULLDOWN(Z2_STDBY_PIN));
TERN_(HAS_Z3_TMC_STDBY,SET_INPUT_PULLDOWN(Z3_STDBY_PIN));
TERN_(HAS_Z4_TMC_STDBY,SET_INPUT_PULLDOWN(Z4_STDBY_PIN));
TERN_(HAS_E0_TMC_STDBY,SET_INPUT_PULLDOWN(E0_STDBY_PIN));
TERN_(HAS_E1_TMC_STDBY,SET_INPUT_PULLDOWN(E1_STDBY_PIN));
TERN_(HAS_E2_TMC_STDBY,SET_INPUT_PULLDOWN(E2_STDBY_PIN));
TERN_(HAS_E3_TMC_STDBY,SET_INPUT_PULLDOWN(E3_STDBY_PIN));
TERN_(HAS_E4_TMC_STDBY,SET_INPUT_PULLDOWN(E4_STDBY_PIN));
TERN_(HAS_E5_TMC_STDBY,SET_INPUT_PULLDOWN(E5_STDBY_PIN));
TERN_(HAS_E6_TMC_STDBY,SET_INPUT_PULLDOWN(E6_STDBY_PIN));
TERN_(HAS_E7_TMC_STDBY,SET_INPUT_PULLDOWN(E7_STDBY_PIN));

#if ENABLED(MARLIN_DEV_MODE)
auto log_current_ms = [&](PGM_P const msg) {
SERIAL_ECHO_START();
Expand Down
48 changes: 48 additions & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,9 @@
#if PIN_EXISTS(X_MS1)
#define HAS_X_MS_PINS 1
#endif
#if PIN_EXISTS(X_STDBY)
#define HAS_X_TMC_STDBY 1
#endif

#if PIN_EXISTS(X2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2))
#define HAS_X2_ENABLE 1
Expand All @@ -1349,6 +1352,9 @@
#if PIN_EXISTS(X2_MS1)
#define HAS_X2_MS_PINS 1
#endif
#if PIN_EXISTS(X2_STDBY)
#define HAS_X2_TMC_STDBY 1
#endif

#if PIN_EXISTS(Y_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y))
#define HAS_Y_ENABLE 1
Expand All @@ -1362,6 +1368,9 @@
#if PIN_EXISTS(Y_MS1)
#define HAS_Y_MS_PINS 1
#endif
#if PIN_EXISTS(Y_STDBY)
#define HAS_Y_TMC_STDBY 1
#endif

#if PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2))
#define HAS_Y2_ENABLE 1
Expand All @@ -1375,6 +1384,9 @@
#if PIN_EXISTS(Y2_MS1)
#define HAS_Y2_MS_PINS 1
#endif
#if PIN_EXISTS(Y2_STDBY)
#define HAS_Y2_TMC_STDBY 1
#endif

#if PIN_EXISTS(Z_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z))
#define HAS_Z_ENABLE 1
Expand All @@ -1388,6 +1400,9 @@
#if PIN_EXISTS(Z_MS1)
#define HAS_Z_MS_PINS 1
#endif
#if PIN_EXISTS(Z_STDBY)
#define HAS_Z_TMC_STDBY 1
#endif

#if PIN_EXISTS(Z2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2))
#define HAS_Z2_ENABLE 1
Expand All @@ -1401,6 +1416,9 @@
#if PIN_EXISTS(Z2_MS1)
#define HAS_Z2_MS_PINS 1
#endif
#if PIN_EXISTS(Z2_STDBY)
#define HAS_Z2_TMC_STDBY 1
#endif

#if PIN_EXISTS(Z3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3))
#define HAS_Z3_ENABLE 1
Expand All @@ -1414,6 +1432,9 @@
#if PIN_EXISTS(Z3_MS1)
#define HAS_Z3_MS_PINS 1
#endif
#if PIN_EXISTS(Z3_STDBY)
#define HAS_Z3_TMC_STDBY 1
#endif

#if PIN_EXISTS(Z4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z4))
#define HAS_Z4_ENABLE 1
Expand All @@ -1427,6 +1448,9 @@
#if PIN_EXISTS(Z4_MS1)
#define HAS_Z4_MS_PINS 1
#endif
#if PIN_EXISTS(Z4_STDBY)
#define HAS_Z4_TMC_STDBY 1
#endif

// Extruder steppers and solenoids
#if PIN_EXISTS(E0_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0))
Expand All @@ -1444,6 +1468,9 @@
#if PIN_EXISTS(SOL0)
#define HAS_SOLENOID_0 1
#endif
#if PIN_EXISTS(E0_STDBY)
#define HAS_E0_TMC_STDBY 1
#endif

#if PIN_EXISTS(E1_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1))
#define HAS_E1_ENABLE 1
Expand All @@ -1460,6 +1487,9 @@
#if PIN_EXISTS(SOL1)
#define HAS_SOLENOID_1 1
#endif
#if PIN_EXISTS(E1_STDBY)
#define HAS_E1_TMC_STDBY 1
#endif

#if PIN_EXISTS(E2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2))
#define HAS_E2_ENABLE 1
Expand All @@ -1476,6 +1506,9 @@
#if PIN_EXISTS(SOL2)
#define HAS_SOLENOID_2 1
#endif
#if PIN_EXISTS(E2_STDBY)
#define HAS_E2_TMC_STDBY 1
#endif

#if PIN_EXISTS(E3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3))
#define HAS_E3_ENABLE 1
Expand All @@ -1492,6 +1525,9 @@
#if PIN_EXISTS(SOL3)
#define HAS_SOLENOID_3 1
#endif
#if PIN_EXISTS(E3_STDBY)
#define HAS_E3_TMC_STDBY 1
#endif

#if PIN_EXISTS(E4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4))
#define HAS_E4_ENABLE 1
Expand All @@ -1508,6 +1544,9 @@
#if PIN_EXISTS(SOL4)
#define HAS_SOLENOID_4 1
#endif
#if PIN_EXISTS(E4_STDBY)
#define HAS_E4_TMC_STDBY 1
#endif

#if PIN_EXISTS(E5_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5))
#define HAS_E5_ENABLE 1
Expand All @@ -1524,6 +1563,9 @@
#if PIN_EXISTS(SOL5)
#define HAS_SOLENOID_5 1
#endif
#if PIN_EXISTS(E5_STDBY)
#define HAS_E5_TMC_STDBY 1
#endif

#if PIN_EXISTS(E6_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E6))
#define HAS_E6_ENABLE 1
Expand All @@ -1540,6 +1582,9 @@
#if PIN_EXISTS(SOL6)
#define HAS_SOLENOID_6 1
#endif
#if PIN_EXISTS(E6_STDBY)
#define HAS_E6_TMC_STDBY 1
#endif

#if PIN_EXISTS(E7_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E7))
#define HAS_E7_ENABLE 1
Expand All @@ -1556,6 +1601,9 @@
#if PIN_EXISTS(SOL7)
#define HAS_SOLENOID_7 1
#endif
#if PIN_EXISTS(E7_STDBY)
#define HAS_E7_TMC_STDBY 1
#endif

//
// Trinamic Stepper Drivers
Expand Down

0 comments on commit 86cde40

Please sign in to comment.