Commit graph

5909 commits

Author SHA1 Message Date
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
Some checks failed
Build test / build (push) Has been cancelled
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 checks are pending
Build test / build (push) Waiting to run
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
Some checks are pending
Build test / build (push) Waiting to run
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
Some checks are pending
Build test / build (push) Waiting to run
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
Some checks failed
Build test / build (push) Has been cancelled
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
Some checks failed
Build test / build (push) Has been cancelled
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
Some checks failed
Build test / build (push) Waiting to run
klipper3d deploy / deploy (push) Has been cancelled
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
Some checks are pending
Build test / build (push) Waiting to run
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-09-23 14:57:00 -04:00
Dmitry Butyugin
599dcd176c resonance_tester: Correctly handle incorrect accelerometer chip names
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-09-23 14:57:00 -04:00
Dmitry Butyugin
5da026a337 input_shaper: Updated definitions of *EI input shapers
Some checks failed
Build test / build (push) Waiting to run
klipper3d deploy / deploy (push) Has been cancelled
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-09-22 15:18:01 -04:00
bigtreetech
1be6c0fce0 stm32: change GPIO_FUNCTION_ALL to SPI_FUNCTION
Some checks failed
Build test / build (push) Has been cancelled
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
2025-09-19 12:19:15 -04:00
bigtreetech
61252819e3 stm32: Clean up SPI code on spi.c
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
2025-09-19 12:19:15 -04:00
bigtreetech
e8e88415ea stm32: Clean up SPI code on stm32h7_spi.c
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
2025-09-19 12:19:15 -04:00
Kevin O'Connor
8db5d254e0 docs: Update Code_Overview.md with recent motion_queuing changes
Some checks failed
Build test / build (push) Has been cancelled
klipper3d deploy / deploy (push) Has been cancelled
Update the documentation to reflect the new threads and new movement
code flow.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-16 12:17:47 -04:00
Kevin O'Connor
c7365c8c58 extruder: Recheck the step generation scan windows on sync_to_extruder()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-16 11:28:16 -04:00
Kevin O'Connor
636380e4f3 toolhead: Avoid numerical stability in _handle_step_flush() comparison
Some checks are pending
Build test / build (push) Waiting to run
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>
2025-09-15 19:20:00 -04:00
Kevin O'Connor
df29a38011 motion_queuing: Further tune flushing in batches
Avoid unnecessary reactor wakeups if a batch is close to being ready.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-15 14:30:27 -04:00
Kevin O'Connor
4c46b80f38 motion_queuing: Further improve step flushing in batches
Further encourage flushing steps in batches by delaying flushing if a
batch isn't needed yet.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-15 14:19:02 -04:00
Kevin O'Connor
f341031834 motion_queuing: Try harder to use next_batch_time when flushing
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>
2025-09-15 13:46:35 -04:00
Kevin O'Connor
950aa103e4 motion_queuing: It is no longer necessary to loop in _advance_flush_time()
Some checks failed
Build test / build (push) Has been cancelled
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>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
42d149b40f motion_queuing: Avoid flushing far into the future
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>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
7ea5f5d25e motion_queuing: Generate steps from timer instead of from lookahead
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>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
b60804bb66 trapq: Set the head sentinel to a negative print_time
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>
2025-09-12 22:41:30 -04:00