Don't rely on an exact floating point number match to detect when a
forced lookahead flush is needed.
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>
If a stepper kinematics has a "scan window" defined during its first
flush then the iterative solver may walk past the head sentinel. Set
a small negative print_time for the head sentinel to avoid this corner
case.
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>
Add a new is_runout parameter to _flush_lookahead() and use that in
places that could set check_stall_time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The SelectReactor has a different event dispatch system from the
PollReactor and EPollReactor. However, in practice the PollReactor
code is always used, so there is no reason to maintain a different
implementation for SelectReactor. Rework the code so that
SelectReactor file dispatch handling is done the same way as
PollReactor (and EPollReactor). This simplfiies the code.
Introduce a new _check_fds() method that is shared between Reactor
implementations.
Also, fix some cut-and-paste bugs in SelectReactor and EPollReactor.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure to check for an out-of-order M112 command on the gcode
pseudo-tty even if there is no pending commands being processed from
that gcode pseudo-tty. There could be long running commands pending
from webhooks, virtual_sdcard, or similar.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The "lazy" greenlet implementation could allow the same timer to run
multiple times in parallel if the first timer instance calls pause()
and another task calls update_timer(). This is confusing and can
cause hard to debug errors. Add a new timer_is_running flag to
prevent it.
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>
Move the code that implements flushing in waves from
_advance_move_time() to _advance_flush_time(). This also separates
print_time tracking from the _advance_flush_time() implementation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Automatically add kin_flush_delay to the requested flush time if
is_step_gen=True. This simplifies the callers.
Also, rename self.step_gen_time to self.need_step_gen_time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 3d3b87f9 renamed last_sg_flush_time to min_restart_time to
ensure that flush_step_generation() would fully flush out moves
generated from the force_move module. However, now that force_move
calls note_mcu_movequeue_activity() with is_step_gen=True, this is no
longer necessary.
Rework min_restart_time to last_step_gen_time.
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>
Commit f8da8099 incorrectly changed the order of variables in the
log/response message of the SET_VELOCITY_LIMIT command. Restore the
correct order.
Reported by @berkakinci.
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>
This doc still says the Pi 2 is an option for Klipper, in this day and age, i am not sure it is. From anecdotal evidence, the lowest pi recommended should be the zero2w. I also changed the wording and removed some Octoprint wording in that section to better reflect how things are today, as i don't think even with virtual_sdcard these older devices will keep up.
Signed-off-by: James Hartley <james@hartleyns.com>
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>
When we introduce the host-side status check,
it will be synchronous.
There would be no sense in having an asynchronous call.
Preliminary migrate callers to synchronous call.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>