aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/stepper.py
Commit message (Collapse)AuthorAgeFilesLines
* stepper: Add mcu_to_commanded_position() methodKevin O'Connor2021-08-221-2/+1
| | | | | | | Convert stepper.get_past_commanded_position() to the more general stepper.mcu_to_commanded_position(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Use config.getlists() for gear_ratio config optionKevin O'Connor2021-08-211-10/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Calculate homing position based on trigger timeKevin O'Connor2021-08-171-1/+2
| | | | | | | | | Calculate the "homing position" using the endstop trigger time instead of the position of the steppers. This is in preparation for multi-mcu homing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Track offset between tmc driver and mcu positionKevin O'Connor2021-08-081-0/+1
| | | | | | | | Track the offset between driver phase and mcu position. This offset should be constant as long as neither the driver nor the mcu is reset. If the offset ever changes, log a warning. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Query the stepper mcu position during startupKevin O'Connor2021-08-061-2/+7
| | | | | | | | Try to keep the host mcu_position synchronized with the micro-controller by querying during startup and after every homing event. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Pass clock to stepcompress_set_last_position()Kevin O'Connor2021-08-061-1/+4
| | | | | | | | | Using sc->last_step_clock for the last position marker does not work properly, because the stepper.py code calls stepcompress_reset() prior to calling stepcompress_set_last_position(). Fix by passing an explicit clock to stepcompress_set_last_position(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* motion_report: Add new extras module for low-level motion diagnosticsKevin O'Connor2021-07-291-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Simplify helper module registration of stepper motorsKevin O'Connor2021-07-291-6/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Support extracting stepcompress historyKevin O'Connor2021-07-291-0/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Minor indentation changesKevin O'Connor2021-07-031-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Restore mcu_position on set_stepper_kinematics() and set_step_dist()Kevin O'Connor2021-06-111-15/+20
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Remove set_tag_position() codeKevin O'Connor2021-05-291-7/+2
| | | | | | Have callers store the stepper positions in a dict. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Improve get_past_commanded_position()Kevin O'Connor2021-05-291-5/+7
| | | | | | | | Pass a print_time instead of a clock to get_past_commanded_position(). Fix calculation on steppers that home and use an inverted direction pin. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Remove min_stop_interval from mcu codeKevin O'Connor2021-04-301-2/+1
| | | | | | | Now that the host never uses a min_stop_interval, remove it from the mcu code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Do not set min_stop_interval in micro-controllerKevin O'Connor2021-04-301-17/+3
| | | | | | | | The min_stop_interval safety check is fragile and leads to a notable amount of complexity. Avoid these issues by not programming this safety check. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Register a config default for calculated homing_positive_dirKevin O'Connor2021-04-161-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Add support for tracking history of queue_step commandsKevin O'Connor2021-03-131-1/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Improve error messages on missing rotation_distanceKevin O'Connor2021-02-231-5/+8
| | | | | | | | If neither rotation_distance nor step_distance is present, then generate an error saying rotation_distance is needed (instead of an error about step_distance). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Don't cache ffi_lib object in the stepperKevin O'Connor2021-02-181-20/+25
| | | | | | | It's easier to just call chelper.get_ffi() if the ffi_lib object is needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buildcommands: Extend number of available mcu messages from 96 to 128Kevin O'Connor2021-02-181-9/+9
| | | | | | | | | | | Some internal code treats the message ids as encoded "variable length quantities", while other internal code assumes the message id is always one byte long. Continue using this scheme, but convert the VLQ users to use the name "msgtag" while the 1-byte users use "msgid". Increase the number of available msgids from 96 to 127 - the higher values get encoded as negative "msgtags". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Calculate step_distance from rotation_distanceKevin O'Connor2020-12-181-1/+42
| | | | | | | | 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>
* homing: Prefer printer.command_error() instead of homing.CommandError()Kevin O'Connor2020-09-041-1/+1
| | | | | | | Update callers to use the printer.command_error reference instead of directly using homing.CommandError() when raising or catching errors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Add support for commands to send only on a host restartKevin O'Connor2020-07-251-2/+2
| | | | | | | | Add a new "on_restart" parameter to mcu.add_config_cmd() and only send those commands on a host restart that does not involve a micro-controller restart. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Make sure to reload trapq in set_stepper_kinematics()Kevin O'Connor2020-06-301-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename try_load_module() to load_object()Kevin O'Connor2020-05-081-3/+3
| | | | | | | | Rename try_load_module() so that it uses consistent naming for "printer objects". Change the function to raise an error by default if the specified module does not exist. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: No need to pass stepper_kinematics to set_step_dist()Kevin O'Connor2020-03-281-3/+2
| | | | | | | Also, no need to log in stepper.py as the update is already logged in extruder.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Extruder: Add g-code to set extruder step_distance (#2598)David Smith2020-03-281-0/+4
| | | Signed off by: David Smith <davidosmith@gmail.com>
* stepper: Add a config check for obvious incorrect homing_positive_dirKevin O'Connor2020-03-241-0/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Introduce new lookup_query_command() command wrapperKevin O'Connor2020-02-201-4/+4
| | | | | | | Use new mcu.lookup_query_command() for all commands that query information from the micro-controller. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Ability to set retract speed between homing moves (#2487)FanDjango2020-02-121-4/+6
| | | | | On the retract move between homing moves, use a different speed (typically a faster one). Signed-off-by: Mike Stiemke <fandjango@gmx.de>
* itersolve: Add ability to query the active_flags stateKevin O'Connor2020-01-231-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Export itersolve_calc_position_from_coord()Kevin O'Connor2020-01-061-3/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Track if using units of radians instead of millimetersKevin O'Connor2020-01-061-5/+12
| | | | | | | | The STEPPER_BUZZ command needs to know if the axis is using radians instead of millimeters so that it can move a more appropriate distance. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Remove set_commanded_position() callKevin O'Connor2019-11-131-12/+6
| | | | | | | | Now that the only caller to set_commanded_position() is set_position(), remove the set_commanded_position() method and pass the set_position() call directly to the itersolve.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Do not call itersolve_set_commanded_pos() after homingKevin O'Connor2019-11-131-2/+1
| | | | | | | | Now that the homing code does not use get_commanded_position(), it is no longer necessary to alter the low-level commanded position after a homing move. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Add get/set_tag_position() and convert calc_position()Kevin O'Connor2019-11-131-1/+7
| | | | | | | | | Rename calc_position() to calc_tag_position() and have it calculate the value of the position from the last stepper set_tag_position() call. This enables the calc_tag_position() code to be more flexible as it can be run with arbitrary positions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Remove add_to_endstop() methodKevin O'Connor2019-11-121-7/+2
| | | | | | | Now that the PrinterStepper and MCU_stepper classes have been merged, there is no need for the add_to_endstop() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Merge PrinterStepper and MCU_stepper classesKevin O'Connor2019-11-121-69/+48
| | | | | | | There's no need to track the two classes separately - just combine them. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Move MCU_stepper from mcu.py to stepper.pyKevin O'Connor2019-11-121-2/+139
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Simplify PrinterRail initKevin O'Connor2019-11-121-23/+18
| | | | | | Use add_extra_stepper() during class init. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper_enable: Move enable tracking from stepper.py to stepper_enable.pyKevin O'Connor2019-11-121-68/+7
| | | | | | | Move the enable line tracking out of the main stepper.py code. This simplifies the main kinematic code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper_enable: Move motor_off() logic to stepper_enable.pyKevin O'Connor2019-11-121-0/+1
| | | | | | | | Directly disable all the stepper motors on a global motor_off() from the StepperEnable() class in stepper_enable.py. This simplifies the toolhead and kinematic classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper_enable: Add new extras module for stepper enable line trackingKevin O'Connor2019-11-101-0/+2
| | | | | | | Move the M18/M84 command handling from gcode.py to new stepper_enable module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Remove unused gen_steps()Kevin O'Connor2019-11-061-6/+0
| | | | | | | Eliminate the old gen_steps() call now that all callers have been converted to the newer trapq based generate_steps(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Remove set_ignore_move()Kevin O'Connor2019-11-061-1/+0
| | | | | | | Update callers of set_ignore_move() to use the trapq system to set a stepper to ignore moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Add support for generating steps from a trapqKevin O'Connor2019-11-061-0/+14
| | | | | | | Support associating a stepper_kinematics with a trapq. Support generating steps from a time range on the given trapq. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Add support for providing a list of pins to enableKevin O'Connor2019-06-281-11/+23
| | | | 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-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Move endstop phase homing code to new "extras" moduleKevin O'Connor2018-10-161-57/+0
| | | | | | | Move the endstop phase tracking code from stepper.py to a new extras/endstop_phase.py module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Add a set_commanded_position() method to MCU_stepperKevin O'Connor2018-10-101-3/+7
| | | | | | Add the ability to directly set the "commanded" stepper position. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>