Commit Graph

14 Commits

Author SHA1 Message Date
Kevin O'Connor acd165cbea stepcompress: Implement a step+dir+step filter
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>
2020-03-13 21:53:48 -04:00
Kevin O'Connor d86bf0b927 stepcompress: Move code around in stepcompress.c
Just code movement - no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-03-13 21:53:48 -04:00
Kevin O'Connor bc6c3ba92f stepcompress: Remove "queue append" abstraction
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>
2020-03-04 19:43:47 -05:00
Kevin O'Connor 5ca132eafa stepcompress: Fix rounding error when interval=0
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>
2020-01-25 14:20:44 -05:00
Kevin O'Connor c3fe3d0d2c stepcompress: Remove no longer needed stepcompress_set_homing()
Now that homing is implemented via "drip moves", it is no longer
necessary for the stepcompress code to have special homing logic.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-07-10 10:43:20 -04:00
Kevin O'Connor e4d52a19b8 stepcompress: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 14:20:15 -05:00
Kevin O'Connor 8f747e2720 kin_cartesian: Remove stepcompress_push_const()
All the kinematic code now uses the iterative solver to generate
steps.  Remove the old stepcompress_push_const() mechanism.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 2511471b0d itersolve: Add kinematic iterative solver code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor ba3428822d stepcompress: Allow stepcompress_alloc() to be called early
Don't require an mcu connection to allocate the stepcompress object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 9a2eb4bedd chelper: Move cartesian and delta kinematics code to their own C files
Move the cartesian and delta specific code to new files
kin_cartesian.c and kin_delta.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 8a830ff0ce chelper: Compile with gcc -fwhole-program option
Use the -fwhole-program option when compiling the host C code.  This
makes it easier to support inlining across C files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Kevin O'Connor 189ebb4c7d chelper: Add compiler.h header
Add the compiler.h header file to the chelper code - this adds a
number of useful gcc definitions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-20 09:26:10 -04:00
Michael Barbour a748cf39eb stepcompress: Fix comment typo.
Signed-off-by: Michael Barbour <barbour.michael.0@gmail.com>
2018-06-04 09:41:55 -04:00
Kevin O'Connor 15248706ae chelper: Move the host C code to a new klippy/chelper/ directory
Move the C code out of the main klippy/ directory and into its own
directory.  This reduces the clutter in the main klippy directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-30 11:44:53 -04:00