It is not valid to pause in the klippy:ready callback, so perform the
sensor startup process in a separate reactor task.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Determine which mcu raised the shutdown from the shutdown details
report. Also, pass shutdown_clock via that details report.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move reactor debugging info from main klippy.py code to error_mcu code
for improved exception handling.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the event to make it a little more clear what it is intended
for. Also, check for an exception in each event handler.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Step timing is reset when stepper.set_position() is called. Detect
that case and ensure future steps after set_position start on a new
block. This simplifies the timing for users of the data.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that trapq_extract_old() can return upcoming moves, it's possible
for homing to cause confusing results (as these moves can end early).
Avoid this by delaying query responses until after homing completes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the step compress code to perform regular step+dir+step
filtering even during probing and homing actions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Currently, the LEDHelper() and GCodeRequestQueue() helper classes
require that their callbacks do not block. As a result, the pca9533,
pca9632, and sx1509 devices need to use non-blocking i2c write calls.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Numerically optimized versions of *EI shapers have been tuned
for specific ranges of damping ratios and will show poor stability
outside of these designated ranges.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Implement step generation from 'struct syncemitter' instead of in the
stepcompress code. This simplifies the stepcompress code and
simplifies the overall interface.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move msg_queue allocation from stepcompress to syncemitter. With this
change the pwm_tool module does not need to allocate a stepcompress
object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a new 'struct syncemitter' for each object that can generate
messages for a 'struct steppersync' and store in a regular linked
list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new C based mechanism for tracking all the 'struct steppersync'
instances. This simplifies memory management.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the next_batch_time even if it is slightly past or before the
ideal flushing window. This should improve run to run reproducibility
of flush timing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the host code does not flush far into the future, it is no
longer necessary to flush in waves. Integrate _advance_flush_time()
into _flush_motion_queues().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a flush_all_steps() request is for a time far in the future, then
wait for that time to become close prior to flushing steps. This
avoids committing to a step schedule that is far in the future.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't tie the step generation logic to the toolhead lookahead logic.
Instead, use regular timers to generate steps with a goal of staying
500-750ms ahead of the micro-controllers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Using separate flush_time and step_gen_time is a minor optimization.
Using it in drip_update_time() complicates the code and may reduce the
time needed to schedule post homing/probing movements.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't try to infer when the step generation scan window may change.
Instead, require the input_shaper and pressure_advance code call
motion_queuing.check_step_generation_scan_windows() any time a
scanning window may change.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Other modules could access the extruderN by
the printer lookup_object().
That would return this wrapper class.
Specifically, filament_motion_sensor will.
They can try to access missing methods
and klippy would crash.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Remove the toolhead note_step_generation_scan_time() code and
automatically detect the itersolve scan windows that are in use.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move low-level step generation timing code to the motion_queing
module. This helps simplify the toolhead module. It also helps
centralize the step generation code into the motion_queing module.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Invoke flush_step_generation() prior to checking motor enable state as
this is the best way to ensure all stepper active callbacks have been
invoked (which could change the enable line state).
Also, there is no longer a reason to add additional toolhead dwells
when enabling a stepper motor.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There were several slightly different implementations of explicit
stepper motor enabling/disabling in the force_move, stepper_enable,
and manual_stepper modules. Introduce a new set_motors_enable()
method and use this in all implementations. This simplifies the code
and reduces the chance of obscure timing issues.
This fixes a manual_stepper error introduced in commit 9399e738. That
commit changed the manual_stepper class to no longer explicitly flush
and clear all steps after each move, which broke the expectations of
manual_stepper's custom enable code. Using the more robust
implementation in stepper_enable fixes that issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It seems python2 string.split() method does not accept a "maxsplit"
parameter. Use a format compatible with both python2 and python3.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit d40fd219 added support for defining extra axes, however that
change could break the M114 command. Update the code to fix M114.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>