During normal printing the host software would attempt to stay ahead
of the micro-controller by 2 full seconds. Change that time to 1
second. This should make the software more responsive to user
requests (such as pause requests).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The current code is likely to perform a lazy flush of the lookahead
queue around 4 times a second. Increase that to around 6-7 times a
second. This change may slightly improve the responsiveness to user
requests mid-print (eg, changing extrusion ratio) and may make a
"print stall" less likely in some corner cases.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Normally the toolhead code will flush the lookahead buffer every
~250ms and will briefly pause to avoid buffering too much data. That
pause allows other tasks to run. Make sure to periodically yield to
other tasks on each lookahead buffer flush even if a delay isn't
needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support extracting moves from both the "live" trapq->moves as well as
the "history" from trapq->history storage. Now that moves are flushed
separately from the lookahead queue, there is a good chance that the
current move being processed on the mcus will still be in the active
trapq list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
After a toolhead dwell, there is no reason to enter the priming state
and to create the priming exiration timer.
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>
Commit b60804bb changed the trapq head sentinel to store
print_time=-1. However, it failed to update trapq_add_move() that
relied on that value to detect the head sentinel. As a result,
numerical stability issues could lead to stepcompress errors.
Fix by changing trapq_add_move() to detect the head sentinel even with
a negative print_time.
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>
The code currently adds an additional 100ms to BUFFER_TIME_HIGH in
_check_pause() to reduce the number of calls to _check_pause().
However, LOOKAHEAD_FLUSH_TIME should already provide sufficient
batching so adding more is not necessary. This change should
hopefully make configuring BUFFER_TIME_HIGH a little more transparent.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Due to differences in mcu clock vs system clock it's possible to
repeatedly underestimate a system delay needed to bring about a
sufficient mcu time - which just wastes cpu cycles retrying a pause.
It's okay to sleep a slightly longer time to avoid the issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Previously the code would always keep at least 2 items on the
lookahead queue after a "lazy" flush. In most cases it's okay to
leave only a single item. Update the code to better handle flushing
of items that are fully ready.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Replace "delayed" storage with a full pass through the queue. This
simplifies the lookahead processing logic.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid using "smoothed" and "accel_to_decel" for variables associated
with minimum_cruise_ratio. Instead introduce the prefix "mcr" for use
with these variables.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 7ea5f5d2 changed how the lookahead queue is flushed.
Previously, the main flush timer would always run while the toolhead
was considered in an active state (print_time). After that commit,
the flush timer could sleep if there were no steps generated (no call
to note_mcu_movequeue_activity() ). This could lead to a situation
where a G4 command (or series of commands) could cause the toolhead to
be considered in an active state while the flush timer was disabled.
The result was that a future command may not be properly flushed (the
toolhead would fail to transition to a "Priming" state).
Fix by ensuring that all dwell() requests fully flush the lookahead
queue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit a89694ac changed the code to run itersolve_generate_steps()
from multiple threads simultaneously. However,
trapq_check_sentinels() can modify the shared trapq object. So,
calling it from multiple threads could introduce a race condition.
Move the call to trapq_check_sentinels() to steppersyncmgr_gen_steps()
to avoid the issue.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>