M569 to change stepping mode. Add new TMC section to LCD. (#12884)

This commit is contained in:
teemuatlut 2019-01-17 21:17:16 +02:00 committed by Scott Lahteine
parent d08f27e27b
commit e6805582a6
84 changed files with 1542 additions and 80 deletions

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1379,6 +1379,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1354,6 +1354,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1379,6 +1379,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1388,6 +1388,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1385,6 +1385,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1385,6 +1385,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1388,6 +1388,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1393,6 +1393,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1355,6 +1355,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1382,6 +1382,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1380,6 +1380,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -1381,6 +1381,14 @@
//#define TMC_SW_MISO -1 //#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1 //#define TMC_SW_SCK -1
/**
* Software enable
*
* Use for drivers that do not use a dedicated enable pin, but rather handle the same
* function through a communication line such as SPI or UART.
*/
//#define SOFTWARE_DRIVER_ENABLE
/** /**
* Use Trinamic's ultra quiet stepping mode. * Use Trinamic's ultra quiet stepping mode.
* When disabled, Marlin will use spreadCycle stepping mode. * When disabled, Marlin will use spreadCycle stepping mode.

View File

@ -40,6 +40,10 @@
#endif #endif
#endif #endif
#if HAS_LCD_MENU
#include "../module/stepper.h"
#endif
/** /**
* Check for over temperature or short to ground error flags. * Check for over temperature or short to ground error flags.
* Report and log warning of overtemperature condition. * Report and log warning of overtemperature condition.
@ -980,4 +984,50 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
if (axis_connection) ui.set_status_P(PSTR("TMC CONNECTION ERROR")); if (axis_connection) ui.set_status_P(PSTR("TMC CONNECTION ERROR"));
} }
#if HAS_LCD_MENU
void init_tmc_section() {
#if AXIS_IS_TMC(X)
stepperX.init_lcd_variables(X_AXIS);
#endif
#if AXIS_IS_TMC(Y)
stepperY.init_lcd_variables(Y_AXIS);
#endif
#if AXIS_IS_TMC(Z)
stepperZ.init_lcd_variables(Z_AXIS);
#endif
#if AXIS_IS_TMC(X2)
stepperX2.init_lcd_variables(X_AXIS);
#endif
#if AXIS_IS_TMC(Y2)
stepperY2.init_lcd_variables(Y_AXIS);
#endif
#if AXIS_IS_TMC(Z2)
stepperZ2.init_lcd_variables(Z_AXIS);
#endif
#if AXIS_IS_TMC(Z3)
stepperZ3.init_lcd_variables(Z_AXIS);
#endif
#if AXIS_IS_TMC(E0)
stepperE0.init_lcd_variables(E_AXIS);
#endif
#if AXIS_IS_TMC(E1)
stepperE1.init_lcd_variables(E_AXIS_N(1));
#endif
#if AXIS_IS_TMC(E2)
stepperE2.init_lcd_variables(E_AXIS_N(2));
#endif
#if AXIS_IS_TMC(E3)
stepperE3.init_lcd_variables(E_AXIS_N(3));
#endif
#if AXIS_IS_TMC(E4)
stepperE4.init_lcd_variables(E_AXIS_N(4));
#endif
#if AXIS_IS_TMC(E5)
stepperE5.init_lcd_variables(E_AXIS_N(5));
#endif
}
#endif
#endif // HAS_TRINAMIC #endif // HAS_TRINAMIC

View File

@ -26,6 +26,9 @@
#if HAS_TRINAMIC #if HAS_TRINAMIC
#include <TMCStepper.h> #include <TMCStepper.h>
#endif #endif
#if HAS_LCD_MENU
#include "../module/planner.h"
#endif
#define TMC_X_LABEL 'X', '0' #define TMC_X_LABEL 'X', '0'
#define TMC_Y_LABEL 'Y', '0' #define TMC_Y_LABEL 'Y', '0'
@ -50,29 +53,45 @@
#define CHOPPER_PRUSAMK3_24V { 4, 1, 4 } #define CHOPPER_PRUSAMK3_24V { 4, 1, 4 }
#define CHOPPER_MARLIN_119 { 5, 2, 3 } #define CHOPPER_MARLIN_119 { 5, 2, 3 }
constexpr uint16_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) {
return 12650000UL * msteps / (256 * thrs * spmm);
}
template<char AXIS_LETTER, char DRIVER_ID> template<char AXIS_LETTER, char DRIVER_ID>
class TMCStorage { class TMCStorage {
protected: protected:
// Only a child class has access to constructor => Don't create on its own! "Poor man's abstract class" // Only a child class has access to constructor => Don't create on its own! "Poor man's abstract class"
TMCStorage() {} TMCStorage() {}
public:
uint16_t val_mA = 0; uint16_t val_mA = 0;
public:
#if ENABLED(MONITOR_DRIVER_STATUS) #if ENABLED(MONITOR_DRIVER_STATUS)
uint8_t otpw_count = 0, uint8_t otpw_count = 0,
error_count = 0; error_count = 0;
bool flag_otpw = false; bool flag_otpw = false;
bool getOTPW() { return flag_otpw; } inline bool getOTPW() { return flag_otpw; }
void clear_otpw() { flag_otpw = 0; } inline void clear_otpw() { flag_otpw = 0; }
#endif #endif
uint16_t getMilliamps() { return val_mA; } inline uint16_t getMilliamps() { return val_mA; }
void printLabel() { inline void printLabel() {
SERIAL_CHAR(AXIS_LETTER); SERIAL_CHAR(AXIS_LETTER);
if (DRIVER_ID > '0') SERIAL_CHAR(DRIVER_ID); if (DRIVER_ID > '0') SERIAL_CHAR(DRIVER_ID);
} }
struct {
#if STEALTHCHOP_ENABLED
bool stealthChop_enabled = false;
#endif
#if ENABLED(HYBRID_THRESHOLD)
uint8_t hybrid_thrs = 0;
#endif
#if ENABLED(SENSORLESS_HOMING)
int8_t homing_thrs = 0;
#endif
} stored;
}; };
template<class TMC, char AXIS_LETTER, char DRIVER_ID> template<class TMC, char AXIS_LETTER, char DRIVER_ID>
@ -84,15 +103,41 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) : TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) :
TMC(CS, RS, pinMOSI, pinMISO, pinSCK) TMC(CS, RS, pinMOSI, pinMISO, pinSCK)
{} {}
uint16_t rms_current() { return TMC::rms_current(); } inline uint16_t rms_current() { return TMC::rms_current(); }
void rms_current(uint16_t mA) { inline void rms_current(uint16_t mA) {
this->val_mA = mA; this->val_mA = mA;
TMC::rms_current(mA); TMC::rms_current(mA);
} }
void rms_current(uint16_t mA, float mult) { inline void rms_current(uint16_t mA, float mult) {
this->val_mA = mA; this->val_mA = mA;
TMC::rms_current(mA, mult); TMC::rms_current(mA, mult);
} }
#if STEALTHCHOP_ENABLED
inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); }
inline bool get_stealthChop_status() { return this->en_pwm_mode(); }
#endif
#if HAS_LCD_MENU
inline void init_lcd_variables(const AxisEnum spmm_id) {
#if ENABLED(HYBRID_THRESHOLD)
this->stored.hybrid_thrs = _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[spmm_id]);
#endif
#if ENABLED(SENSORLESS_HOMING)
this->stored.homing_thrs = this->sgt();
#endif
}
inline void refresh_stepper_current() { rms_current(this->val_mA); }
#if ENABLED(HYBRID_THRESHOLD)
inline void refresh_hybrid_thrs(float spmm) { this->TPWMTHRS(_tmc_thrs(this->microsteps(), this->stored.hybrid_thrs, spmm)); }
#endif
#if ENABLED(SENSORLESS_HOMING)
inline void refresh_homing_thrs() { this->sgt(this->stored.homing_thrs); }
#endif
#endif
}; };
template<char AXIS_LETTER, char DRIVER_ID> template<char AXIS_LETTER, char DRIVER_ID>
class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID> : public TMC2208Stepper, public TMCStorage<AXIS_LETTER, DRIVER_ID> { class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID> : public TMC2208Stepper, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
@ -104,19 +149,67 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID> : public TMC2208Stepper,
TMC2208Stepper(RX, TX, RS, has_rx=true) TMC2208Stepper(RX, TX, RS, has_rx=true)
{} {}
uint16_t rms_current() { return TMC2208Stepper::rms_current(); } uint16_t rms_current() { return TMC2208Stepper::rms_current(); }
void rms_current(uint16_t mA) { inline void rms_current(uint16_t mA) {
this->val_mA = mA; this->val_mA = mA;
TMC2208Stepper::rms_current(mA); TMC2208Stepper::rms_current(mA);
} }
void rms_current(uint16_t mA, float mult) { inline void rms_current(uint16_t mA, float mult) {
this->val_mA = mA; this->val_mA = mA;
TMC2208Stepper::rms_current(mA, mult); TMC2208Stepper::rms_current(mA, mult);
} }
};
constexpr uint16_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) { #if STEALTHCHOP_ENABLED
return 12650000UL * msteps / (256 * thrs * spmm); inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); }
} inline bool get_stealthChop_status() { !this->en_spreadCycle(); }
#endif
#if HAS_LCD_MENU
inline void init_lcd_variables(const AxisEnum spmm_id) {
#if ENABLED(HYBRID_THRESHOLD)
this->stored.hybrid_thrs = _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[spmm_id]);
#endif
#if STEALTHCHOP_ENABLED
this->stored.stealthChop_enabled = !this->en_spreadCycle();
#endif
}
inline void refresh_stepper_current() { rms_current(this->val_mA); }
#if ENABLED(HYBRID_THRESHOLD)
inline void refresh_hybrid_thrs(float spmm) { this->TPWMTHRS(_tmc_thrs(this->microsteps(), this->stored.hybrid_thrs, spmm)); }
#endif
#endif
};
template<char AXIS_LETTER, char DRIVER_ID>
class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> : public TMC2660Stepper, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
public:
TMCMarlin(uint16_t cs_pin, float RS) :
TMC2660Stepper(cs_pin, RS)
{}
TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) :
TMC2660Stepper(CS, RS, pinMOSI, pinMISO, pinSCK)
{}
inline uint16_t rms_current() { return TMC2660Stepper::rms_current(); }
inline void rms_current(uint16_t mA) {
this->val_mA = mA;
TMC2660Stepper::rms_current(mA);
}
#if HAS_LCD_MENU
inline void init_lcd_variables(const AxisEnum spmm_id) {
#if ENABLED(SENSORLESS_HOMING)
this->stored.homing_thrs = this->sgt();
#endif
}
inline void refresh_stepper_current() { rms_current(this->val_mA); }
#if ENABLED(SENSORLESS_HOMING)
inline void refresh_homing_thrs() { this->sgt(this->stored.homing_thrs); }
#endif
#endif
};
template<typename TMC> template<typename TMC>
void tmc_get_current(TMC &st) { void tmc_get_current(TMC &st) {
@ -127,6 +220,7 @@ template<typename TMC>
void tmc_set_current(TMC &st, const int mA) { void tmc_set_current(TMC &st, const int mA) {
st.rms_current(mA); st.rms_current(mA);
} }
#if ENABLED(MONITOR_DRIVER_STATUS) #if ENABLED(MONITOR_DRIVER_STATUS)
template<typename TMC> template<typename TMC>
void tmc_report_otpw(TMC &st) { void tmc_report_otpw(TMC &st) {
@ -173,6 +267,10 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
void tmc_get_registers(const bool print_x, const bool print_y, const bool print_z, const bool print_e); void tmc_get_registers(const bool print_x, const bool print_y, const bool print_z, const bool print_e);
#endif #endif
#if HAS_LCD_MENU
void init_tmc_section();
#endif
/** /**
* TMC2130 specific sensorless homing using stallGuard2. * TMC2130 specific sensorless homing using stallGuard2.
* stallGuard2 only works when in spreadCycle mode. * stallGuard2 only works when in spreadCycle mode.

View File

@ -0,0 +1,165 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_STEALTHCHOP
#include "../../gcode.h"
#include "../../../feature/tmc_util.h"
#include "../../../module/stepper_indirection.h"
template<typename TMC>
void tmc_say_stealth_status(TMC &st) {
st.printLabel();
SERIAL_ECHOPGM(" driver mode:\t");
serialprintPGM(st.get_stealthChop_status() ? PSTR("stealthChop") : PSTR("spreadCycle"));
SERIAL_EOL();
}
template<typename TMC>
void tmc_set_stealthChop(TMC &st, const bool enable) {
st.stored.stealthChop_enabled = enable;
st.refresh_stepping_mode();
}
static void set_stealth_status(const bool enable, const int8_t target_extruder) {
#define TMC_SET_STEALTH(Q) tmc_set_stealthChop(stepper##Q, enable)
#if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(X2) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Y2) || AXIS_HAS_STEALTHCHOP(Z) || AXIS_HAS_STEALTHCHOP(Z2) || AXIS_HAS_STEALTHCHOP(Z3)
const uint8_t index = parser.byteval('I');
#endif
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) {
switch (i) {
case X_AXIS:
#if AXIS_HAS_STEALTHCHOP(X)
if (index == 0) TMC_SET_STEALTH(X);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
if (index == 1) TMC_SET_STEALTH(X2);
#endif
break;
case Y_AXIS:
#if AXIS_HAS_STEALTHCHOP(Y)
if (index == 0) TMC_SET_STEALTH(Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
if (index == 1) TMC_SET_STEALTH(Y2);
#endif
break;
case Z_AXIS:
#if AXIS_HAS_STEALTHCHOP(Z)
if (index == 0) TMC_SET_STEALTH(Z);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
if (index == 1) TMC_SET_STEALTH(Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
if (index == 2) TMC_SET_STEALTH(Z3);
#endif
break;
case E_AXIS: {
if (target_extruder < 0) return;
switch (target_extruder) {
#if AXIS_HAS_STEALTHCHOP(E0)
case 0: TMC_SET_STEALTH(E0); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
case 1: TMC_SET_STEALTH(E1); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
case 2: TMC_SET_STEALTH(E2); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
case 3: TMC_SET_STEALTH(E3); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
case 4: TMC_SET_STEALTH(E4); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
case 5: TMC_SET_STEALTH(E5); break;
#endif
}
} break;
}
}
}
static void say_stealth_status() {
#define TMC_SAY_STEALTH_STATUS(Q) tmc_say_stealth_status(stepper##Q)
#if AXIS_HAS_STEALTHCHOP(X)
TMC_SAY_STEALTH_STATUS(X);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
TMC_SAY_STEALTH_STATUS(X2);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
TMC_SAY_STEALTH_STATUS(Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
TMC_SAY_STEALTH_STATUS(Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
TMC_SAY_STEALTH_STATUS(Z);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
TMC_SAY_STEALTH_STATUS(Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
TMC_SAY_STEALTH_STATUS(Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
TMC_SAY_STEALTH_STATUS(E0);
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
TMC_SAY_STEALTH_STATUS(E1);
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
TMC_SAY_STEALTH_STATUS(E2);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
TMC_SAY_STEALTH_STATUS(E3);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
TMC_SAY_STEALTH_STATUS(E4);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_SAY_STEALTH_STATUS(E5);
#endif
}
/**
* M569: Enable stealthChop on an axis
*
* S[1|0] to enable or disable
* XYZE to target an axis
* No arguments reports the stealthChop status of all capable drivers.
*/
void GcodeSuite::M569() {
if (parser.seen('S'))
set_stealth_status(parser.value_bool(), get_target_extruder_from_command());
else
say_stealth_status();
}
#endif // HAS_STEALTHCHOP

View File

@ -652,6 +652,9 @@ void GcodeSuite::process_parsed_command(
#if HAS_TRINAMIC #if HAS_TRINAMIC
case 122: M122(); break; case 122: M122(); break;
case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E
#if HAS_STEALTHCHOP
case 569: M569(); break; // M569: Enable stealthChop on an axis.
#endif
#if ENABLED(MONITOR_DRIVER_STATUS) #if ENABLED(MONITOR_DRIVER_STATUS)
case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags
case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags

View File

@ -209,6 +209,7 @@
* M503 - Print the current settings (in memory): "M503 S<verbose>". S0 specifies compact output. * M503 - Print the current settings (in memory): "M503 S<verbose>". S0 specifies compact output.
* M524 - Abort the current SD print job (started with M24) * M524 - Abort the current SD print job (started with M24)
* M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) * M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
* M569 - Enable stealthChop on an axis. (Requires at least one #_X_DRIVER_TYPE to be TMC2130 or TMC2208)
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE) * M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE) * M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
* M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE) * M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
@ -796,6 +797,9 @@ private:
#if HAS_TRINAMIC #if HAS_TRINAMIC
static void M122(); static void M122();
static void M906(); static void M906();
#if HAS_STEALTHCHOP
static void M569();
#endif
#if ENABLED(MONITOR_DRIVER_STATUS) #if ENABLED(MONITOR_DRIVER_STATUS)
static void M911(); static void M911();
static void M912(); static void M912();

