aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/bed_mesh.py
Commit message (Collapse)AuthorAgeFilesLines
* bed_mesh: reduce generated point loggingEric Callahan2025-02-261-4/+6
| | | | | | | | | | | | | With the introduction of "scanning" probes it has become common for configurations to generate a large number of points. This can overwhelm both the log and the pty when new points are generated. This patch limits the initial points logged to 50. In addition points are no longer logged or pushed over the pty when the mesh configuration changes. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: add support for MESH_PPS param in BMCEric Callahan2024-06-191-0/+6
| | | | | | In addition, do not respond with generated points. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: use generated XY positions in probe_finalize()Eric Callahan2024-06-191-26/+31
| | | | | | | | | | | | | The scan modes provide kinematic XYZ coordinates in the probe results. These positions may deviate from the requested positions, which can introduce errors in mesh generation when transposing the result into the Z matrix. Rely on the coordinates generated by bed mesh to transpose the matrix, presuming that points at the same index in the list match. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: add dump_mesh webhooks APIEric Callahan2024-06-191-0/+44
| | | | | | | Returns current mesh configuration and state. Includes probed and mesh matrices, saved profiles, current points, and travel paths. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: optimize rapid travel pathsEric Callahan2024-06-191-194/+495
| | | | | | | | | This adds supplemental path generation that implements "overshoot" when a change of direction is performed during a rapid scan. This overshoot reduces measurement error at the extremes of the mesh along the X axis. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: Fix adaptive probe count on delta printers (#6600)voidtrance2024-05-151-1/+4
| | | | | | | | | | | | | | Round beds require an odd number of probe points in order to prevent erroneously truncating the mesh. The adaptive mesh algorithm did not consider that and as a result, it was possible to generate adaptive meshes with even number of probe points. This change fixes this by increasing the probe point count by 1 in cases where the adaptive probe points are even. Signed-off-by: Mitko Haralanov <voidtrance@gmail.com>
* bed_mesh: Remove deprecated relative_reference_indexKevin O'Connor2024-02-151-36/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: add ZFADE parameter to BED_MESH_OFFSETEric Callahan2024-02-151-3/+10
| | | | | | | | 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>
* bed_mesh: fix profile_name reporting in get_status()Eric Callahan2024-01-281-10/+8
| | | | | | | | | | | | | | 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>
* bed_mesh: fix manual mode point generationEric Callahan2024-01-281-5/+8
| | | | | | | 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>
* bed_mesh: Implement adaptive bed mesh (#6461)voidtrance2024-01-261-2/+112
| | | | | | | | | | | | | | | | | | | | 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>
* 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>
* bed_mesh: do not load a profile on startupEric Callahan2023-02-011-5/+0
| | | | | | | Some users may not desire this behavior and others may wish to initialize to a profile not named default. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: Allow bedmeshing at 1mm spaced intervals (#5918)Keyan Mobli2022-12-191-1/+1
| | | Signed-off-by: Keyan Mobli <keyan@kmobli.com>
* bed_mesh: disallow null profile namesEric Callahan2022-11-111-0/+6
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: cache mesh statusEric Callahan2022-06-171-7/+13
| | | | | | | Prevent calls to `get_status()` from creating a new status dict on each request. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: Report actual mesh profiles as statusMisterke2022-02-161-3/+11
| | | | | | | Report the actual profiles available via BED_MESH_PROFILE via the status for use by clients. Signed-off-by: Kurt Haenen <kurt.haenen@gmail.com>
* bed_mesh: Fix integer division issue on Python3Kevin O'Connor2022-02-101-1/+1
| | | | | | Reported by @CODeRUS. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: Use config listsKevin O'Connor2021-08-211-32/+51
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: Added PROFILE name option (#4522)Randell Hodges2021-08-171-1/+3
| | | | | | | Added optional PROFILE parameter to allow bed_mesh_calibrate to save the mesh directly into the provided profile name instead of default. If omitted, it will be stored in default. Signed-off-by: Randell L Hodges <rhodges@taxfodder.com>
* bed_mesh: Fix off-by-one error in faulty region error reportKevin O'Connor2021-08-171-2/+4
| | | | | | Reported by @craiglink. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: implement BED_MESH_OFFSETEric Callahan2021-06-081-3/+24
| | | | | | The BED_MESH_OFFSET gcode can be used to apply X and/or Y offsets the the mesh lookup. This allows printers with independent extruders to correct the Z adjustment when changing a tool. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: move the "fade offset" out of the ZMeshEric Callahan2021-06-081-15/+9
| | | | | | This is a temporary offset applied to the mesh used to fade toward a "target". For clarity, apply the fade offset when the final z calculation is made. SIgned-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: introduce "faulty_regions" optionArksine2021-04-101-5/+167
| | | | | | Users may define "faulty regions", locations within the mesh where a probed value is unreliable. When bed mesh generates points it will substitute points in faulty regions with up to 4 points nearest to the region. After calibration is complete the Z values at these points will be averaged and assigned to the original value inside the faulty region. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: Allow user to clear the relative_reference_index via gcodeArksine2021-04-101-0/+2
| | | | | | If a negative number is specified for the RELATIVE_REFERENCE_INDEX parameter clear the internal relative_reference_index. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: Perform initialization from klippy:connect instead of klippy:readyKevin O'Connor2021-04-021-3/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: lookup the toolhead object in "handle_connect"Arksine2021-04-011-1/+4
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* webhooks: Fix use of deprecated Exception.message attribute (#3781)Maël Kerbiriou2021-01-171-2/+2
| | | | | | | | Since Python 2.6, the BaseException.message attribute is deprecated (PEP-352[1]) in favor of e.args[0] or str(e). This commit replaces e.message with str(e). [1] https://www.python.org/dev/peps/pep-0352/ Signed-off-by: Maël Kerbiriou <m431.kerbiriou@gmail.com>
* bed_mesh: add mesh parameters to BED_MESH_CALIBRATEArksine2020-09-151-12/+84
| | | | | | This allows the generated points to be modified prior to probing the bed. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: move algorithm verification to its own methodArksine2020-09-151-6/+11
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: move mesh area configuration to _init_mesh_configArksine2020-09-151-29/+36
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode_move: Move GCodeMove class from gcode.py to new extras moduleKevin O'Connor2020-08-201-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Split G0/G1 command handling to new gcode_move classKevin O'Connor2020-08-201-2/+5
| | | | | | | | Split up the main GCodeParser class into GCodeDispatch and GCodeMove classes. The GCodeMove class is now available using the "gcode_move" printer object name. This split simplifies the gcode.py code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: Move profile management to its own classArksine2020-07-251-136/+149
| | | | | | This streamlines the BedMeshCalibrate class, making it only resposible for configuring and executing the calibration procedure. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: track the probed_matrix and mesh_params exclusively in the ZMesh ↵Arksine2020-07-251-42/+51
| | | | | | | | class Rather than have multiple classes keep a reference to these items, keep them in the z_mesh. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: differentiate between "mesh_config" and "mesh_params"Arksine2020-07-251-15/+15
| | | | | | This fixes an issue where a new profile is not properly saved after a restart. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: round x and y positions received via the finalize callbackArksine2020-07-251-0/+2
| | | | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com> Update bed_mesh.py
* bed_mesh: add get_status() methodArksine2020-07-251-3/+33
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* extras: Use "from . import module" for relative importsKevin O'Connor2020-06-151-5/+2
| | | | | | Use alternate import syntax to improve Python3 compatibility. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: Improve Python3 compatibilityKevin O'Connor2020-06-151-6/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: Fix typo (#2849)Nathan Plamondon2020-05-111-1/+1
| | | Signed-off-by: Nate Plamondon <nplamondon@gmail.com>
* bed_mesh: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-18/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rename respond() to respond_raw()Kevin O'Connor2020-04-241-3/+3
| | | | | | | | | | | Rename the method to make it more clear that it is a low-level call that should be rarely used. Also, change gcode_button.py, hall_filament_width_sensor.py, and tsl1401cl_filament_width_sensor.py to use respond_info() instead of respond_raw(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bed_mesh: Fix typo (#2692)Piotr Usewicz2020-04-141-1/+1
| | | Signed-off-by: Piotr Usewicz <piotr@layer22.com>
* bed_mesh: detect incompatible mesh profilesArksine2020-01-091-5/+28
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: refactor print_generated_points()Arksine2020-01-091-9/+6
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: fix LOAD_PROFILEArksine2020-01-091-4/+10
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* bed_mesh: Allow the default profile to be removedArksine2020-01-091-1/+1
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>