From e6805582a67b106691423a35ab580bd6b0895949 Mon Sep 17 00:00:00 2001 From: teemuatlut Date: Thu, 17 Jan 2019 21:17:16 +0200 Subject: [PATCH] M569 to change stepping mode. Add new TMC section to LCD. (#12884) --- Marlin/Configuration_adv.h | 8 + Marlin/src/config/default/Configuration_adv.h | 8 + .../3DFabXYZ/Migbot/Configuration_adv.h | 8 + .../AlephObjects/TAZ4/Configuration_adv.h | 8 + .../examples/Anet/A2/Configuration_adv.h | 8 + .../examples/Anet/A2plus/Configuration_adv.h | 8 + .../examples/Anet/A6/Configuration_adv.h | 8 + .../examples/Anet/A8/Configuration_adv.h | 8 + .../config/examples/ArmEd/Configuration_adv.h | 8 + .../BIBO/TouchX/cyclops/Configuration_adv.h | 8 + .../BIBO/TouchX/default/Configuration_adv.h | 8 + .../examples/BQ/Hephestos/Configuration_adv.h | 8 + .../BQ/Hephestos_2/Configuration_adv.h | 8 + .../examples/BQ/WITBOX/Configuration_adv.h | 8 + .../examples/Cartesio/Configuration_adv.h | 8 + .../Creality/CR-10/Configuration_adv.h | 8 + .../Creality/CR-10S/Configuration_adv.h | 8 + .../Creality/CR-10mini/Configuration_adv.h | 8 + .../Creality/CR-8/Configuration_adv.h | 8 + .../Creality/Ender-2/Configuration_adv.h | 8 + .../Creality/Ender-3/Configuration_adv.h | 8 + .../Creality/Ender-4/Configuration_adv.h | 8 + .../examples/Einstart-S/Configuration_adv.h | 8 + .../config/examples/Felix/Configuration_adv.h | 8 + .../FlashForge/CreatorPro/Configuration_adv.h | 8 + .../FolgerTech/i3-2020/Configuration_adv.h | 8 + .../Formbot/Raptor/Configuration_adv.h | 8 + .../Formbot/T_Rex_2+/Configuration_adv.h | 8 + .../Formbot/T_Rex_3/Configuration_adv.h | 8 + .../Geeetech/MeCreator2/Configuration_adv.h | 8 + .../Prusa i3 Pro C/Configuration_adv.h | 8 + .../Prusa i3 Pro W/Configuration_adv.h | 8 + .../Infitary/i3-M508/Configuration_adv.h | 8 + .../examples/JGAurora/A5/Configuration_adv.h | 8 + .../examples/MakerParts/Configuration_adv.h | 8 + .../examples/Malyan/M150/Configuration_adv.h | 8 + .../examples/Malyan/M200/Configuration_adv.h | 8 + .../Micromake/C1/enhanced/Configuration_adv.h | 8 + .../examples/Mks/Robin/Configuration_adv.h | 8 + .../examples/Mks/Sbase/Configuration_adv.h | 8 + .../examples/RigidBot/Configuration_adv.h | 8 + .../config/examples/SCARA/Configuration_adv.h | 8 + .../examples/Sanguinololu/Configuration_adv.h | 8 + .../examples/TheBorg/Configuration_adv.h | 8 + .../examples/TinyBoy2/Configuration_adv.h | 8 + .../examples/Tronxy/X3A/Configuration_adv.h | 8 + .../UltiMachine/Archim1/Configuration_adv.h | 8 + .../UltiMachine/Archim2/Configuration_adv.h | 8 + .../examples/VORONDesign/Configuration_adv.h | 8 + .../Velleman/K8200/Configuration_adv.h | 8 + .../Velleman/K8400/Configuration_adv.h | 8 + .../WASP/PowerWASP/Configuration_adv.h | 8 + .../Wanhao/Duplicator 6/Configuration_adv.h | 8 + .../delta/Anycubic/Kossel/Configuration_adv.h | 8 + .../FLSUN/auto_calibrate/Configuration_adv.h | 8 + .../delta/FLSUN/kossel/Configuration_adv.h | 8 + .../FLSUN/kossel_mini/Configuration_adv.h | 8 + .../Geeetech/Rostock 301/Configuration_adv.h | 8 + .../delta/MKS/SBASE/Configuration_adv.h | 8 + .../Tevo Little Monster/Configuration_adv.h | 8 + .../delta/generic/Configuration_adv.h | 8 + .../delta/kossel_mini/Configuration_adv.h | 8 + .../delta/kossel_xl/Configuration_adv.h | 8 + .../gCreate/gMax1.5+/Configuration_adv.h | 8 + .../examples/makibox/Configuration_adv.h | 8 + .../tvrrug/Round2/Configuration_adv.h | 8 + .../config/examples/wt150/Configuration_adv.h | 8 + Marlin/src/feature/tmc_util.cpp | 50 +++ Marlin/src/feature/tmc_util.h | 126 ++++++- Marlin/src/gcode/feature/trinamic/M569.cpp | 165 ++++++++ Marlin/src/gcode/gcode.cpp | 3 + Marlin/src/gcode/gcode.h | 4 + Marlin/src/inc/Conditionals_post.h | 26 +- Marlin/src/inc/SanityCheck.h | 14 +- Marlin/src/lcd/extensible_ui/ui_api.cpp | 5 + Marlin/src/lcd/language/language_en.h | 19 + Marlin/src/lcd/menu/menu.cpp | 3 +- Marlin/src/lcd/menu/menu.h | 9 +- Marlin/src/lcd/menu/menu_configuration.cpp | 5 + Marlin/src/lcd/menu/menu_tmc.cpp | 352 ++++++++++++++++++ Marlin/src/lcd/ultralcd.cpp | 8 + Marlin/src/module/configuration_store.cpp | 211 ++++++++++- Marlin/src/module/stepper_indirection.cpp | 26 +- Marlin/src/module/stepper_indirection.h | 60 +-- 84 files changed, 1542 insertions(+), 80 deletions(-) create mode 100644 Marlin/src/gcode/feature/trinamic/M569.cpp create mode 100644 Marlin/src/lcd/menu/menu_tmc.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index faa711002..44583d61a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index faa711002..44583d61a 100755 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h b/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h index e27a257ae..356e71e9a 100644 --- a/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h +++ b/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index a8dc9e26a..3196725d2 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h index d35870501..ac74fe8cc 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h index d35870501..ac74fe8cc 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index b0f53fe10..3df678f50 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -1379,6 +1379,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index 1c4755c77..db4120c92 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/ArmEd/Configuration_adv.h b/Marlin/src/config/examples/ArmEd/Configuration_adv.h index 03c9ac49f..ef6e5c836 100644 --- a/Marlin/src/config/examples/ArmEd/Configuration_adv.h +++ b/Marlin/src/config/examples/ArmEd/Configuration_adv.h @@ -1354,6 +1354,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h index ebd34d1d7..d13d6f7f7 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h @@ -1379,6 +1379,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h index 6efff2e67..a6843d01e 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index fa241ad96..3bb729e51 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index f231004c2..8fc882bad 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -1388,6 +1388,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index fa241ad96..3bb729e51 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 1d016f0f3..f1d79ac17 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index 2bb25d99f..f051e1f64 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h index 73187c89c..799b357df 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h index 1c8675cb9..099e1fee9 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h index 1e7448609..9c1df4052 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h index 0d4ccc9ef..40b45fff7 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h index 461a1b1e5..fe122bb3c 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h index c895b5af2..2cf401041 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h index 03b9f5fd7..1ccf747c1 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h +++ b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index c81d8b083..165acf7a4 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h b/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h index b028bf2d3..1dc5c173a 100644 --- a/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h +++ b/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 850af77a4..d1c01f584 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h index f3f1dffff..5744c0f3f 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h index e7dc8678f..e83567bf9 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h @@ -1385,6 +1385,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h index ba25ab713..220575a5a 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h @@ -1385,6 +1385,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h index 0c38cfb2c..f253dfe1d 100644 --- a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h +++ b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h index bd0b4e250..567fd2212 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h index bd0b4e250..567fd2212 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index b50fc49ec..56f702486 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h index 1ee5c7c15..ebd052d8a 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index 334dda831..3c15e5a83 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 5d2a93dcc..55305098d 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index 6f91d8e24..27345fe7a 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index 256ef6863..35756ceb9 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Mks/Robin/Configuration_adv.h b/Marlin/src/config/examples/Mks/Robin/Configuration_adv.h index 00eb5fbec..b203413dc 100644 --- a/Marlin/src/config/examples/Mks/Robin/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Robin/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index b8d47ad82..5ac0ce025 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -1388,6 +1388,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index ba5e1f13a..e0f306f4c 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index d13b74fc6..8429a0430 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 6b299f4ca..9d9f52095 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/Marlin/src/config/examples/TheBorg/Configuration_adv.h index c94c859e2..b1dd5d913 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/Marlin/src/config/examples/TheBorg/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index c52b37bb9..53574a6c5 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h index eb4fd82ca..f9dffed3e 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h +++ b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h index 8814c5f39..628f3b4a6 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index b6971b568..e310f45b9 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/VORONDesign/Configuration_adv.h b/Marlin/src/config/examples/VORONDesign/Configuration_adv.h index cede5e5a5..bb6f84a3f 100644 --- a/Marlin/src/config/examples/VORONDesign/Configuration_adv.h +++ b/Marlin/src/config/examples/VORONDesign/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index cac9ccebb..0ba53f4da 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -1393,6 +1393,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index c89864b10..6eba15e5a 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h b/Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h index f7973f219..aea961189 100644 --- a/Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h +++ b/Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index f05c4f2c0..9675c0480 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h index 5448b034f..cce82031e 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index d654a7ae5..b55cd675c 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h index d654a7ae5..b55cd675c 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index e6e981bd8..7be6efd66 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h index 6ce497c2d..96b736062 100644 --- a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h @@ -1355,6 +1355,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h b/Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h index 431005b5d..8302d1c1a 100644 --- a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h b/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h index 099afcf43..89a218282 100644 --- a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index e6e981bd8..7be6efd66 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index e6e981bd8..7be6efd66 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index a59aafb7b..5cc25df70 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -1382,6 +1382,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 8f9bd831a..1100ce8aa 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index c85a13480..5a01ac33b 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index a74920bdb..8af83fc65 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -1380,6 +1380,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 1e08eb58c..5cb97e675 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -1381,6 +1381,14 @@ //#define TMC_SW_MISO -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. * When disabled, Marlin will use spreadCycle stepping mode. diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 681b93b6a..8c21575a7 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -40,6 +40,10 @@ #endif #endif +#if HAS_LCD_MENU + #include "../module/stepper.h" +#endif + /** * Check for over temperature or short to ground error flags. * 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 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 diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 3acfdc9cb..d90efba6b 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -26,6 +26,9 @@ #if HAS_TRINAMIC #include #endif +#if HAS_LCD_MENU + #include "../module/planner.h" +#endif #define TMC_X_LABEL 'X', '0' #define TMC_Y_LABEL 'Y', '0' @@ -50,29 +53,45 @@ #define CHOPPER_PRUSAMK3_24V { 4, 1, 4 } #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 class TMCStorage { protected: // Only a child class has access to constructor => Don't create on its own! "Poor man's abstract class" TMCStorage() {} + public: uint16_t val_mA = 0; - public: #if ENABLED(MONITOR_DRIVER_STATUS) uint8_t otpw_count = 0, error_count = 0; bool flag_otpw = false; - bool getOTPW() { return flag_otpw; } - void clear_otpw() { flag_otpw = 0; } + inline bool getOTPW() { return flag_otpw; } + inline void clear_otpw() { flag_otpw = 0; } #endif - uint16_t getMilliamps() { return val_mA; } + inline uint16_t getMilliamps() { return val_mA; } - void printLabel() { + inline void printLabel() { SERIAL_CHAR(AXIS_LETTER); 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 @@ -84,15 +103,41 @@ class TMCMarlin : public TMC, public TMCStorage { TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) : TMC(CS, RS, pinMOSI, pinMISO, pinSCK) {} - uint16_t rms_current() { return TMC::rms_current(); } - void rms_current(uint16_t mA) { + inline uint16_t rms_current() { return TMC::rms_current(); } + inline void rms_current(uint16_t mA) { this->val_mA = 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; 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 class TMCMarlin : public TMC2208Stepper, public TMCStorage { @@ -104,19 +149,67 @@ class TMCMarlin : public TMC2208Stepper, TMC2208Stepper(RX, TX, RS, has_rx=true) {} 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; 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; TMC2208Stepper::rms_current(mA, mult); } -}; -constexpr uint16_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) { - return 12650000UL * msteps / (256 * thrs * spmm); -} + #if STEALTHCHOP_ENABLED + 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 +class TMCMarlin : public TMC2660Stepper, public TMCStorage { + 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 void tmc_get_current(TMC &st) { @@ -127,6 +220,7 @@ template void tmc_set_current(TMC &st, const int mA) { st.rms_current(mA); } + #if ENABLED(MONITOR_DRIVER_STATUS) template 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); #endif +#if HAS_LCD_MENU + void init_tmc_section(); +#endif + /** * TMC2130 specific sensorless homing using stallGuard2. * stallGuard2 only works when in spreadCycle mode. diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp new file mode 100644 index 000000000..ee1a573fb --- /dev/null +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -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 . + * + */ + +#include "../../../inc/MarlinConfig.h" + +#if HAS_STEALTHCHOP + +#include "../../gcode.h" +#include "../../../feature/tmc_util.h" +#include "../../../module/stepper_indirection.h" + +template +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 +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 diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 4d4d9b77d..a25fc55c0 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -652,6 +652,9 @@ void GcodeSuite::process_parsed_command( #if HAS_TRINAMIC case 122: M122(); break; 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) case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 40d8785d8..4a34ed637 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -209,6 +209,7 @@ * M503 - Print the current settings (in memory): "M503 S". S0 specifies compact output. * M524 - Abort the current SD print job (started with M24) * M540 - Enable/disable SD card abort on endstop hit: "M540 S". (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 Y Z E L". (Requires ADVANCED_PAUSE_FEATURE) * M603 - Configure filament change: "M603 T U L". (Requires ADVANCED_PAUSE_FEATURE) * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) @@ -796,6 +797,9 @@ private: #if HAS_TRINAMIC static void M122(); static void M906(); + #if HAS_STEALTHCHOP + static void M569(); + #endif #if ENABLED(MONITOR_DRIVER_STATUS) static void M911(); static void M912(); diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 059480c03..fbc4ee76a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -779,73 +779,73 @@ */ // 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_STEP (PIN_EXISTS(X_STEP)) #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_STEP (PIN_EXISTS(X2_STEP)) #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_STEP (PIN_EXISTS(Y_STEP)) #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_STEP (PIN_EXISTS(Y2_STEP)) #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_STEP (PIN_EXISTS(Z_STEP)) #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_STEP (PIN_EXISTS(Z2_STEP)) #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_STEP (PIN_EXISTS(Z3_STEP)) #define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1)) // 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_STEP (PIN_EXISTS(E0_STEP)) #define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1)) #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_STEP (PIN_EXISTS(E1_STEP)) #define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1)) #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_STEP (PIN_EXISTS(E2_STEP)) #define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1)) #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_STEP (PIN_EXISTS(E3_STEP)) #define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1)) #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_STEP (PIN_EXISTS(E4_STEP)) #define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1)) #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_STEP (PIN_EXISTS(E5_STEP)) #define HAS_E5_MICROSTEPS (PIN_EXISTS(E5_MS1)) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 235071a00..c9726e01c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -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." #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." -#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." #elif TEMP_SENSOR_0 == 0 #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 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." #endif #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." #endif #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." #endif #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." #endif #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." #endif #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." #endif #endif // E_STEPPERS > 5 diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index af2d83535..491650c31 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -698,6 +698,11 @@ void MarlinUI::init() { #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) SET_INPUT_PULLUP(SD_DETECT_PIN); #endif + + #if HAS_TRINAMIC + init_tmc_section(); + #endif + ExtUI::onStartup(); } diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index a8ee0115e..ab8fd06f3 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -1178,3 +1178,22 @@ #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") #endif #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 diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index d440a63f9..854edbb7a 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -164,7 +164,8 @@ DEFINE_MENU_EDIT_ITEM(int3); DEFINE_MENU_EDIT_ITEM(int4); DEFINE_MENU_EDIT_ITEM(int8); 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(float52); DEFINE_MENU_EDIT_ITEM(float43); diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 725fbc0b5..9dcb2a67e 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -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(int8_t, int8, i8tostr3, 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, float52, ftostr52, 100 ); 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(int8); 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(float52); 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(int8); 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(float52); DECLARE_MENU_EDIT_ITEM(float43); diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index aabc67c17..1e9677331 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -44,6 +44,7 @@ void menu_advanced_settings(); void menu_delta_calibrate(); +void menu_tmc(); static void lcd_factory_settings() { settings.reset(); @@ -353,6 +354,10 @@ void menu_configuration() { MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_pwm); #endif + #if HAS_TRINAMIC + MENU_ITEM(submenu, MSG_TMC_DRIVERS, menu_tmc); + #endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR) MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled, runout.reset); #endif diff --git a/Marlin/src/lcd/menu/menu_tmc.cpp b/Marlin/src/lcd/menu/menu_tmc.cpp new file mode 100644 index 000000000..269e65ba5 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_tmc.cpp @@ -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 . + * + */ + +// +// 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 diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 2c55c9d42..7d11c9d97 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -85,6 +85,10 @@ #include "../libs/buzzer.h" #endif +#if HAS_TRINAMIC + #include "../feature/tmc_util.h" +#endif + #if HAS_ENCODER_ACTION volatile uint8_t MarlinUI::buttons; #if HAS_SLOW_BUTTONS @@ -255,6 +259,10 @@ void MarlinUI::init() { #if HAS_ENCODER_ACTION encoderDiff = 0; #endif + + #if HAS_TRINAMIC + init_tmc_section(); + #endif } bool MarlinUI::get_blink() { diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 8f986006e..cadec09c4 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -37,7 +37,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V63" +#define EEPROM_VERSION "V64" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -48,12 +48,16 @@ #if ADD_PORT_ARG #define PORTARG_SOLO const int8_t port + #define PORTARG_BEFORE const int8_t port, #define PORTARG_AFTER ,const int8_t port #define PORTVAR_SOLO port + #define PORTVAR_BEFORE port, #else #define PORTARG_SOLO + #define PORTARG_BEFORE #define PORTARG_AFTER #define PORTVAR_SOLO + #define PORTVAR_BEFORE #endif #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 { 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 { 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 #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_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_stealth_enabled_t tmc_stealth_enabled; // M569 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 // // LIN_ADVANCE @@ -974,6 +980,70 @@ void MarlinSettings::postprocess() { 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 // @@ -1630,6 +1700,60 @@ void MarlinSettings::postprocess() { #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 // @@ -2200,6 +2324,16 @@ void MarlinSettings::reset(PORTARG_SOLO) { #if HAS_TRINAMIC 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) void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); } #endif @@ -2895,6 +3029,81 @@ void MarlinSettings::reset(PORTARG_SOLO) { #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 /** diff --git a/Marlin/src/module/stepper_indirection.cpp b/Marlin/src/module/stepper_indirection.cpp index 248582ce9..fe07d554b 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -205,14 +205,12 @@ void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { st.begin(); - static constexpr int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1 - CHOPCONF_t chopconf{0}; chopconf.tbl = 1; - chopconf.toff = timings[0]; + chopconf.toff = chopper_timing.toff; chopconf.intpol = INTERPOLATE; - chopconf.hend = timings[1] + 3; - chopconf.hstrt = timings[2] - 1; + chopconf.hend = chopper_timing.hstrt + 3; + chopconf.hstrt = chopper_timing.hend - 1; st.CHOPCONF(chopconf.sr); st.rms_current(mA, HOLD_MULTIPLIER); @@ -221,6 +219,7 @@ st.TPOWERDOWN(128); // ~2s until driver lowers to hold current st.en_pwm_mode(stealth); + st.stored.stealthChop_enabled = stealth; PWMCONF_t pwmconf{0}; pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk @@ -442,21 +441,20 @@ template void tmc_init(TMCMarlin &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}; gconf.pdn_disable = true; // Use UART gconf.mstep_reg_select = true; // Select microsteps with UART gconf.i_scale_analog = false; gconf.en_spreadcycle = !stealth; st.GCONF(gconf.sr); + st.stored.stealthChop_enabled = stealth; TMC2208_n::CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; // blank_time = 24 - chopconf.toff = timings[0]; + chopconf.toff = chopper_timing.toff; chopconf.intpol = INTERPOLATE; - chopconf.hend = timings[1] + 3; - chopconf.hstrt = timings[2] - 1; + chopconf.hend = chopper_timing.hstrt + 3; + chopconf.hstrt = chopper_timing.hend - 1; st.CHOPCONF(chopconf.sr); st.rms_current(mA, HOLD_MULTIPLIER); @@ -545,13 +543,11 @@ void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const float, const bool) { st.begin(); - static constexpr int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1 - TMC2660_n::CHOPCONF_t chopconf{0}; chopconf.tbl = 1; - chopconf.toff = timings[0]; - chopconf.hend = timings[1] + 3; - chopconf.hstrt = timings[2] - 1; + chopconf.toff = chopper_timing.toff; + chopconf.hend = chopper_timing.hstrt + 3; + chopconf.hstrt = chopper_timing.hend - 1; st.CHOPCONF(chopconf.sr); st.rms_current(mA); diff --git a/Marlin/src/module/stepper_indirection.h b/Marlin/src/module/stepper_indirection.h index 1dfb219af..b1c6ae76e 100644 --- a/Marlin/src/module/stepper_indirection.h +++ b/Marlin/src/module/stepper_indirection.h @@ -66,6 +66,14 @@ #define _TMC_CLASS(MODEL, L) __TMC_CLASS(MODEL, L) #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) void tmc2208_serial_begin(); #endif @@ -99,9 +107,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define X_ENABLE_INIT NOOP #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE) #define X_ENABLE_READ stepperX.isEnabled() - #elif AXIS_DRIVER_TYPE(X, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X) #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() #else #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_WRITE(STATE) stepperY.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperZ.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperX2.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperY2.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperZ2.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperZ3.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperE0.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperE1.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperE2.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperE3.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperE4.setEnabled(STATE) #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_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() #else #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_WRITE(STATE) stepperE5.setEnabled(STATE) #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_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() #else #define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN)