Commit Graph

2568 Commits

Author SHA1 Message Date
Dmitry Butyugin 72b301a285 scripts: Added shaper tuning parameters to calibrate_shaper script
The added parameters include square_corner_velocity, shaper frequencies
to optimize, input shapers to test, input shaper damping ratio and
damping ratios to test. All these options can be useful for fine-tuning
the input shapers when the default suggestions generated by the tuning
script are not optimal.

Also the `SHAPER_CALIBRATE` command was modified to pass some of these
parameters to the shaper tuning routine. Specifically, square corner
velocity and the maximum tested frequency are used to adjust shaper
tuning and maximum acceleration recommendations.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2024-02-16 19:20:56 -05:00
Kevin O'Connor c92732e4f1 bed_mesh: Remove deprecated relative_reference_index
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-02-15 12:39:01 -05:00
Kevin O'Connor 2f7b234189 extruder: Remove deprecated commands and config
Remove the deprecated SET_EXTRUDER_STEP_DISTANCE and
SYNC_STEPPER_TO_EXTRUDER commands.  Remove the deprecated
shared_heater config option.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-02-15 12:35:19 -05:00
Kevin O'Connor b2ac0f1ce3 heaters: Remove deprecated thermistor "NTC 100K beta 3950"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-02-15 12:35:19 -05:00
Eric Callahan 0cd16e956d bed_mesh: add ZFADE parameter to BED_MESH_OFFSET
When a ZFADE value is passed to BED_MESH_OFFSET it is used
to adjust how fade is applied.   This resolves issues with
fade when SET_GCODE_OFFSET is used during a tool change.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-15 12:03:41 -05:00
Eric Callahan 9f41f53c5e bed_mesh: fix profile_name reporting in get_status()
Adaptive meshing avoids saving the mesh after calibration to prevent
users from inadvertently overwriting an existing profile with an
adaptive mesh.  This introduced a change in behavior of how
get_status() reports the profile_name, as it can now be an empty
string when a mesh is active.

This patch assigns adaptive meshes a name with a unique postfix.
In addition, it moves profile name tracking from the profile manager
to the ZMesh class.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-28 13:43:08 -05:00
Eric Callahan 16a7b50ce9 bed_mesh: fix manual mode point generation
Do not generate points for the zero_reference_position or faulty_regions
when manual probing is requested.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2024-01-28 13:43:08 -05:00
Kiswich 600e89ae8c
virtual_sdcard: fix virtual SD file position count (#6472)
Signed-off-by: Zhang Qiwei <zxy16305@gmail.com>
2024-01-27 09:23:50 -05:00
voidtrance 5e3daa6f21
bed_mesh: Implement adaptive bed mesh (#6461)
Adaptive bed mesh allows the bed mesh algorithm
to probe only the area of the bed that is being
used by the current print.

It uses [exclude_objects] to get a list of the
printed objects and their area on the bed. It,
then, modifies the bed mesh parameters so only
the area used by the objects is measured.

Adaptive bed mesh works on both cartesian and
delta kinematics printers. On Delta printers,
the algorithm, adjusts the origin point and
radius in order to translate the area of the
bed being probe.

Signed-off-by: Mitko Haralanov <voidtrance@gmail.com>
Signed-off-by: Kyle Hansen <kyleisah@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-26 17:50:01 -05:00
Kevin O'Connor 43a9685c58 mcu: Remove support for set_pwm() cycle_time parameter
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-23 20:04:03 -05:00
Kevin O'Connor fd2feff67d pwm_cycle_time: New module for output pins with dynamic cycle times
Remove support for changing the cycle time of pwm pins from the
output_pin module.  Use a new pwm_cycle_time module that supports
setting dynamic cycle times.  This simplifies the output_pin code and
low-level pin update code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-23 20:04:03 -05:00
Kevin O'Connor 1baa45913f output_pin: Deprecate the maximum_mcu_duration parameter
Advise users to configure a pwm_tool config section if checking for
maximum mcu duration is required.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-23 20:04:03 -05:00
Kevin O'Connor 7abafb575b mcu: Remove support for "static" pins
Update static_digital_output.py to directly configure static digital
pins.  There are no other users of "static" pins, so remove that
support from mcu.py, replicape.py, and sx1509.py.  This simplifies the
low-level pin handling code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-23 20:04:03 -05:00
Kevin O'Connor 4115ea128a output_pin: Deprecate static_value parameter
Remove support for configuring "static" pins in output_pin module.  A
"static" pin only saves a few bytes of memory in the micro-controller.
The savings does not justify the increased code complexity.

Deprecate the static_value parameter to warn users.  In the interim, a
static_value parameter will set both value and shutdown_value
parameters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-23 20:04:03 -05:00
Kevin O'Connor d785b396a7 sensor_lis2dw: No need to schedule start of bulk reading
It's simpler and faster to enable the lis2dw in the python code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor d853c19811 sensor_mpu9250: No need to schedule start of bulk reading
It's simpler and faster to enable the mpu9250 in the python code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 6f0e91f69f sensor_adxl345: No need to schedule start of bulk reading
It's simpler and faster to enable the adxl345 in the python code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 2dc4cfc5df bulk_sensor: Don't assume chip_clock is zero on start of queries
Send an explicit clock query in ChipClockUpdater to seed the initial
clock.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 266e96621c sensor_bulk: New C file with helper code for sending bulk sensor measurements
Refactor the low-level "bulk sensor" management code in the mcu.  This
updates the sensor_adxl345.c, sensor_mpu9250.c, sensor_lis2dw.c, and
sensor_angle.c code to use the same "bulk sensor" messages.  All of
these sensors will now send "sensor_bulk_data" and
"sensor_bulk_status" messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor dc6182f3b3 sensor_angle: No need to send messages when stopping queries
Simplify the mcu code as any messages are ignored by the host anyway.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 95e1a290f1 sensor_lis2dw: No need to send messages when stopping queries
Simplify the mcu code as any messages are ignored by the host anyway.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 5ff555a705 sensor_mpu9250: No need to send messages when stopping queries
Simplify the mcu code as any messages are ignored by the host anyway.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 3275614b89 sensor_adxl345: No need to send messages when stopping queries
Simplify the mcu code as any messages are ignored by the host anyway.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 83d0d2f19b mcu: Add send_wait_ack() support to CommandWrapper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-19 11:55:15 -05:00
Kevin O'Connor 1d92be71da toolhead: Rename note_kinematic_activity() to note_mcu_movequeue_activity()
Rename this function to make it more clear why it is called.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-18 12:25:08 -05:00
Kevin O'Connor 6cc409f6fb toolhead: Rename MoveQueue class to LookAheadQueue
Rename this class so that is is not confused with the mcu "move
queue".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-18 12:16:47 -05:00
Kevin O'Connor d633ef2cfc force_move: Fix missing call to note_kinematic_activity()
Commit 3d3b87f9 incorrectly removed the call to
note_kinematic_activity().  A call to toolhead.dwell() is not
sufficient to wake up the mcu move queue flushing.  The call to
note_kinematic_activity() is needed for that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-18 11:24:07 -05:00
Kevin O'Connor 7a74888b43 toolhead: Extend flushing slightly past required time
There is no harm in enabling flushing for a little longer than
necessary.  In contrast, a slight rounding issue causing a message to
not get flushed properly could result in an error.  So, extend the
flushing time slightly to avoid potential issues.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-17 11:28:42 -05:00
Kevin O'Connor 3d3b87f97f toolhead: Ensure full kin_flush_delay after flush_step_generation()
Commit b7b13588 made it possible that the kinematic code could be
restarted after a flush_step_generation() call without a sufficient
delay.

Rename last_sg_flush_time to min_restart_time and use that to ensure
_calc_print_time() always pauses kin_flush_delay time since the last
flush_step_generation() call.

Also, update force_move to invoke flush_step_generation() after any
movements.  This is needed to ensure there is a sufficient delay
should force_move be called on a stepper motor that is part of the
toolhead kinematics and is using a step generation "scan time".

This fixes possible "internal error in stepcompress" reports when
using FORCE_MOVE.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-16 20:40:55 -05:00
Kevin O'Connor 1ea9f3aa35 mcu: Increase trsync_state reporting during multi-mcu homing
The current code has the mcu report a trsync_state message every 10ms
and expects a time extension within 25ms.  However, this means that if
a single mcu->host report is lost then 20ms would elapse until the
next report, which would allow for only a 5ms round-trip time before a
timeout error is reported.

Increase the trsync_state timing so that a message is sent every
7.5ms.  This increases the total number of messages per second sent
from mcu to host to 133 (from 100).  With this change, a single lost
message would still allow for up to a 10ms round-trip time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-16 14:19:11 -05:00
Kevin O'Connor dab39c02cd mcu: Stagger trsync reporting time during multi-mcu homing
When multiple MCUs are involved in homing, stagger the scheduling of
the trsync_state report messages from each mcu.  Staggering helps
spread the bandwidth, helps reduce locking contention in the host, and
reduces the chance that intermittent latency could result in a
communication timeout.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-16 14:19:11 -05:00
Kevin O'Connor 1a1568c38b mpu9250: Fix incorrect use of time.sleep()
It is not valid to call time.sleep() in the host python code (it could
causes glitches in other processing, and it does not ensure there is a
pause between operations on the mcu).

Use minclock instead of time.sleep() to ensure there is a sufficient
pause during chip startup.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-07 11:59:55 -05:00
Kevin O'Connor 92fe8f15b8 buttons: Fix possible ordering issue if a callback blocks
Invoke button callbacks directly from the background thread.  This
ensures that button notifications are delivered and delivered in the
correct order.  Previously, if a callback blocked, it was possible a
new update could start before the previous update was completed, which
could lead to lost events or out of order events.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-30 12:55:59 -05:00
Kevin O'Connor 25bc649cd2 toolhead: Make sure to flush history when in debug output mode
When in debugging "batch mode", use the existing method of keeping the
last 30 seconds of history from the furthest planned move time.  This
avoids keeping all moves in memory during a batch test.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-30 12:35:42 -05:00
Kevin O'Connor 9847b44901 toolhead: Avoid calling reactor.monotonic() on each _advance_flush_time()
Move calculation of clear_history_time to the callers of
_advance_flush_time() as a minor processing optimization.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-30 11:43:32 -05:00
Francois Chagnon d7f6348ae6
toolhead: Keep stepcompress move history relative to current time (#6439)
Expire history relative to current time rather than last move in history queue

Signed-off-by: Francois Chagnon <fc@francoischagnon.net>
2023-12-30 11:34:21 -05:00
Kevin O'Connor b502558052 bulk_sensor: Fix missing logging import
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-28 13:13:57 -05:00
Kevin O'Connor 6f686ddee3 bulk_sensor: Add some module level documentation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor c716edafe2 bulk_sensor: Simplify the registration of internal clients in BatchBulkHelper
Previously, the BatchBulkHelper class was designed primarily to
register webhook clients, and internal clients used a wrapper class
that emulated a webhooks client.

Change BatchBulkHelper to support regular internal callbacks, and
introduce a new BatchWebhooksClient class that can translate these
internal callback to webhooks client messages.

This makes it easier to register internal clients that can process the
bulk messages every batch interval.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor 3370134593 bulk_sensor: Rework APIDumpHelper() to BatchBulkHelper()
The APIDumpHelper class is mainly intended to help process messages in
batches.  Rework the class methods to make that more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor 95c753292d bulk_sensor: Minor code reorg to _stop() in APIDumpHelper()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor acde3720a4 bulk_sensor: New add_mux_endpoint() helper function in APIDumpHelper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor ffd44c0219 bulk_sensor: Move APIDumpHelper() from motion_report.py to bulk_sensor.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor f4c8f0bf88 angle: Define BYTES_PER_SAMPLE and SAMPLES_PER_BLOCK
This makes the code a little more readable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor 3f84501955 adxl345: Add a read_axes_map() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor 43ce7c0b9a adxl345: No need to implement is_measuring()
The APIDumpHelper class already ensures that the start/stop callbacks
will only be called when needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor d6a4669ce0 bulk_sensor: Add new ChipClockUpdater helper class
All the accelerometers use a standard response for their query_status
messages.  Create a common helper class to process those responses.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor e67cbbe5c1 bulk_sensor: Add new BulkDataQueue class
Move the bulk sample queue collection to a new helper class in
bulk_sensor.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor 978c294741 bulk_sensor: New file with helper code for reading bulk sensors
Move the ClockSyncRegression class from adxl345.py to a new
bulk_sensors.py file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:47:21 -05:00
Kevin O'Connor 644f7e0872 toolhead: Simplify _advance_flush_time() sg_flush_time calculation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-26 11:35:27 -05:00