View File

@ -779,73 +779,73 @@
*/ */
// Steppers // Steppers
#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE)) #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X)))
#define HAS_X_DIR (PIN_EXISTS(X_DIR)) #define HAS_X_DIR (PIN_EXISTS(X_DIR))
#define HAS_X_STEP (PIN_EXISTS(X_STEP)) #define HAS_X_STEP (PIN_EXISTS(X_STEP))
#define HAS_X_MICROSTEPS (PIN_EXISTS(X_MS1)) #define HAS_X_MICROSTEPS (PIN_EXISTS(X_MS1))
#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE)) #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2)))
#define HAS_X2_DIR (PIN_EXISTS(X2_DIR)) #define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
#define HAS_X2_STEP (PIN_EXISTS(X2_STEP)) #define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
#define HAS_X2_MICROSTEPS (PIN_EXISTS(X2_MS1)) #define HAS_X2_MICROSTEPS (PIN_EXISTS(X2_MS1))
#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE)) #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y)))
#define HAS_Y_DIR (PIN_EXISTS(Y_DIR)) #define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
#define HAS_Y_STEP (PIN_EXISTS(Y_STEP)) #define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
#define HAS_Y_MICROSTEPS (PIN_EXISTS(Y_MS1)) #define HAS_Y_MICROSTEPS (PIN_EXISTS(Y_MS1))
#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE)) #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2)))
#define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR)) #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
#define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP)) #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
#define HAS_Y2_MICROSTEPS (PIN_EXISTS(Y2_MS1)) #define HAS_Y2_MICROSTEPS (PIN_EXISTS(Y2_MS1))
#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE)) #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z)))
#define HAS_Z_DIR (PIN_EXISTS(Z_DIR)) #define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
#define HAS_Z_STEP (PIN_EXISTS(Z_STEP)) #define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
#define HAS_Z_MICROSTEPS (PIN_EXISTS(Z_MS1)) #define HAS_Z_MICROSTEPS (PIN_EXISTS(Z_MS1))
#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE)) #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)))
#define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR)) #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
#define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP)) #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
#define HAS_Z2_MICROSTEPS (PIN_EXISTS(Z2_MS1)) #define HAS_Z2_MICROSTEPS (PIN_EXISTS(Z2_MS1))
#define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE)) #define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3)))
#define HAS_Z3_DIR (PIN_EXISTS(Z3_DIR)) #define HAS_Z3_DIR (PIN_EXISTS(Z3_DIR))
#define HAS_Z3_STEP (PIN_EXISTS(Z3_STEP)) #define HAS_Z3_STEP (PIN_EXISTS(Z3_STEP))
#define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1)) #define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1))
// Extruder steppers and solenoids // Extruder steppers and solenoids
#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE)) #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)))
#define HAS_E0_DIR (PIN_EXISTS(E0_DIR)) #define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
#define HAS_E0_STEP (PIN_EXISTS(E0_STEP)) #define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
#define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1)) #define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1))
#define HAS_SOLENOID_0 (PIN_EXISTS(SOL0)) #define HAS_SOLENOID_0 (PIN_EXISTS(SOL0))
#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE)) #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)))
#define HAS_E1_DIR (PIN_EXISTS(E1_DIR)) #define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
#define HAS_E1_STEP (PIN_EXISTS(E1_STEP)) #define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
#define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1)) #define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1)) #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE)) #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)))
#define HAS_E2_DIR (PIN_EXISTS(E2_DIR)) #define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
#define HAS_E2_STEP (PIN_EXISTS(E2_STEP)) #define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
#define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1)) #define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2)) #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE)) #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)))
#define HAS_E3_DIR (PIN_EXISTS(E3_DIR)) #define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
#define HAS_E3_STEP (PIN_EXISTS(E3_STEP)) #define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
#define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1)) #define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1))
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3)) #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
#define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE)) #define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)))
#define HAS_E4_DIR (PIN_EXISTS(E4_DIR)) #define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
#define HAS_E4_STEP (PIN_EXISTS(E4_STEP)) #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
#define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1)) #define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1))
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4)) #define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
#define HAS_E5_ENABLE (PIN_EXISTS(E5_ENABLE)) #define HAS_E5_ENABLE (PIN_EXISTS(E5_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)))
#define HAS_E5_DIR (PIN_EXISTS(E5_DIR)) #define HAS_E5_DIR (PIN_EXISTS(E5_DIR))
#define HAS_E5_STEP (PIN_EXISTS(E5_STEP)) #define HAS_E5_STEP (PIN_EXISTS(E5_STEP))
#define HAS_E5_MICROSTEPS (PIN_EXISTS(E5_MS1)) #define HAS_E5_MICROSTEPS (PIN_EXISTS(E5_MS1))

View File

@ -1298,7 +1298,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TEMP_0_PIN not defined for this board." #error "TEMP_0_PIN not defined for this board."
#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR))) #elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR)))
#error "E0_STEP_PIN or E0_DIR_PIN not defined for this board." #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR) || !PIN_EXISTS(E0_ENABLE))) #elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR) || !HAS_E0_ENABLE))
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#elif TEMP_SENSOR_0 == 0 #elif TEMP_SENSOR_0 == 0
#error "TEMP_SENSOR_0 is required." #error "TEMP_SENSOR_0 is required."
@ -1427,27 +1427,27 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
*/ */
#if DISABLED(MK2_MULTIPLEXER) // MK2_MULTIPLEXER uses E0 stepper only #if DISABLED(MK2_MULTIPLEXER) // MK2_MULTIPLEXER uses E0 stepper only
#if E_STEPPERS #if E_STEPPERS
#if !(PIN_EXISTS(E0_STEP) && PIN_EXISTS(E0_DIR) && PIN_EXISTS(E0_ENABLE)) #if !(PIN_EXISTS(E0_STEP) && PIN_EXISTS(E0_DIR) && HAS_E0_ENABLE)
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#endif #endif
#if E_STEPPERS > 1 #if E_STEPPERS > 1
#if !(PIN_EXISTS(E1_STEP) && PIN_EXISTS(E1_DIR) && PIN_EXISTS(E1_ENABLE)) #if !(PIN_EXISTS(E1_STEP) && PIN_EXISTS(E1_DIR) && HAS_E1_ENABLE)
#error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board." #error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board."
#endif #endif
#if E_STEPPERS > 2 #if E_STEPPERS > 2
#if !(PIN_EXISTS(E2_STEP) && PIN_EXISTS(E2_DIR) && PIN_EXISTS(E2_ENABLE)) #if !(PIN_EXISTS(E2_STEP) && PIN_EXISTS(E2_DIR) && HAS_E2_ENABLE)
#error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board." #error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board."
#endif #endif
#if E_STEPPERS > 3 #if E_STEPPERS > 3
#if !(PIN_EXISTS(E3_STEP) && PIN_EXISTS(E3_DIR) && PIN_EXISTS(E3_ENABLE)) #if !(PIN_EXISTS(E3_STEP) && PIN_EXISTS(E3_DIR) && HAS_E3_ENABLE)
#error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board." #error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board."
#endif #endif
#if E_STEPPERS > 4 #if E_STEPPERS > 4
#if !(PIN_EXISTS(E4_STEP) && PIN_EXISTS(E4_DIR) && PIN_EXISTS(E4_ENABLE)) #if !(PIN_EXISTS(E4_STEP) && PIN_EXISTS(E4_DIR) && HAS_E4_ENABLE)
#error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board." #error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board."
#endif #endif
#if E_STEPPERS > 5 #if E_STEPPERS > 5
#if !(PIN_EXISTS(E5_STEP) && PIN_EXISTS(E5_DIR) && PIN_EXISTS(E5_ENABLE)) #if !(PIN_EXISTS(E5_STEP) && PIN_EXISTS(E5_DIR) && HAS_E5_ENABLE)
#error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board." #error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board."
#endif #endif
#endif // E_STEPPERS > 5 #endif // E_STEPPERS > 5

View File

@ -698,6 +698,11 @@ void MarlinUI::init() {
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN); SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif #endif
#if HAS_TRINAMIC
init_tmc_section();
#endif
ExtUI::onStartup(); ExtUI::onStartup();
} }

View File

@ -1178,3 +1178,22 @@
#define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...")
#endif #endif
#endif // LCD_HEIGHT < 4 #endif // LCD_HEIGHT < 4
#ifndef MSG_TMC_DRIVERS
#define MSG_TMC_DRIVERS _UxGT("TMC drivers")
#endif
#ifndef MSG_TMC_CURRENT
#define MSG_TMC_CURRENT _UxGT("Driver current")
#endif
#ifndef MSG_TMC_HYBRID_THRS
#define MSG_TMC_HYBRID_THRS _UxGT("Hybrid threshold")
#endif
#ifndef MSG_TMC_HOMING_THRS
#define MSG_TMC_HOMING_THRS _UxGT("Sensorless homing")
#endif
#ifndef MSG_TMC_STEPPING_MODE
#define MSG_TMC_STEPPING_MODE _UxGT("Stepping mode")
#endif
#ifndef MSG_TMC_STEALTH_ENABLED
#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop enabled")
#endif

View File

@ -164,7 +164,8 @@ DEFINE_MENU_EDIT_ITEM(int3);
DEFINE_MENU_EDIT_ITEM(int4); DEFINE_MENU_EDIT_ITEM(int4);
DEFINE_MENU_EDIT_ITEM(int8); DEFINE_MENU_EDIT_ITEM(int8);
DEFINE_MENU_EDIT_ITEM(uint8); DEFINE_MENU_EDIT_ITEM(uint8);
DEFINE_MENU_EDIT_ITEM(uint16); DEFINE_MENU_EDIT_ITEM(uint16_3);
DEFINE_MENU_EDIT_ITEM(uint16_4);
DEFINE_MENU_EDIT_ITEM(float3); DEFINE_MENU_EDIT_ITEM(float3);
DEFINE_MENU_EDIT_ITEM(float52); DEFINE_MENU_EDIT_ITEM(float52);
DEFINE_MENU_EDIT_ITEM(float43); DEFINE_MENU_EDIT_ITEM(float43);

View File

@ -47,7 +47,8 @@ DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 );
DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 );
DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 );
DECLARE_MENU_EDIT_TYPE(uint8_t, uint8, ui8tostr3, 1 ); DECLARE_MENU_EDIT_TYPE(uint8_t, uint8, ui8tostr3, 1 );
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16, ui16tostr3, 1 ); DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_3, ui16tostr3, 1 );
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 );
DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 );
DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 ); DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 );
DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 );
@ -105,7 +106,8 @@ DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int3);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4); DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8); DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint8); DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint8);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16); DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_3);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_4);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52);
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43);
@ -176,7 +178,8 @@ DECLARE_MENU_EDIT_ITEM(int3);
DECLARE_MENU_EDIT_ITEM(int4); DECLARE_MENU_EDIT_ITEM(int4);
DECLARE_MENU_EDIT_ITEM(int8); DECLARE_MENU_EDIT_ITEM(int8);
DECLARE_MENU_EDIT_ITEM(uint8); DECLARE_MENU_EDIT_ITEM(uint8);
DECLARE_MENU_EDIT_ITEM(uint16); DECLARE_MENU_EDIT_ITEM(uint16_3);
DECLARE_MENU_EDIT_ITEM(uint16_4);
DECLARE_MENU_EDIT_ITEM(float3); DECLARE_MENU_EDIT_ITEM(float3);
DECLARE_MENU_EDIT_ITEM(float52); DECLARE_MENU_EDIT_ITEM(float52);
DECLARE_MENU_EDIT_ITEM(float43); DECLARE_MENU_EDIT_ITEM(float43);

View File

@ -44,6 +44,7 @@
void menu_advanced_settings(); void menu_advanced_settings();
void menu_delta_calibrate(); void menu_delta_calibrate();
void menu_tmc();
static void lcd_factory_settings() { static void lcd_factory_settings() {
settings.reset(); settings.reset();
@ -353,6 +354,10 @@ void menu_configuration() {
MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_pwm); MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_pwm);
#endif #endif
#if HAS_TRINAMIC
MENU_ITEM(submenu, MSG_TMC_DRIVERS, menu_tmc);
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled, runout.reset); MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled, runout.reset);
#endif #endif

View File

