aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/tmc.py
Commit message (Collapse)AuthorAgeFilesLines
* tmc: Fix order of init during sensorless homingKevin O'Connor2021-02-281-4/+8
| | | | | | | | | | | With commit 53b10d3a the setup of sensorless homing could occur before the driver was enabled which would cause the reinitialization of the driver settings to undo the sensorless homing setup. Use set_field() when setting the sensorless homing registers so that it wont conflict with a driver init. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: No need to delay init on a stepper enableKevin O'Connor2021-02-281-3/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Allow more retries on a TMC UART read error during background checksKevin O'Connor2021-02-281-1/+10
| | | | | | | Allow three retries if we can't contact the TMC driver at all when it is in UART mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Add support for periodic checking of driver statusKevin O'Connor2021-02-271-1/+76
| | | | | | | | Check the status of all Trinamic stepper motor drivers once a second. If the driver reports an error then invoke a shutdown. Also log any serious warnings. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Reinitialize on every driver enableKevin O'Connor2021-02-271-32/+36
| | | | | | | | | | | | | Send the full TMC stepper motor driver initialization sequence every time the driver is enabled. Don't raise an error on startup if unable to contact a tmc2208/tmc2209 driver. If the driver is still unavailable when it is enabled then a shutdown will be issued. This allows users to troubleshoot (and possibly bring up communication to the driver) prior to enabling the driver. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Always report values after a SET_TMC_CURRENT commandKevin O'Connor2021-02-271-14/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move SET_TMC_CURRENT command to TMCCommandHelper()Kevin O'Connor2021-02-271-1/+27
| | | | | | | Refactor the tmc driver implementations so that there is a single implementation of the SET_TMC_CURRENT command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Improve error message on missing microsteps configKevin O'Connor2021-02-231-1/+2
| | | | | | | If microsteps is missing, warn about it in the stepper config section, not the tmc config section. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Obtain phases directly from stepper microsteps configKevin O'Connor2020-12-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Calculate step_distance from rotation_distanceKevin O'Connor2020-12-181-3/+9
| | | | | | | | Add support for automatically calculating the internal step_distance from new config parameters - rotation_distance, microsteps, full_steps_per_rotation, and gear_ratio. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Use configfile note_valid=False when inspecting stepper step_distanceKevin O'Connor2020-12-131-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc5160: diag0 support (#3159)Trevor Jones2020-08-091-4/+13
| | | | | Allow for diag0 only hardware to use sensorless homing. Signed-off-by: Trevor Jones <trevorjones141@gmail.com>
* tmc: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-23/+21
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Revert incorrect changes to TPWMTHRS settingKevin O'Connor2020-02-201-26/+18
| | | | | | | | | | | | | | It's not valid to set the TPWMTHRS in a "klippy:connect" event handler because the TMCVirtualPinHelper and TMCCommandHelper classes were expecting that field to be set during the config reading phase. Revert "tmc: Fix typo preventing stealthchop threshold from being set" This reverts commit 7d76067ff9efaf75808b05f768dfef4295251ede. Revert "tmc: Query the stepper step_distance from the stepper object" This reverts commit 67b285224952749583d7bb3af3eb6397f63b492e. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Merge home_prepare()/home_finalize() into move_begin/move_end eventsKevin O'Connor2020-02-151-35/+34
| | | | | | | | Collapse the "homing:move_begin", "homing:move_end", home_prepare(), and home_finalize() into two new events: "homing:homing_move_begin" and "homing:homing_move_end". This simplifies the homing code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Fix typo preventing stealthchop threshold from being setKevin O'Connor2020-02-091-2/+3
| | | | | | Fix typo introduced in commit 67b28522. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Query the stepper step_distance from the stepper objectKevin O'Connor2020-02-011-17/+24
| | | | | | | Don't obtain the step_distance from the config, instead obtain step_distance from the instantiated stepper object. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Remove virtual_enable support and replace with automatic supportKevin O'Connor2019-11-121-33/+30
| | | | | | | Automatically detect if the stepper has a dedicated enable line. If it does not, then automatically enable virtual enable support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2209: Add support for sensorless homingKevin O'Connor2019-08-191-6/+24
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Integrate query_endstop_wait() into query_endstop()Kevin O'Connor2019-07-101-1/+0
| | | | | | There is no need to have two separate calls to query an endstop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Configure "intpol" field from TMCMicrostepHelperKevin O'Connor2019-06-281-3/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Add support for virtual enable pinsKevin O'Connor2019-06-281-6/+34
| | | | | | | Add support for enabling the stepper via the communication channel. This improves support for boards with a shared enable line. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: It's not valid to schedule messages with print_time=0Kevin O'Connor2019-06-251-2/+2
| | | | | | | | A print_time of zero may translate to a negative clock on a secondary micro-controller, which would cause an internal error. Change the code to pass a real print_time or None if it is not needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Simplify internal DUMP_TMC interfaceKevin O'Connor2019-06-251-7/+9
| | | | | | | | Only the tmc2208 driver needs special read register translation logic. Rework the code so a default implementation is available for all the other drivers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Fix endstop_phase on trinamic drivers that aren't invertedKevin O'Connor2019-06-211-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Retry register init during connectKevin O'Connor2019-06-181-4/+12
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move common TMC stepper driver code to new file tmc.pyKevin O'Connor2019-06-101-0/+242
Move common code from tmc2130.py to tmc.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>