aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/tmc2208.py
Commit message (Collapse)AuthorAgeFilesLines
* tmc: Add support for a get_status() methodKevin O'Connor2021-08-301-0/+1
| | | | | | Export mcu_phase_offset and drv_status information. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Convert to using tmc mcu_phase_offsetKevin O'Connor2021-08-081-2/+1
| | | | | | | Now that the TMC drivers track the phase offset, use that to implement endstop phase. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move stepper phase reading code to TMCCommandHelper classKevin O'Connor2021-08-061-3/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Consistently use lower case for all TMC field namesKevin O'Connor2021-08-061-71/+71
| | | | | | | | | | | | The Trinamic specs aren't consistent with upper vs lower case, which can be confusing. Improve clarity by using lower case names consistently in the code. Register names will continue to use all upper case naming in the code. Update the SET_TMC_FIELD command to automatically convert field names to lower case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Send pdn_disable UART setup as first command to chip during initKevin O'Connor2021-08-061-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move SET_TMC_CURRENT command to TMCCommandHelper()Kevin O'Connor2021-02-271-2/+2
| | | | | | | 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>
* extras: Use "from . import module" for relative importsKevin O'Connor2020-06-151-1/+1
| | | | | | Use alternate import syntax to improve Python3 compatibility. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Remove virtual_enable support and replace with automatic supportKevin O'Connor2019-11-121-2/+0
| | | | | | | 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>
* tmc: Configure "intpol" field from TMCMicrostepHelperKevin O'Connor2019-06-281-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Add support for virtual enable pinsKevin O'Connor2019-06-281-0/+2
| | | | | | | 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: Simplify internal DUMP_TMC interfaceKevin O'Connor2019-06-251-12/+6
| | | | | | | | 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>
* tmc_uart: Move UART code from tmc2208.py to new file tmc_uart.pyKevin O'Connor2019-06-181-212/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Make sure each analog mux config is uniqueKevin O'Connor2019-06-181-0/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Add support for using an analog mux to access TMC uartsKevin O'Connor2019-06-121-18/+92
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Separate low-level bit-banging code from MCU_TMC_uart classKevin O'Connor2019-06-121-21/+29
| | | | 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-6/+6
| | | | | | Move common code from tmc2130.py to tmc.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Rework remaining config helpers to use mcu_tmc interfaceKevin O'Connor2019-06-101-14/+5
| | | | | | | | Introduce TMCMicrostepHelper and TMCStealthchopHelper helper code that uses the mcu_tmc interface. Update the callers to use these new helpers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Move current setting code to its own helper classKevin O'Connor2019-06-101-46/+2
| | | | | | | Concentrate the current setting code into its own TMCCurrentHelper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Transmit register initialization during connect callbackKevin O'Connor2019-06-101-11/+0
| | | | | | | | Perform the register initialization directly from TMCCommandHelper and perform it during the "connect" phase. This unifies the register setup for the TMC2130, TMC2208, TMC2660, and TMC5160. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Use TMCCommandHelperKevin O'Connor2019-06-101-47/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Move get/set_register functions to new MCU_TMC_uart classKevin O'Connor2019-06-101-112/+124
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Check field name validity. (#1697)Artem Belevich2019-06-021-1/+3
| | | | | This avoids crashing Klipper if user entered invalid field name. Signed-off-by: Artem Belevich <artemb@gmail.com>
* tmc2130: Add support for two's complement signed fields to FieldHelperKevin O'Connor2019-05-291-2/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: add SET_TMC_CURRENT and SET_TMC_FIELD commands (#1419)amblidex2019-03-221-1/+54
| | | Signed-off-by: Frank Kang <amblidex@outlook.com>
* tmc2130: Rename driver_BLANK_TIME_SELECT to driver_TBLKevin O'Connor2019-03-081-1/+1
| | | | | | | Use the field names from the trinamic specification. This makes the field similar to all the other driver_XXX config options. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Change respond_info() to log by defaultKevin O'Connor2019-03-041-6/+2
| | | | | | | It makes sense to log most respond_info() content, so do that by default. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Add support for INIT_TMC commandKevin O'Connor2019-03-011-3/+12
| | | | | Signed-off-by: Frank Kang <amblidex@outlook.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Report write-only registers in DUMP_TMCKevin O'Connor2019-02-271-0/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Use FieldHelper() to set/get driver fieldsKevin O'Connor2019-02-211-17/+4
| | | | | | | Use the field helper to simplify the bit manipulation in the driver. This also enables the extended DUMP_TMC output. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* manual_stepper: Add an "extras" module for manually controlling a stepperKevin O'Connor2019-02-121-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Share config reading helpers with tmc2208.py codeKevin O'Connor2019-02-031-39/+6
| | | | | | | | Add helper function for reading current, microsteps, and stealthchop settings from the config file. Use these helpers in both the tmc2130 and tmc2208 modules. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Rename self.field_helper to self.fieldsKevin O'Connor2019-02-031-17/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: move local set_field/get_field helpers to FieldHelper classKevin O'Connor2019-02-031-52/+32
| | | | | | | Move these helper functions to the FieldHelper class so that they can be used by other Trinamic drivers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Add helper for setting fields from the config fileKevin O'Connor2019-02-031-45/+42
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Use field definitions during driver initKevin O'Connor2019-02-031-24/+43
| | | | | | Reduce the amount of bit manipulations by using the FieldHelper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Add register field formattersDmitry Frolov2019-02-031-1/+23
| | | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Dmitry Frolov <dmitry.frolov@gmail.com>
* tmc2130: Convert field helper into a classKevin O'Connor2019-02-031-3/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Decode register fields in DUMP_TMC (#1156)lorf2019-02-021-1/+154
| | | | | | | | | | | Report values of TMC2208 register fields in DUMP_TMC command to help in tuning and diagnostics. This also adds functions to refer to register fields by name for TMC drivers and register mappings for TMC2208. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Dmitry Frolov <dmitry.frolov@gmail.com>
* tmc2208: Check for debugging mode before checking for a retransmitKevin O'Connor2019-01-101-0/+2
| | | | | | Allow the tmc2208 code to be run from regression test cases. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("connect") to an event handlerKevin O'Connor2019-01-081-4/+5
| | | | | | | Convert all users of the printer_state("connect") handler to register a "klippy:connect" event handler instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: error raise fixed for rx/tx mcu checkPetri Honkala2018-12-271-1/+1
| | | | Signed-off-by: Petri Honkala <cruwaller@gmail.com>
* endstop_phase: Add support for detecting phase via TMC stepper driversKevin O'Connor2018-10-161-0/+4
| | | | | | | | The Trinamic stepper motor drivers are capable of reporting the stepper phase - add support for using that capability to the enddstop_phases module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Improve error handlingKevin O'Connor2018-09-301-2/+5
| | | | | | | | Configure the tmc2208 during the 'connect' phase so that a problem during configuration is properly raised as a config error. Catch errors during DUMP_TMC and raise them as g-code errors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Rename add_config_object() to register_config_callback()Kevin O'Connor2018-09-031-1/+1
| | | | | | | | | Change the name of the config registration method and pass an explicit reference to the callback to the new method. This makes the relationship between mcu registration and build_config() more clear in the calling code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Initial support for configuring TMC2208 driversKevin O'Connor2018-08-271-0/+234
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>