aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/chelper
Commit message (Collapse)AuthorAgeFilesLines
* chelper: Add missing serialqueue_set_receive_window() def to serialqueue.hKevin O'Connor2020-09-261-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Use standard C type definition for pyhelper_logging_callbackKevin O'Connor2020-09-261-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Rework check for building C codeKevin O'Connor2020-09-261-22/+26
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Set compiler flags to never use "x387" floating point mathKevin O'Connor2020-09-151-7/+18
| | | | | | | | | The default on X86 32bit machines is to use 80bit floating point math (as found in the ancient "387 coprocessor"). This can cause numerical stability problems. Set the compiler flags to make sure the newer SSE math is always used on X86. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_shaper: Fix check for optimized X or Y only calculationsKevin O'Connor2020-08-301-5/+4
| | | | | | | The optimized version is only available if it's the only axis used. This fixes input_shaper on corexz. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_shaper: Add an init_shaper() helper functionKevin O'Connor2020-08-301-26/+22
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_shaper: Group shaper setup code togetherKevin O'Connor2020-08-301-90/+93
| | | | | | No code changes - just code movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_shaper: Allocate space for maximum number of shaper pulses in advanceKevin O'Connor2020-08-301-110/+99
| | | | | | | | Combine the shaper pulses and count of those pulses into a `struct shaper_pulses`. Allocate space for the maximum number of pulses in `struct input_shaper`. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Use stricter completion check in itersolve_find_step()Kevin O'Connor2020-08-081-2/+4
| | | | | | | | Use a more strict check for determining if the iterative solver has correctly found a step - the guess must be within 1 picometer of the target or correct to within 1 nanosecond. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Enhance "false position" method with "illinois algorithm"Kevin O'Connor2020-08-081-1/+8
| | | | | | | This prevents some cases where the iterative solver fails to converge in a reasonable time, causing "no next step" errors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* corexz: Add CoreXZ kinematics (#3129)Voron2020-07-302-7/+51
| | | | | Add a CoreXZ kinematics Signed-off-by: Maks Zolin <mzolin@vorondesign.com>
* input_shaper: Fixed C module compilation on older gnu90 compilersDmitry Butyugin2020-07-071-1/+2
| | | | | | | For example, Raspbian GNU/Linux 8 (jessie) uses an old GCC version 4.9.2 which uses -std=gnu90 by default. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* input_shaper: Initial support of input shaping (#3032)Dmitry Butyugin2020-07-052-2/+445
| | | | | | Input shaping can help to reduce printer vibrations due to resonances and eliminate or reduce ghosting in prints. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* itersolve: Use more explicit list traversal in itersolve_generate_steps()Kevin O'Connor2020-05-041-28/+44
| | | | | | | | Avoid using doubles as flags when generating steps during "lead up to stepper activity". Instead, explicitly track how many inactive move entries are skipped and only generate steps for those entries. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Fix numeric stability of flush range timesKevin O'Connor2020-05-041-2/+6
| | | | | | | | | Don't assume the times passed to itersolve_gen_steps_range() are contained within the move. It's possible the checks in itersolve_generate_steps() may round to different values when converting the times to a relative move time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Implement a step+dir+step filterKevin O'Connor2020-03-133-28/+101
| | | | | | | | | | 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>
* stepcompress: Move code around in stepcompress.cKevin O'Connor2020-03-132-51/+51
| | | | | | Just code movement - no code changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Revert "itersolve: Implement a step+dir+step filter"Kevin O'Connor2020-03-052-81/+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-042-5/+81
| | | | | | | | | | 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-043-88/+35
| | | | | | | | | | 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>
* serialqueue: Support notification of when a command is processedKevin O'Connor2020-02-203-13/+52
| | | | | | | | | Add ability for the host code to get a notification when the ack for a command sent to the micro-controller is received. This is in preparation for improved detection of message loss between mcu and host. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Remove unused serialqueue_encode_and_send() functionKevin O'Connor2020-02-202-19/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Fix rounding error when interval=0Kevin O'Connor2020-01-251-2/+2
| | | | | | | | | In the rare case where the step generation code finds an interval of zero, it was possible for an integer division of a negative number to cause an incorrect result. Fix that by using the idiv_up() and idiv_down() helpers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Add ability to query the active_flags stateKevin O'Connor2020-01-233-0/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* rotary_delta: Initial support for rotary delta kinematicsKevin O'Connor2020-01-062-2/+81
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Export itersolve_calc_position_from_coord()Kevin O'Connor2020-01-063-1/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_extruder: Convert pressure advance to use "weighted average"Kevin O'Connor2019-12-201-19/+54
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Limit the duration of "null" sentinal moves on the trapqKevin O'Connor2019-12-201-1/+7
| | | | | | | | | If a null move is added as the first move on the trapezoid motion queue then it could have a very large move->move_t value. This could cause numerical stability issues with some advanced kinematic formulas. Place a limit on the move_t value to avoid this. 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-103-9/+10
| | | | | | Rename the variables to make it a little more clear what they do. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_extruder: Apply pressure advance in kin_extruder.cKevin O'Connor2019-12-082-60/+25
| | | | | | | | Implement the pressure advance calculations while performing the definitive integral calculations. This simplifies both the extruder.py and kin_extruder.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* kin_extruder: Move integration code from trapq.c to kin_extruder.cKevin O'Connor2019-12-083-67/+65
| | | | | | | Move the code that calculates the definitive integral to the kin_extruder.c file. 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>
* extruder: Initial support for "smoothed pressure advance"Kevin O'Connor2019-11-212-60/+47
| | | | | | | Support averaging the extruder position over a time range to "smooth out" the velocity changes that occur during pressure advance. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Add trapq_find_move() functionKevin O'Connor2019-11-212-0/+22
| | | | | | | Add support for finding a move by time in the trapezoidal velocity move list. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Add code to calculate definitive integralKevin O'Connor2019-11-212-1/+51
| | | | | | | Support calculating the definitive integral of a cartesian axis position over a time range of the movement queue. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* itersolve: Support step generation in lead up to and after stepper activityKevin O'Connor2019-11-212-6/+28
| | | | | | | | | | | 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-213-17/+55
| | | | | | | 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-133-8/+7
| | | | | | | | 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: Use C99 method for declaring struct members in trapq_append()Kevin O'Connor2019-11-071-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chelper: Report an error if the C host code does not compileKevin O'Connor2019-11-071-1/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Calculate and store axes_r in move classKevin O'Connor2019-11-063-13/+5
| | | | | | | | Calculate the ratio of axis distance to total move distance (axis_d / move_d) and store in a new member variable axes_r. This avoids needing to recalculate the value in other code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Use separate 'move' entries for accel, cruise, and decel phasesKevin O'Connor2019-11-064-70/+84
| | | | | | | | Only track a single acceleration movement in a 'struct move' instance. Break the classic trapezoid movement (accel, cruise, decel) into three separate movements. This simplifies the calculation logic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* trapq: Remove move_fill()Kevin O'Connor2019-11-065-30/+35
| | | | | | | 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-063-11/+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>
* extruder: Convert step generation to use trapq systemKevin O'Connor2019-11-061-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* winch: Convert step generation to use trapq systemKevin O'Connor2019-11-061-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>