aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
Commit message (Collapse)AuthorAgeFilesLines
* toolhead: Extend flushing slightly past required timeKevin O'Connor2024-01-171-3/+1
| | | | | | | | | 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>
* toolhead: Ensure full kin_flush_delay after flush_step_generation()Kevin O'Connor2024-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* mpu9250: Fix incorrect use of time.sleep()Kevin O'Connor2024-01-071-3/+7
| | | | | | | | | | | 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>
* buttons: Fix possible ordering issue if a callback blocksKevin O'Connor2023-12-301-12/+12
| | | | | | | | | | 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>
* toolhead: Keep stepcompress move history relative to current time (#6439)Francois Chagnon2023-12-302-2/+4
| | | | | Expire history relative to current time rather than last move in history queue Signed-off-by: Francois Chagnon <fc@francoischagnon.net>
* bulk_sensor: Fix missing logging importKevin O'Connor2023-12-281-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Add some module level documentationKevin O'Connor2023-12-261-0/+31
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Simplify the registration of internal clients in BatchBulkHelperKevin O'Connor2023-12-265-69/+69
| | | | | | | | | | | | | | | 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>
* bulk_sensor: Rework APIDumpHelper() to BatchBulkHelper()Kevin O'Connor2023-12-266-124/+112
| | | | | | | 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>
* bulk_sensor: Minor code reorg to _stop() in APIDumpHelper()Kevin O'Connor2023-12-261-19/+19
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: New add_mux_endpoint() helper function in APIDumpHelperKevin O'Connor2023-12-266-53/+38
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Move APIDumpHelper() from motion_report.py to bulk_sensor.pyKevin O'Connor2023-12-266-103/+104
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* angle: Define BYTES_PER_SAMPLE and SAMPLES_PER_BLOCKKevin O'Connor2023-12-261-5/+10
| | | | | | This makes the code a little more readable. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Add a read_axes_map() helper functionKevin O'Connor2023-12-263-18/+12
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: No need to implement is_measuring()Kevin O'Connor2023-12-264-34/+0
| | | | | | | 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>
* bulk_sensor: Add new ChipClockUpdater helper classKevin O'Connor2023-12-264-106/+80
| | | | | | | 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>
* bulk_sensor: Add new BulkDataQueue classKevin O'Connor2023-12-265-65/+41
| | | | | | | Move the bulk sample queue collection to a new helper class in bulk_sensor.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: New file with helper code for reading bulk sensorsKevin O'Connor2023-12-264-65/+73
| | | | | | | Move the ClockSyncRegression class from adxl345.py to a new bulk_sensors.py file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pwm_tool: Fix error reportingKevin O'Connor2023-12-191-5/+6
| | | | | | | References to pins.error are not valid as the pins module is not imported. Reported by @Piezoid. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* hall_filament_width_sensor: max filament diameterSami Haahtinen2023-12-171-2/+3
| | | | | | | | | Add support for maximum filament diameter to hall filament width sensor. If the diameter of the filament diameter is larger than the limit, the virtual runout sensor will trigger. The default value is set to maximum flow adjustment threshold to prevent oversized filament from clogging. Signed-off-by: Sami Haahtinen <ressu@ressukka.net>
* pwm_tool: Add support for maximum_mcu_durationKevin O'Connor2023-12-161-27/+52
| | | | | | | Implement the maximum_mcu_duration config parameter along with its associated queue flushing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Simplify sequence and limit_count upconversionKevin O'Connor2023-12-103-33/+21
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* angle: Simplify sequence upconversionKevin O'Connor2023-12-101-11/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: Simplify ack upconversion codeKevin O'Connor2023-12-101-4/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pwm_tool: Notify the toolhead that the move_queue needs to be flushedKevin O'Connor2023-12-071-0/+2
| | | | | | | | | | Call toolhead.note_kinematic_activity() on each pin update to ensure that those updates will be flushed properly. This fixes "Timer too close" errors on SET_PIN commands that are issued when the toolhead is idle. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Query latest value during _init_registers()Kevin O'Connor2023-11-281-1/+2
| | | | | | | | | | | | The set_register() code may block, and it therefore may be possible that the loop in _init_registers() could occur in parallel with other updates. That could result in a "OrderedDict mutated during iteration" error. Avoid the error by querying the latest value during each iteration of the loop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* exclude_object: Don't use gcmd.respond_error() (#6407)Andrei Ignat2023-11-221-1/+1
| | | | | gcmd.respond_error() has been deprecated: 61524542d20e50c4866836d6ed23ca03521ffb15 Signed-off-by: Andrei Ignat <andrei@ignat.se>
* tmc5160: Increase maximum current error checkKevin O'Connor2023-11-201-1/+1
| | | | | | | | | | | | It's possible to build and configure tmc5160 drivers with external mosfets that support more than 3 amps. The actual maximum for tmc5160 drivers is dependent on how the board is wired and the mosfets used. Increase the error check to 10 amps. This error checking is primarily intended to catch "obvious misconfigurations" (eg, specifying milli-amps instead of amps), and the new value of 10 amps should suffice for this task. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bmp280: Add support for BMP180 sensor (#6370)vaxxi2023-11-161-6/+121
| | | | | Extends the BMxx80 category with support for the older BMP180 sensor, providing temperature and humidity output. Signed-off-by: VAXXi Popescu <github@vaxxi.net>
* pwm_tool: Add support for high-speed PWM pin updatesKevin O'Connor2023-11-161-0/+157
| | | | | | | | | The output_pin module is only capable of updating an output pin at most once every 100ms. Add a new pwm_tool module that is capable of queuing updates in the micro-controller and thus allowing for much higher update rates. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Replace deprecated logger.warn with logger.warning (#6385)Thijs Triemstra2023-11-164-10/+13
| | | | | | | Replace deprecated logger.warn with logger.warning logger.warn will be removed in Python 3.13 Signed-off-by: Thijs Triemstra <info@collab.nl>
* bed_screws: Reset on move errorPedro Lamas2023-11-021-1/+6
| | | | Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
* Revert "toolhead: Use dict for step generation flush times. (#6303)"Kevin O'Connor2023-10-211-1/+4
| | | | | | | | | | This reverts commit 6749985302fe002a9cb5672dab9badb11e4e3c36. A defect was found in the above commit (the input shaper code calls note_step_generateion_scan_time() for many steppers, so the input_shaper class can't be used as the index). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Use dict for step generation flush times. (#6303)Viesturs Zariņš2023-10-191-4/+1
| | | | | Makes the API to extruder and input shaper more robust, avoiding the need to track the old delay. Signed-off-by: Viesturs Zariņš <viesturz@gmail.com>
* spi_temperature: Limit maximum temperature in MAX31865.calc_adc() to melting ↵DavidvtWout2023-09-101-1/+2
| | | | | | | | | | | | | | | | point of platinum (#6320) Limit the maximum temperature in MAX31865.calc_adc() to the melting point of platinum. Above this temperature the Callendar-Van Dusem formula does not make sense. The default value for max_temp is 99999999.9 and at this temperature the result of this formula is negative. This sets max_sample_value to 0 which causes the mcu to shutdown. Set max adc value to (1<<15)-1 . This is needed because the max value of the adc register of the MAX31865 is 0b1111 1111 1111 1110 which represents 32767 and not 32768. Signed-off-by: David van 't Wout <github@yoctobyte.nl>
* tmc2240: Adding UART interface support to tmc2240 (#6305)FrY Sennberg2023-09-101-3/+9
| | | Signed-off-by: Christoph Frei <fryakatkop@gmail.com>
* lis2dw12: Add support for lis2dw12 accelerometerbigtreetech2023-08-211-0/+265
| | | | | | | | lis2dw12 is an accelerometer from STMicroelectronics(https://www.st.com/resource/en/datasheet/lis2dw12.pdf) With better performance than the ADXL345 according to the datasheet. Signed-off-by: XM.Zhou from BigTreeTech zhouxm@biqu3d.com Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
* heaters: adds temperature monitorsPedro Lamas2023-08-012-1/+8
| | | | Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
* temperature_combined: A class that can combine several other temperature ↵Michael Jäger2023-08-012-0/+131
| | | | | sensors (#6230) Signed-off-by: Michael Jäger <michael@mjaeger.eu>
* axis_twist_compensation: Add X twist compensation module (#6149)Philippe Daouadi2023-08-012-0/+267
| | | | | | | | | | | | Implements AxisTwistCompensation, and Calibrater Supports calibration of z-offsets caused by x gantry twist Modify PrinterProbe._probe function to check if the probed z value should be adjusted based on axis_twist_compensation's configuration Add documentation for [axis_twist_compensation] module Signed-off-by: Jeremy Tan <jeremytkw98@gmail.com>
* screws_tilt_adjust: add max_deviation to report statusStefan Dej2023-08-011-0/+1
| | | | Signed-off-by: Stefan Dej <meteyou@gmail.com>
* screws_tilt_adjust: Added Support for M6 Screws (#6287)Zarrsito2023-07-161-3/+5
| | | | | Added support for M6 Screws Signed-off-by: Sascha Petersen <Zarrsito@gmail.com>
* virtual_sdcard: reset file position and size to integer zeroEric Callahan2023-06-231-2/+2
| | | | | | | This resolves an issue with API server clients that always expect these values be be integers. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: fix fade regressionEric Callahan2023-06-211-9/+12
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: improve zero reference offsetEric Callahan2023-06-201-28/+97
| | | | | | | | | | | | | The relative_reference_index will now refer to a coordinate that is static and cannot be changed at runtime. If new mesh parameters are specifed and the reference lies outside of the mesh then the reference location will be probed. Additionally this introduces a 'zero_reference_position' option which accepts a specific X/Y coordinate. This may be used in place of the relative_reference_index. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: generate new points before each calibrationEric Callahan2023-06-201-2/+2
| | | | | | | | | When mesh parameters change the substituted indices need to be updated, even when using the default point set. Always generate new points to perform this update rather than cache the "orig_points". Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* tmc: Configurable `multistep_filt`Alex Voinea2023-06-164-5/+9
| | | | Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
* i2c_software: Implementation of software i2c (#6141)BIGTREETECH2023-06-071-7/+29
| | | Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
* input_shaper: Fixed tracking of step_generation_scan_timeDmitry Butyugin2023-06-061-9/+6
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* idex_modes: Native input shaping support with dual carriagesDmitry Butyugin2023-06-061-26/+36
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>