@ -0,0 +1,352 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
*
*/
//
// TMC Menu
//
#include "../../inc/MarlinConfigPre.h"
#if HAS_TRINAMIC && HAS_LCD_MENU
#include "menu.h"
#include "../../module/stepper_indirection.h"
#include "../../feature/tmc_util.h"
#define TMC_EDIT_STORED_I_RMS(ST) MENU_ITEM_EDIT_CALLBACK(uint16_4, MSG_##ST, &stepper##ST.val_mA, 100, 3000, refresh_stepper_current_##ST)
#if AXIS_IS_TMC(X)
void refresh_stepper_current_X() { stepperX.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Y)
void refresh_stepper_current_Y() { stepperY.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Z)
void refresh_stepper_current_Z() { stepperZ.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(X2)
void refresh_stepper_current_X2() { stepperX2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Y2)
void refresh_stepper_current_Y2() { stepperY2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Z2)
void refresh_stepper_current_Z2() { stepperZ2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(Z3)
void refresh_stepper_current_Z3() { stepperZ3.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E0)
void refresh_stepper_current_E0() { stepperE0.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E1)
void refresh_stepper_current_E1() { stepperE1.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E2)
void refresh_stepper_current_E2() { stepperE2.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E3)
void refresh_stepper_current_E3() { stepperE3.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E4)
void refresh_stepper_current_E4() { stepperE4.refresh_stepper_current(); }
#endif
#if AXIS_IS_TMC(E5)
void refresh_stepper_current_E5() { stepperE5.refresh_stepper_current(); }
#endif
void menu_tmc_current() {
START_MENU();
MENU_BACK(MSG_TMC_DRIVERS);
#if AXIS_IS_TMC(X)
TMC_EDIT_STORED_I_RMS(X);
#endif
#if AXIS_IS_TMC(Y)
TMC_EDIT_STORED_I_RMS(Y);
#endif
#if AXIS_IS_TMC(Z)
TMC_EDIT_STORED_I_RMS(Z);
#endif
#if AXIS_IS_TMC(X2)
TMC_EDIT_STORED_I_RMS(X2);
#endif
#if AXIS_IS_TMC(Y2)
TMC_EDIT_STORED_I_RMS(Y2);
#endif
#if AXIS_IS_TMC(Z2)
TMC_EDIT_STORED_I_RMS(Z2);
#endif
#if AXIS_IS_TMC(Z3)
TMC_EDIT_STORED_I_RMS(Z3);
#endif
#if AXIS_IS_TMC(E0)
TMC_EDIT_STORED_I_RMS(E0);
#endif
#if AXIS_IS_TMC(E1)
TMC_EDIT_STORED_I_RMS(E1);
#endif
#if AXIS_IS_TMC(E2)
TMC_EDIT_STORED_I_RMS(E2);
#endif
#if AXIS_IS_TMC(E3)
TMC_EDIT_STORED_I_RMS(E3);
#endif
#if AXIS_IS_TMC(E4)
TMC_EDIT_STORED_I_RMS(E4);
#endif
#if AXIS_IS_TMC(E5)
TMC_EDIT_STORED_I_RMS(E5);
#endif
END_MENU();
}
#if ENABLED(HYBRID_THRESHOLD)
#define TMC_EDIT_STORED_HYBRID_THRS(ST) MENU_ITEM_EDIT_CALLBACK(uint8, MSG_##ST, &stepper##ST.stored.hybrid_thrs, 0, 255, refresh_hybrid_thrs_##ST);
#if AXIS_HAS_STEALTHCHOP(X)
void refresh_hybrid_thrs_X() { stepperX.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[X_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
void refresh_hybrid_thrs_Y() { stepperY.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Y_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
void refresh_hybrid_thrs_Z() { stepperZ.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Z_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
void refresh_hybrid_thrs_X2() { stepperX2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[X_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
void refresh_hybrid_thrs_Y2() { stepperY2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Y_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
void refresh_hybrid_thrs_Z2() { stepperZ2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Z_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
void refresh_hybrid_thrs_Z3() { stepperZ3.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Z_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
void refresh_hybrid_thrs_E0() { stepperE0.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS]); }
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
void refresh_hybrid_thrs_E1() { stepperE1.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(1)]); }
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
void refresh_hybrid_thrs_E2() { stepperE2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(2)]); }
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
void refresh_hybrid_thrs_E3() { stepperE3.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(3)]); }
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
void refresh_hybrid_thrs_E4() { stepperE4.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(4)]); }
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
void refresh_hybrid_thrs_E5() { stepperE5.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(5)]); }
#endif
void menu_tmc_hybrid_thrs() {
START_MENU();
MENU_BACK(MSG_TMC_DRIVERS);
#if AXIS_HAS_STEALTHCHOP(X)
TMC_EDIT_STORED_HYBRID_THRS(X);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
TMC_EDIT_STORED_HYBRID_THRS(Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
TMC_EDIT_STORED_HYBRID_THRS(Z);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
TMC_EDIT_STORED_HYBRID_THRS(X2);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
TMC_EDIT_STORED_HYBRID_THRS(Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
TMC_EDIT_STORED_HYBRID_THRS(Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
TMC_EDIT_STORED_HYBRID_THRS(Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
TMC_EDIT_STORED_HYBRID_THRS(E0);
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
TMC_EDIT_STORED_HYBRID_THRS(E1);
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
TMC_EDIT_STORED_HYBRID_THRS(E2);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
TMC_EDIT_STORED_HYBRID_THRS(E3);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
TMC_EDIT_STORED_HYBRID_THRS(E4);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_EDIT_STORED_HYBRID_THRS(E5);
#endif
END_MENU();
}
#endif
#if ENABLED(SENSORLESS_HOMING)
#define TMC_EDIT_STORED_SGT(ST) MENU_ITEM_EDIT_CALLBACK(int8, MSG_##ST, &stepper##ST.stored.homing_thrs, -64, 63, refresh_homing_thrs_##ST);
#if X_SENSORLESS
void refresh_homing_thrs_X() { stepperX.refresh_homing_thrs(); }
#endif
#if Y_SENSORLESS
void refresh_homing_thrs_Y() { stepperY.refresh_homing_thrs(); }
#endif
#if Z_SENSORLESS
void refresh_homing_thrs_Z() { stepperZ.refresh_homing_thrs(); }
#endif
void menu_tmc_homing_thrs() {
START_MENU();
MENU_BACK(MSG_TMC_DRIVERS);
#if X_SENSORLESS
TMC_EDIT_STORED_SGT(X);
#endif
#if Y_SENSORLESS
TMC_EDIT_STORED_SGT(Y);
#endif
#if Z_SENSORLESS
TMC_EDIT_STORED_SGT(Z);
#endif
END_MENU();
}
#endif
#if STEALTHCHOP_ENABLED
#define TMC_EDIT_STEP_MODE(ST) MENU_ITEM_EDIT_CALLBACK(bool, MSG_##ST, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST)
#if AXIS_HAS_STEALTHCHOP(X)
void refresh_stepping_mode_X() { stepperX.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
void refresh_stepping_mode_Y() { stepperY.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
void refresh_stepping_mode_Z() { stepperZ.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
void refresh_stepping_mode_X2() { stepperX2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
void refresh_stepping_mode_Y2() { stepperY2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
void refresh_stepping_mode_Z2() { stepperZ2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
void refresh_stepping_mode_Z3() { stepperZ3.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
void refresh_stepping_mode_E0() { stepperE0.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
void refresh_stepping_mode_E1() { stepperE1.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
void refresh_stepping_mode_E2() { stepperE2.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
void refresh_stepping_mode_E3() { stepperE3.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
void refresh_stepping_mode_E4() { stepperE4.refresh_stepping_mode(); }
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
void refresh_stepping_mode_E5() { stepperE5.refresh_stepping_mode(); }
#endif
void menu_tmc_step_mode() {
START_MENU();
STATIC_ITEM(MSG_TMC_STEALTH_ENABLED);
MENU_BACK(MSG_TMC_DRIVERS);
#if AXIS_HAS_STEALTHCHOP(X)
TMC_EDIT_STEP_MODE(X);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
TMC_EDIT_STEP_MODE(Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
TMC_EDIT_STEP_MODE(Z);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
TMC_EDIT_STEP_MODE(X2);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
TMC_EDIT_STEP_MODE(Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
TMC_EDIT_STEP_MODE(Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
TMC_EDIT_STEP_MODE(Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
TMC_EDIT_STEP_MODE(E0);
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
TMC_EDIT_STEP_MODE(E1);
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
TMC_EDIT_STEP_MODE(E2);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
TMC_EDIT_STEP_MODE(E3);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
TMC_EDIT_STEP_MODE(E4);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_EDIT_STEP_MODE(E5);
#endif
END_MENU();
}
#endif
void menu_tmc() {
START_MENU();
MENU_BACK(MSG_CONTROL);
MENU_ITEM(submenu, MSG_TMC_CURRENT, menu_tmc_current);
#if ENABLED(HYBRID_THRESHOLD)
MENU_ITEM(submenu, MSG_TMC_HYBRID_THRS, menu_tmc_hybrid_thrs);
#endif
#if ENABLED(SENSORLESS_HOMING)
MENU_ITEM(submenu, MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs);
#endif
#if STEALTHCHOP_ENABLED
MENU_ITEM(submenu, MSG_TMC_STEPPING_MODE, menu_tmc_step_mode);
#endif
END_MENU();
}
#endif // HAS_TRINAMIC

View File

@ -85,6 +85,10 @@
#include "../libs/buzzer.h" #include "../libs/buzzer.h"
#endif #endif
#if HAS_TRINAMIC
#include "../feature/tmc_util.h"
#endif
#if HAS_ENCODER_ACTION #if HAS_ENCODER_ACTION
volatile uint8_t MarlinUI::buttons; volatile uint8_t MarlinUI::buttons;
#if HAS_SLOW_BUTTONS #if HAS_SLOW_BUTTONS
@ -255,6 +259,10 @@ void MarlinUI::init() {
#if HAS_ENCODER_ACTION #if HAS_ENCODER_ACTION
encoderDiff = 0; encoderDiff = 0;
#endif #endif
#if HAS_TRINAMIC
init_tmc_section();
#endif
} }
bool MarlinUI::get_blink() { bool MarlinUI::get_blink() {

View File

@ -37,7 +37,7 @@
*/ */
// Change EEPROM version if the structure changes // Change EEPROM version if the structure changes
#define EEPROM_VERSION "V63" #define EEPROM_VERSION "V64"
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
// Check the integrity of data offsets. // Check the integrity of data offsets.
@ -48,12 +48,16 @@
#if ADD_PORT_ARG #if ADD_PORT_ARG
#define PORTARG_SOLO const int8_t port #define PORTARG_SOLO const int8_t port
#define PORTARG_BEFORE const int8_t port,
#define PORTARG_AFTER ,const int8_t port #define PORTARG_AFTER ,const int8_t port
#define PORTVAR_SOLO port #define PORTVAR_SOLO port
#define PORTVAR_BEFORE port,
#else #else
#define PORTARG_SOLO #define PORTARG_SOLO
#define PORTARG_BEFORE
#define PORTARG_AFTER #define PORTARG_AFTER
#define PORTVAR_SOLO #define PORTVAR_SOLO
#define PORTVAR_BEFORE
#endif #endif
#include "endstops.h" #include "endstops.h"
@ -112,6 +116,7 @@
typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t; typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t;
typedef struct { uint32_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_hybrid_threshold_t; typedef struct { uint32_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_hybrid_threshold_t;
typedef struct { int16_t X, Y, Z; } tmc_sgt_t; typedef struct { int16_t X, Y, Z; } tmc_sgt_t;
typedef struct { bool X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_stealth_enabled_t;
// Limit an index to an array size // Limit an index to an array size
#define ALIM(I,ARR) MIN(I, COUNT(ARR) - 1) #define ALIM(I,ARR) MIN(I, COUNT(ARR) - 1)
@ -256,6 +261,7 @@ typedef struct SettingsDataStruct {
tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5
tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5
tmc_sgt_t tmc_sgt; // M914 X Y Z tmc_sgt_t tmc_sgt; // M914 X Y Z
tmc_stealth_enabled_t tmc_stealth_enabled; // M569 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5
// //
// LIN_ADVANCE // LIN_ADVANCE
@ -974,6 +980,70 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(tmc_sgt); EEPROM_WRITE(tmc_sgt);
} }
//
// TMC stepping mode
//
{
_FIELD_TEST(tmc_stealth_enabled);
tmc_stealth_enabled_t tmc_stealth_enabled = { false, false, false, false, false, false, false, false, false, false, false, false, false };
#if HAS_STEALTHCHOP
#if AXIS_HAS_STEALTHCHOP(X)
tmc_stealth_enabled.X = stepperX.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
tmc_stealth_enabled.Y = stepperY.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
tmc_stealth_enabled.Z = stepperZ.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
tmc_stealth_enabled.X2 = stepperX2.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
tmc_stealth_enabled.Y2 = stepperY2.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
tmc_stealth_enabled.Z2 = stepperZ2.get_stealthChop_status();
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
tmc_stealth_enabled.Z3 = stepperZ3.get_stealthChop_status();
#endif
#if MAX_EXTRUDERS
#if AXIS_HAS_STEALTHCHOP(E0)
tmc_stealth_enabled.E0 = stepperE0.get_stealthChop_status();
#endif
#if MAX_EXTRUDERS > 1
#if AXIS_HAS_STEALTHCHOP(E1)
tmc_stealth_enabled.E1 = stepperE1.get_stealthChop_status();
#endif
#if MAX_EXTRUDERS > 2
#if AXIS_HAS_STEALTHCHOP(E2)
tmc_stealth_enabled.E2 = stepperE2.get_stealthChop_status();
#endif
#if MAX_EXTRUDERS > 3
#if AXIS_HAS_STEALTHCHOP(E3)
tmc_stealth_enabled.E3 = stepperE3.get_stealthChop_status();
#endif
#if MAX_EXTRUDERS > 4
#if AXIS_HAS_STEALTHCHOP(E4)
tmc_stealth_enabled.E4 = stepperE4.get_stealthChop_status();
#endif
#if MAX_EXTRUDERS > 5
#if AXIS_HAS_STEALTHCHOP(E5)
tmc_stealth_enabled.E5 = stepperE5.get_stealthChop_status();
#endif
#endif // MAX_EXTRUDERS > 5
#endif // MAX_EXTRUDERS > 4
#endif // MAX_EXTRUDERS > 3
#endif // MAX_EXTRUDERS > 2
#endif // MAX_EXTRUDERS > 1
#endif // MAX_EXTRUDERS
#endif
EEPROM_WRITE(tmc_stealth_enabled);
}
// //
// Linear Advance // Linear Advance
// //
@ -1630,6 +1700,60 @@ void MarlinSettings::postprocess() {
#endif #endif
} }
// TMC stepping mode
{
_FIELD_TEST(tmc_stealth_enabled);
tmc_stealth_enabled_t tmc_stealth_enabled;
EEPROM_READ(tmc_stealth_enabled);
#if HAS_TRINAMIC
#define SET_STEPPING_MODE(ST) stepper##ST.stored.stealthChop_enabled = tmc_stealth_enabled.ST; stepper##ST.refresh_stepping_mode();
if (!validating) {
#if AXIS_HAS_STEALTHCHOP(X)
SET_STEPPING_MODE(X);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
SET_STEPPING_MODE(Y);
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
SET_STEPPING_MODE(Z);
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
SET_STEPPING_MODE(X2);
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
SET_STEPPING_MODE(Y2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
SET_STEPPING_MODE(Z2);
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
SET_STEPPING_MODE(Z3);
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
SET_STEPPING_MODE(E0);
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
SET_STEPPING_MODE(E1);
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
SET_STEPPING_MODE(E2);
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
SET_STEPPING_MODE(E3);
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
SET_STEPPING_MODE(E4);
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
SET_STEPPING_MODE(E5);
#endif
}
#endif
}
// //
// Linear Advance // Linear Advance
// //
@ -2200,6 +2324,16 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if HAS_TRINAMIC #if HAS_TRINAMIC
void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M906"); } void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M906"); }
#if HAS_STEALTHCHOP
void say_M569(PORTARG_BEFORE const char * const etc=NULL) {
SERIAL_ECHOPGM_P(port, " M569 S1");
if (etc) {
SERIAL_CHAR_P(port, ' ');
serialprintPGM_P(port, etc);
SERIAL_EOL_P(port);
}
}
#endif
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); } void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); }
#endif #endif
@ -2895,6 +3029,81 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // USE_SENSORLESS #endif // USE_SENSORLESS
/**
* TMC stepping mode
*/
#if HAS_STEALTHCHOP
CONFIG_ECHO_HEADING("Driver stepping mode:");
CONFIG_ECHO_START();
#if AXIS_HAS_STEALTHCHOP(X)
const bool chop_x = stepperX.get_stealthChop_status();
#else
constexpr bool chop_x = false;
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
const bool chop_y = stepperY.get_stealthChop_status();
#else
constexpr bool chop_y = false;
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
const bool chop_z = stepperZ.get_stealthChop_status();
#else
constexpr bool chop_z = false;
#endif
if (chop_x || chop_y || chop_z) say_M569(PORTVAR_SOLO);
if (chop_x) SERIAL_ECHOPGM_P(port, " X");
if (chop_y) SERIAL_ECHOPGM_P(port, " Y");
if (chop_z) SERIAL_ECHOPGM_P(port, " Z");
if (chop_x || chop_y || chop_z) SERIAL_EOL_P(port);
#if AXIS_HAS_STEALTHCHOP(X2)
const bool chop_x2 = stepperX2.get_stealthChop_status();
#else
constexpr bool chop_x2 = false;
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
const bool chop_y2 = stepperY2.get_stealthChop_status();
#else
constexpr bool chop_y2 = false;
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
const bool chop_z2 = stepperZ2.get_stealthChop_status();
#else
constexpr bool chop_z2 = false;
#endif
if (chop_x2 || chop_y2 || chop_z2) say_M569(PORTVAR_BEFORE PSTR("I1"));
if (chop_x2) SERIAL_ECHOPGM_P(port, " X");
if (chop_y2) SERIAL_ECHOPGM_P(port, " Y");
if (chop_z2) SERIAL_ECHOPGM_P(port, " Z");
if (chop_x2 || chop_y2 || chop_z2) SERIAL_EOL_P(port);
#if AXIS_HAS_STEALTHCHOP(Z3)
if (stepperZ3.get_stealthChop_status()) { say_M569(PORTVAR_BEFORE PSTR("I2 Z")); }
#endif
#if AXIS_HAS_STEALTHCHOP(E0)
if (stepperE0.get_stealthChop_status()) { say_M569(PORTVAR_BEFORE PSTR("T0 E")); }
#endif
#if AXIS_HAS_STEALTHCHOP(E1)
if (stepperE1.get_stealthChop_status()) { say_M569(PORTVAR_BEFORE PSTR("T1 E")); }
#endif
#if AXIS_HAS_STEALTHCHOP(E2)
if (stepperE2.get_stealthChop_status()) { say_M569(PORTVAR_BEFORE PSTR("T2 E")); }
#endif
#if AXIS_HAS_STEALTHCHOP(E3)
if (stepperE3.get_stealthChop_status()) { say_M569(PORTVAR_BEFORE PSTR("T3 E")); }
#endif
#if AXIS_HAS_STEALTHCHOP(E4)
if (stepperE4.get_stealthChop_status()) { say_M569(PORTVAR_BEFORE PSTR("T4 E")); }
#endif
#if AXIS_HAS_STEALTHCHOP(E5)
if (stepperE5.get_stealthChop_status()) { say_M569(PORTVAR_BEFORE PSTR("T5 E")); }
#endif
#endif // HAS_STEALTHCHOP
#endif // HAS_TRINAMIC #endif // HAS_TRINAMIC
/** /**

View File

@ -205,14 +205,12 @@
void tmc_init(TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { void tmc_init(TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) {
st.begin(); st.begin();
static constexpr int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1
CHOPCONF_t chopconf{0}; CHOPCONF_t chopconf{0};
chopconf.tbl = 1; chopconf.tbl = 1;
chopconf.toff = timings[0]; chopconf.toff = chopper_timing.toff;
chopconf.intpol = INTERPOLATE; chopconf.intpol = INTERPOLATE;
chopconf.hend = timings[1] + 3; chopconf.hend = chopper_timing.hstrt + 3;
chopconf.hstrt = timings[2] - 1; chopconf.hstrt = chopper_timing.hend - 1;
st.CHOPCONF(chopconf.sr); st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER); st.rms_current(mA, HOLD_MULTIPLIER);
@ -221,6 +219,7 @@
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
st.en_pwm_mode(stealth); st.en_pwm_mode(stealth);
st.stored.stealthChop_enabled = stealth;
PWMCONF_t pwmconf{0}; PWMCONF_t pwmconf{0};
pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk
@ -442,21 +441,20 @@
template<char AXIS_LETTER, char DRIVER_ID> template<char AXIS_LETTER, char DRIVER_ID>
void tmc_init(TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { void tmc_init(TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) {
static constexpr int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1
TMC2208_n::GCONF_t gconf{0}; TMC2208_n::GCONF_t gconf{0};
gconf.pdn_disable = true; // Use UART gconf.pdn_disable = true; // Use UART
gconf.mstep_reg_select = true; // Select microsteps with UART gconf.mstep_reg_select = true; // Select microsteps with UART
gconf.i_scale_analog = false; gconf.i_scale_analog = false;
gconf.en_spreadcycle = !stealth; gconf.en_spreadcycle = !stealth;
st.GCONF(gconf.sr); st.GCONF(gconf.sr);
st.stored.stealthChop_enabled = stealth;
TMC2208_n::CHOPCONF_t chopconf{0}; TMC2208_n::CHOPCONF_t chopconf{0};
chopconf.tbl = 0b01; // blank_time = 24 chopconf.tbl = 0b01; // blank_time = 24
chopconf.toff = timings[0]; chopconf.toff = chopper_timing.toff;
chopconf.intpol = INTERPOLATE; chopconf.intpol = INTERPOLATE;
chopconf.hend = timings[1] + 3; chopconf.hend = chopper_timing.hstrt + 3;
chopconf.hstrt = timings[2] - 1; chopconf.hstrt = chopper_timing.hend - 1;
st.CHOPCONF(chopconf.sr); st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER); st.rms_current(mA, HOLD_MULTIPLIER);
@ -545,13 +543,11 @@
void tmc_init(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const float, const bool) { void tmc_init(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const float, const bool) {
st.begin(); st.begin();
static constexpr int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1
TMC2660_n::CHOPCONF_t chopconf{0}; TMC2660_n::CHOPCONF_t chopconf{0};
chopconf.tbl = 1; chopconf.tbl = 1;
chopconf.toff = timings[0]; chopconf.toff = chopper_timing.toff;
chopconf.hend = timings[1] + 3; chopconf.hend = chopper_timing.hstrt + 3;
chopconf.hstrt = timings[2] - 1; chopconf.hstrt = chopper_timing.hend - 1;
st.CHOPCONF(chopconf.sr); st.CHOPCONF(chopconf.sr);
st.rms_current(mA); st.rms_current(mA);

View File

@ -66,6 +66,14 @@
#define _TMC_CLASS(MODEL, L) __TMC_CLASS(MODEL, L) #define _TMC_CLASS(MODEL, L) __TMC_CLASS(MODEL, L)
#define TMC_CLASS(ST) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL) #define TMC_CLASS(ST) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL)
typedef struct {
uint8_t toff;
int8_t hstrt;
uint8_t hend;
} chopper_timing_t;
static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING;
#if HAS_DRIVER(TMC2208) #if HAS_DRIVER(TMC2208)
void tmc2208_serial_begin(); void tmc2208_serial_begin();
#endif #endif
@ -99,9 +107,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X_ENABLE_INIT NOOP #define X_ENABLE_INIT NOOP
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE) #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
#define X_ENABLE_READ stepperX.isEnabled() #define X_ENABLE_READ stepperX.isEnabled()
#elif AXIS_DRIVER_TYPE(X, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X)
#define X_ENABLE_INIT NOOP #define X_ENABLE_INIT NOOP
#define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? stepperX.savedToff() : 0) #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
#define X_ENABLE_READ stepperX.isEnabled() #define X_ENABLE_READ stepperX.isEnabled()
#else #else
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
@ -134,9 +142,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y_ENABLE_INIT NOOP #define Y_ENABLE_INIT NOOP
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE) #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
#define Y_ENABLE_READ stepperY.isEnabled() #define Y_ENABLE_READ stepperY.isEnabled()
#elif AXIS_DRIVER_TYPE(Y, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y)
#define Y_ENABLE_INIT NOOP #define Y_ENABLE_INIT NOOP
#define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? stepperY.savedToff() : 0) #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
#define Y_ENABLE_READ stepperY.isEnabled() #define Y_ENABLE_READ stepperY.isEnabled()
#else #else
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
@ -169,9 +177,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z_ENABLE_INIT NOOP #define Z_ENABLE_INIT NOOP
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE) #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
#define Z_ENABLE_READ stepperZ.isEnabled() #define Z_ENABLE_READ stepperZ.isEnabled()
#elif AXIS_DRIVER_TYPE(Z, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z)
#define Z_ENABLE_INIT NOOP #define Z_ENABLE_INIT NOOP
#define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? stepperZ.savedToff() : 0) #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
#define Z_ENABLE_READ stepperZ.isEnabled() #define Z_ENABLE_READ stepperZ.isEnabled()
#else #else
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
@ -205,9 +213,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X2_ENABLE_INIT NOOP #define X2_ENABLE_INIT NOOP
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE) #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
#define X2_ENABLE_READ stepperX2.isEnabled() #define X2_ENABLE_READ stepperX2.isEnabled()
#elif AXIS_DRIVER_TYPE(X2, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2)
#define X2_ENABLE_INIT NOOP #define X2_ENABLE_INIT NOOP
#define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? stepperX2.savedToff() : 0) #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
#define X2_ENABLE_READ stepperX2.isEnabled() #define X2_ENABLE_READ stepperX2.isEnabled()
#else #else
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
@ -242,9 +250,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y2_ENABLE_INIT NOOP #define Y2_ENABLE_INIT NOOP
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE) #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
#define Y2_ENABLE_READ stepperY2.isEnabled() #define Y2_ENABLE_READ stepperY2.isEnabled()
#elif AXIS_DRIVER_TYPE(Y2, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2)
#define Y2_ENABLE_INIT NOOP #define Y2_ENABLE_INIT NOOP
#define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? stepperY2.savedToff() : 0) #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
#define Y2_ENABLE_READ stepperY2.isEnabled() #define Y2_ENABLE_READ stepperY2.isEnabled()
#else #else
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
@ -279,9 +287,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z2_ENABLE_INIT NOOP #define Z2_ENABLE_INIT NOOP
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE) #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
#define Z2_ENABLE_READ stepperZ2.isEnabled() #define Z2_ENABLE_READ stepperZ2.isEnabled()
#elif AXIS_DRIVER_TYPE(Z2, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)
#define Z2_ENABLE_INIT NOOP #define Z2_ENABLE_INIT NOOP
#define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? stepperZ2.savedToff() : 0) #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
#define Z2_ENABLE_READ stepperZ2.isEnabled() #define Z2_ENABLE_READ stepperZ2.isEnabled()
#else #else
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
@ -316,9 +324,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z3_ENABLE_INIT NOOP #define Z3_ENABLE_INIT NOOP
#define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE) #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE)
#define Z3_ENABLE_READ stepperZ3.isEnabled() #define Z3_ENABLE_READ stepperZ3.isEnabled()
#elif AXIS_DRIVER_TYPE(Z3, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3)
#define Z3_ENABLE_INIT NOOP #define Z3_ENABLE_INIT NOOP
#define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? stepperZ3.savedToff() : 0) #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
#define Z3_ENABLE_READ stepperZ3.isEnabled() #define Z3_ENABLE_READ stepperZ3.isEnabled()
#else #else
#define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN) #define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN)
@ -352,9 +360,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E0_ENABLE_INIT NOOP #define E0_ENABLE_INIT NOOP
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE) #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
#define E0_ENABLE_READ stepperE0.isEnabled() #define E0_ENABLE_READ stepperE0.isEnabled()
#elif AXIS_DRIVER_TYPE(E0, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)
#define E0_ENABLE_INIT NOOP #define E0_ENABLE_INIT NOOP
#define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? stepperE0.savedToff() : 0) #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E0_ENABLE_READ stepperE0.isEnabled() #define E0_ENABLE_READ stepperE0.isEnabled()
#else #else
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
@ -387,9 +395,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E1_ENABLE_INIT NOOP #define E1_ENABLE_INIT NOOP
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE) #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
#define E1_ENABLE_READ stepperE1.isEnabled() #define E1_ENABLE_READ stepperE1.isEnabled()
#elif AXIS_DRIVER_TYPE(E1, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)
#define E1_ENABLE_INIT NOOP #define E1_ENABLE_INIT NOOP
#define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? stepperE1.savedToff() : 0) #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E1_ENABLE_READ stepperE1.isEnabled() #define E1_ENABLE_READ stepperE1.isEnabled()
#else #else
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN) #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
@ -422,9 +430,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E2_ENABLE_INIT NOOP #define E2_ENABLE_INIT NOOP
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE) #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
#define E2_ENABLE_READ stepperE2.isEnabled() #define E2_ENABLE_READ stepperE2.isEnabled()
#elif AXIS_DRIVER_TYPE(E2, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)
#define E2_ENABLE_INIT NOOP #define E2_ENABLE_INIT NOOP
#define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? stepperE2.savedToff() : 0) #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E2_ENABLE_READ stepperE2.isEnabled() #define E2_ENABLE_READ stepperE2.isEnabled()
#else #else
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN) #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
@ -457,9 +465,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E3_ENABLE_INIT NOOP #define E3_ENABLE_INIT NOOP
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE) #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
#define E3_ENABLE_READ stepperE3.isEnabled() #define E3_ENABLE_READ stepperE3.isEnabled()
#elif AXIS_DRIVER_TYPE(E3, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)
#define E3_ENABLE_INIT NOOP #define E3_ENABLE_INIT NOOP
#define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? stepperE3.savedToff() : 0) #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E3_ENABLE_READ stepperE3.isEnabled() #define E3_ENABLE_READ stepperE3.isEnabled()
#else #else
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN) #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
@ -492,9 +500,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E4_ENABLE_INIT NOOP #define E4_ENABLE_INIT NOOP
#define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE) #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
#define E4_ENABLE_READ stepperE4.isEnabled() #define E4_ENABLE_READ stepperE4.isEnabled()
#elif AXIS_DRIVER_TYPE(E4, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)
#define E4_ENABLE_INIT NOOP #define E4_ENABLE_INIT NOOP
#define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? stepperE4.savedToff() : 0) #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E4_ENABLE_READ stepperE4.isEnabled() #define E4_ENABLE_READ stepperE4.isEnabled()
#else #else
#define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN) #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
@ -527,9 +535,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E5_ENABLE_INIT NOOP #define E5_ENABLE_INIT NOOP
#define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE) #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE)
#define E5_ENABLE_READ stepperE5.isEnabled() #define E5_ENABLE_READ stepperE5.isEnabled()
#elif AXIS_DRIVER_TYPE(E5, TMC2660) #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)
#define E5_ENABLE_INIT NOOP #define E5_ENABLE_INIT NOOP
#define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? stepperE5.savedToff() : 0) #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
#define E5_ENABLE_READ stepperE5.isEnabled() #define E5_ENABLE_READ stepperE5.isEnabled()
#else #else
#define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN) #define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN)