aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/chelper/itersolve.c
Commit message (Collapse)AuthorAgeFilesLines
* stepcompress: Implement a step+dir+step filterKevin O'Connor2020-03-131-1/+14
| | | | | | | | | | Some stepper motor drivers do not respond well to rapid "step + direction change + step" events. In particular, it is believed this can cause "over current" events on the tmc2208 drivers when they are in "stealthchop" mode. Detect these events and remove them from the generated step times. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Revert "itersolve: Implement a step+dir+step filter"Kevin O'Connor2020-03-051-78/+5
| | | | | | | | This reverts commit c9cb462f90a68deb73cacb179f7bbcde2cb9aeed. The step flushing for this commit was not complete. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Implement a step+dir+step filterKevin O'Connor2020-03-041-5/+78
| | | | | | | | | | Some stepper motor drivers do not respond well to rapid "step + direction change + step" events. In particular, it is believed this can cause "over current" events on the tmc2208 drivers when they are in "stealthchop" mode. Detect these events and remove them from the generated step times. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Reset bounds search on a direction changeKevin O'Connor2020-03-041-2/+10
| | | | | | | | If the stepper changes direction then the average velocity since the last step pulse isn't a good indicator of the next step pulse. Instead, reset the bounds checking to use a low starting guess. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Simplify main itersolve_gen_steps_range() loopKevin O'Connor2020-03-041-46/+42
| | | | | | Reorder the loop to try and make the code flow a little simpler. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Remove "queue append" abstractionKevin O'Connor2020-03-041-10/+3
| | | | | | | | | | The queue_append system predates the iterative solver - it was useful when many different kinematic functions directly added steps to the step compression queues. With the iterative solver being the only source of step generation, it is simpler to directly add steps from the iterative solver code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Add ability to query the active_flags stateKevin O'Connor2020-01-231-0/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Export itersolve_calc_position_from_coord()Kevin O'Connor2020-01-061-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Improve numerical stability of gen_steps_pre_active checkKevin O'Connor2019-12-101-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Rename scan_pre/_post to gen_steps_pre/post_activeKevin O'Connor2019-12-101-6/+6
| | | | | | Rename the variables to make it a little more clear what they do. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Fix potential backwards time in itersolve_gen_steps_range()Kevin O'Connor2019-12-021-2/+4
| | | | | | | Make sure that a newly choosen "high" bound is always greater than the "low" bound. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Support step generation in lead up to and after stepper activityKevin O'Connor2019-11-211-5/+26
| | | | | | | | | | | Add support for generating steps from kinematic functions that calculate step times based on a range of the motion queue. It requires scanning for step generation during the lead up to stepper activity (when the stepper would nominally be idle). And it requires scanning for step generation just after a stepper has nominally become idle. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Implement sentinel nodes on the trapq listKevin O'Connor2019-11-211-14/+9
| | | | | | | Use sentinels to make list traversal code simpler. Also add in null moves so that there are no time gaps in the list. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Remove set_commanded_position() callKevin O'Connor2019-11-131-3/+4
| | | | | | | | 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>
* itersolve: Improve numerical stability of itersolve_generate_steps() loopKevin O'Connor2019-11-081-11/+10
| | | | | | | Minor rework of the loop to reduce the chance that numerical stability could cause an infinite loop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Remove move_fill()Kevin O'Connor2019-11-061-1/+3
| | | | | | | Now that all callers use the trapq system to queue moves, it is no longer necessary to individually allocate and fill a 'struct move'. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Remove unused gen_steps()Kevin O'Connor2019-11-061-9/+1
| | | | | | | 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>
* itersolve: Add support for generating steps from a trapqKevin O'Connor2019-11-061-7/+91
| | | | | | | 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>
* trapq: Add new trapq.c file with code for trapezoidal velocity handlingKevin O'Connor2019-11-061-89/+3
| | | | | | Move the "struct move" code from itersolve.c to new file trapq.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* polar: Implement bed angle wrapping adjustments in chelper codeKevin O'Connor2019-11-061-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Rename calc_position to calc_position_cbKevin O'Connor2019-11-061-7/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Fix possible infinite loop in itersolve_gen_steps()Kevin O'Connor2019-11-061-1/+3
| | | | | | | | If the kinematic position calculation function had an error in it (if it produces sudden position changes) then it could lead to an infinite loop in itersolve_gen_steps(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Support calculating a stepper position from a cartesian coordinateKevin O'Connor2018-07-181-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Support setting the stepper position via a cartesian coordinateKevin O'Connor2018-06-221-0/+10
| | | | | | | | | Add support for an itersolve_set_position() function that sets a stepper position from a cartesian coordinate. This eliminates the need for both the python and C code to be able to translate from a cartesian coordinate to a stepper position. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Move tracking of commanded position to itersolve codeKevin O'Connor2018-06-201-3/+8
| | | | | | | Track the commanded position in just the itersolve.c code instead of in mcu.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Convert to using iterative solverKevin O'Connor2018-06-201-14/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Add kinematic iterative solver codeKevin O'Connor2018-06-201-0/+236
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>