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>
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>
Commit 0f94f6c8 decreased the MAX_HEAT_TIME from 5 seconds to 3
seconds. However, that also decreased the amount of tolerance for
lost temperature updates from 1.25 seconds to 0.75 seconds. With the
default temperature update every 300ms, only 2 consecutive missing
temperature updates could lead to a fault.
Tweak the internal "next_pwm_time" setting so that it is more tolerant
of two consecutive lost temperature updates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 9399e738 changed the manual_stepper class to no longer
explicitly flush all steps after each move. As a result, calls to
self.rail.get_commanded_position() may no longer reflect the last
requested position. This discrepancy could result in "internal
stepcompress" errors.
Change the manual_stepper code to internally track the last requested
position and use that when scheduling moves. This allows the
manual_stepper code to utilize the standard "lazy" step flushing
mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support storing a reference to 'struct stepper_kinematics' in 'struct
stepcompress' and support globally generating steps via the
steppersync mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the existing register_flush_callback() system to implement motor
activity checking. This simplifies the generate_steps() code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move code from flush_steppersync() to existing flush_motion_queues()
and clean_motion_queues() functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't implement history expiration from the main steppersync_flush()
code. Instead, have callers directly invoke
steppersync_history_expire().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allocate the low-level C stepcompress object in the motion_queuing
module. This simplifies the mcu.py code as it no longer needs to
track the stepqueues for the steppersync object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add an allocate_trapq() helper function to facilitate the creation of
a low-level C trapq object. Track all trapq objects and clear history
on them globally when the main motion queues are flushed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a new module to assist with host management of motion queues.
Register all MCU_stepper objects with this module and use the module
for step generation.
All steppers will now automatically generate steps whenever
toolhead._advance_flush_time() is invoked. It is no longer necessary
for callers to individually call stepper.generate_steps().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change note_mcu_movequeue_activity() to default to setting the
step_gen_time (instead of the previous default to not set it).
Most users of the mcu "move queue" will be for stepper activity.
There is also little harm in incrementing the tracking of the last
possible step generation time, but accidentally generating a step
without incrementing the tracking can lead to very hard to debug
failures.
The two cases (output_pin.py and pwm_tool.py) where
note_mcu_movequeue_activity() is called and definitely not related to
step generation can explicitly pass 'is_step_gen=False'.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the g-code command handlers to a new class. This reduces the
size of the main Toolhead() class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>