Commit Graph

5924 Commits

Author SHA1 Message Date
Dmitry Butyugin
768b19e8be input_shaper: Limit maximum damping_ratio of the shapers
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>
2025-10-04 13:07:49 -04:00
Dmitry Butyugin
c570f4e095 docs: Added description of MZV input shaper
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-04 13:07:49 -04:00
Dmitry Butyugin
c98527ff00 docs: Updated the docs to the latest shaper changes and fixed typos
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-04 13:07:49 -04:00
Dmitry Butyugin
d825d43108 scripts: Updated graph_shaper.py script
The change removes the shapers defined there in favor of the
standard ones and makes the script a lot more configurable
via command-line arguments.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-04 13:07:49 -04:00
Kevin O'Connor
c803249467 docs: Minor wording change in Code_Overview.md thread description
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 14:09:24 -04:00
Kevin O'Connor
0c86b388a9 toolhead: Remove extra batching time added in _check_pause()
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>
2025-10-03 13:13:56 -04:00
Kevin O'Connor
4cd786fe08 toolhead: Avoid pausing an infinitesimal amount of time
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>
2025-10-03 13:13:56 -04:00
Kevin O'Connor
a43846c277 mcu: Reorganize wrapper methods in main mcu class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
95f263fa59 mcu: Directly register "mcu_identify" handler in each helper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
de73e41d0f mcu: Add new MCURestartHelper helper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
64c155121e mcu: Add new MCUConfigHelper helper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
1bb674d0b8 mcu: Add new MCUStatsHelper() helper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
1668d6d7c6 mcu: Separate low-level connection handling to new MCUConnectHelper class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
b086349a9f mcu: Setup debugging estimated_print_time() in constructor
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
1e18f32914 mcu: Move registration of "starting" message to _post_attach_setup_shutdown()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
fcd9cefb3f mcu: Add _check_restart_on_xxx() helper methods
Breakout each of the possible restart cases into its own internal
method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
ce55d41166 mcu: Split _mcu_identify() into separate methods
Split up the _mcu_identify() into several internal methods separated
by functionality.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
07466411ac mcu: Remove max_stepper_error config parameter
Use a regular code constant - MAX_STEPCOMPRESS_ERROR in stepper.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:28:38 -04:00
Kevin O'Connor
ea9c88526b klippy: Report Linux version in log
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-03 12:24:25 -04:00
Kevin O'Connor
35aeb78088 util: Strip all leading/trailing whitespace in get_device_info()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-30 21:40:21 -04:00
Kevin O'Connor
07c5973142 util: Introduce _try_read_file() helper
Introduce a helper function to read the contents of a file and use
that helper throughout util.py .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-30 21:40:21 -04:00
Timofey Titovets
ac6f059cb9 util: use dmi data on x86 instead of device-tree
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-09-30 18:59:09 -04:00
Timofey Titovets
fe09e2e6bf klippy: track the device model
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-09-30 18:59:09 -04:00
Kevin O'Connor
6118525c19 toolhead: Allow more entries to flush from "lazy" lookahead flush
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>
2025-09-30 09:37:35 -04:00
Kevin O'Connor
41901ec382 toolhead: Simplify LookAheadQueue.flush() code
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>
2025-09-30 09:37:35 -04:00
Kevin O'Connor
ff8c8eab55 toolhead: Clarify internal minimum_cruise_ratio variable names
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>
2025-09-30 09:37:35 -04:00
Sezgin AÇIKGÖZ
a683ef3503 spi_flash: add timestamp to firmware filenames on sdcard upload (#7063)
Some Creality bootloaders skip flashing if the firmware filename is
unchanged. By appending a timestamp to the firmware filename during
sdcard upload, each update generates a unique name, ensuring that
the bootloader always accepts and flashes the new firmware.

Signed-off-by: Sezgin AÇIKGÖZ <sezginacikgoz@mail.com>
2025-09-29 20:24:13 -04:00
Kevin O'Connor
184ba4080c toolhead: Flush lookahead on dwell - fix flushing bug after long delays
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>
2025-09-29 11:31:31 -04:00
bigtreetech
9e6430aa60 config: Modify software SPI to hardware SPI for BIGTREETECH boards
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
2025-09-28 22:00:58 -04:00
bigtreetech
366fb423c5 stm32: Add spi2_PB6_PB7_PB8 and spi3_PC11_PC12_PC10 for stm32g0
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
2025-09-28 22:00:58 -04:00
Kevin O'Connor
af17c8c238 stm32: No need to special case GPIOI in spi.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-26 12:28:19 -04:00
Kevin O'Connor
6e73181c47 stm32: No need to special case GPIOI in stm32h7_spi.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-26 12:28:19 -04:00
Kevin O'Connor
870c0437e9 stm32: Verify pin is valid in gpio_peripheral()
Convert direct lookup of digital_regs[] to a new gpio_pin_to_regs()
function that first validates the pin.  This should help prevent
invalid memory accesses if an invalid pin is provided.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-26 12:28:19 -04:00
Kevin O'Connor
30a1f22e1d motion_queuing: Improve run to run stability of flushing when in debug mode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-26 12:27:26 -04:00
Timofey Titovets
8c7693c048 uc1701: allow non blocking i2c writes
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 19:33:37 -04:00
Kevin O'Connor
3c01f71d9e itersolve: Don't call trapq_check_sentinels() from itersolve_generate_steps()
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>
2025-09-24 18:58:31 -04:00
Kevin O'Connor
1da2e39b85 docs: Update Code_Overview.md with recent motion generation changes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:47:13 -04:00
Kevin O'Connor
dfa666d9c1 stepcompress: Remove stepcompress_queue_msg()
Callers can use syncemitter_queue_msg() instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
56fb4d2b04 docs: Update Code_Overview.md to reflect recent steppersync changes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
546976b1fe steppersync: Print the thread name on a stepcompress error
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
414679ac99 steppersync: Move history clearing to background thread
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
3ef4702e06 steppersync: Move step generation thread from stepcompress.c to steppersync.c
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>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
e78d11bc6f steppersync: Support sending messages directly from syncemitter
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>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
d831d66c11 steppersync: Introduce new 'struct syncemitter'
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>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
a29cfc1701 stepcompress: Pass oid in stepcompress_fill() instead of stepcompress_alloc()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Kevin O'Connor
f21cca049f steppersync: Add new steppersyncmgr_gen_steps() function
Generate and flush all the steppersync instances from a single
steppersyncmgr_gen_steps() call.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Kevin O'Connor
bd747872c3 steppersync: Add new 'struct steppersyncmgr'
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>
2025-09-24 14:51:34 -04:00
Kevin O'Connor
a66f5cec52 msgblock: Add new clock_fill() function
Add a new function for filling the fields of 'struct clock_estimate'.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Kevin O'Connor
13cfdf5711 motion_queuing: Reorganize code into sections
Only code movement - no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Dmitry Butyugin
1c76ed1dc9 resonance_tester: Gracefully handle zero accelerations during the test
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-09-23 14:57:00 -04:00