Commit Graph

60 Commits

Author SHA1 Message Date
Randell Hodges f313a2294a
bed_mesh: Added PROFILE name option (#4522)
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>
2021-08-17 15:30:14 -04:00
Kevin O'Connor 1aa4becc60 bed_mesh: Fix off-by-one error in faulty region error report
Reported by @craiglink.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-08-17 12:05:59 -04:00
Eric Callahan 3fcce4bb4b bed_mesh: implement BED_MESH_OFFSET
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>
2021-06-08 00:02:35 -04:00
Eric Callahan 4dfe01a2cd bed_mesh: move the "fade offset" out of the ZMesh
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>
2021-06-08 00:02:35 -04:00
Arksine 60372fd0cf bed_mesh: introduce "faulty_regions" option
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>
2021-04-10 11:16:07 -04:00
Arksine 5f5dfbaa7f bed_mesh: Allow user to clear the relative_reference_index via gcode
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>
2021-04-10 11:16:07 -04:00
Kevin O'Connor b5b2fe2d2b bed_mesh: Perform initialization from klippy:connect instead of klippy:ready
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-02 13:50:38 -04:00
Arksine 74d527776e bed_mesh: lookup the toolhead object in "handle_connect"
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-04-01 09:32:23 -04:00
Maël Kerbiriou 9278f56e36
webhooks: Fix use of deprecated Exception.message attribute (#3781)
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>
2021-01-17 22:37:41 -05:00
Arksine 7ba1a2a749 bed_mesh: add mesh parameters to BED_MESH_CALIBRATE
This allows the generated points to be modified prior to probing the bed.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-15 20:36:55 -04:00
Arksine 6e77fd27cd bed_mesh: move algorithm verification to its own method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-15 20:36:55 -04:00
Arksine 98931789d8 bed_mesh: move mesh area configuration to _init_mesh_config
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-09-15 20:36:55 -04:00
Kevin O'Connor 1286d3006c gcode_move: Move GCodeMove class from gcode.py to new extras module
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 4c5e93d51d gcode: Split G0/G1 command handling to new gcode_move class
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>
2020-08-20 21:03:22 -04:00
Arksine 4795c0896d bed_mesh: Move profile management to its own class
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>
2020-07-25 12:05:29 -04:00
Arksine dbec03abd9 bed_mesh: track the probed_matrix and mesh_params exclusively in the ZMesh 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>
2020-07-25 12:05:29 -04:00
Arksine 41eedda5d6 bed_mesh: differentiate between "mesh_config" and "mesh_params"
This fixes an issue where a new profile is not properly saved after a restart.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-25 12:05:29 -04:00
Arksine 7c8b60b40e bed_mesh: round x and y positions received via the finalize callback
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>

Update bed_mesh.py
2020-07-25 12:05:29 -04:00
Arksine 6458def588 bed_mesh: add get_status() method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-07-25 12:05:29 -04:00
Kevin O'Connor f931da1b87 extras: Use "from . import module" for relative imports
Use alternate import syntax to improve Python3 compatibility.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Kevin O'Connor 8c96e9dd11 bed_mesh: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-06-15 17:15:53 -04:00
Nathan Plamondon c402b275c3
bed_mesh: Fix typo (#2849)
Signed-off-by: Nate Plamondon <nplamondon@gmail.com>
2020-05-11 12:30:57 -04:00
Kevin O'Connor 98c9a991a3 bed_mesh: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 64031ab3d7 gcode: Rename respond() to respond_raw()
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>
2020-04-24 15:54:18 -04:00
Piotr Usewicz 939b575b01
bed_mesh: Fix typo (#2692)
Signed-off-by: Piotr Usewicz <piotr@layer22.com>
2020-04-14 22:09:28 -04:00
Arksine 97b4eff424 bed_mesh: detect incompatible mesh profiles
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 8013699c45 bed_mesh: refactor print_generated_points()
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 2a2191d201 bed_mesh: fix LOAD_PROFILE
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 13d16afa0c bed_mesh: Allow the default profile to be removed
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 2c877e1729 bed_mesh: improve interpolation checks
Move interpolation checks to _init_mesh_params() so they can be done whle the config is being parsed.  Do not allow a probe_count higher than 6 for lagrange interpolation, as this typically leads to oscillation.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine a69de2be93 bed_mesh: Move BED_MESH_MAP to Bedmesh class
Don't force probing when BED_MESH_MAP is executed,  output the existing mesh.  If the user wants to probe each time before a map they can do so with a gcode_macro.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine fe929e4696 bed_mesh: Add x,y offsets to min/max points in probe_finalize
This eliminates the need for the "mesh_params" dict to have references to the x and y offsets.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 5b20ac416c bed_mesh: refactoring
Renamed some variables in set_mesh() previous called "mesh_min" and "mesh_max" to alleviate confusion with the config options.

Renamed several attributes for clarity.  The "calibrate" attribute is now bmc, "probe_params" is now "mesh_params", "probed_z_table" is now "probed_matrix", "mesh_z_table" is now "mesh_matrix".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 74892a7702 bed_mesh: improve logging of generated points
Points are now logged after the printer is ready.  The formatting is improved, printing out the point index, and its corresponding automatic and manual points.

BED_MESH_OUTPUT now includes a PGP parameter, if PGP=1 the generated points are printed to the terminal.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine 914f701256 bed_mesh: add xy offsets to generated points
Rename min_point, max_point, and bed_radius to mesh_min, mesh_max, and mesh_radius respectively.  Add "mesh_origin" option, that allows round beds to specificy the center of the mesh.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-01-09 14:14:13 -05:00
Arksine d85b395a9c bed_mesh: fix error reporting
Fix invalid string formatting in the parse_pair() helper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-10-22 22:09:33 -04:00
fess 9887e72570 probe: ProbePointsHelper adjustable minimum points
Factor out minimum required points check for ProbePointsHelper
in prep for setting different values for quad_gantry_level
and z_tilt_adjust

Signed-off-by: John "Fess" Fessenden <fess@fess.org>
2019-05-21 14:17:09 -04:00
Matt Baker f2fbe98454 bed_mesh: enable relative offset bed meshes (#1323)
Adds parameter for bed meshes to be adjusted relative to a probed point
during calibration. This allows the probe z offset to be ignored for
probes that are not stable over time (for example, the thermal drift of
inductive probes). An endstop other than the probe is then necessary to
determine the bed-nozzle offset.

Signed-off-by: Matt Baker <baker.matt.j@gmail.com>
2019-03-21 10:39:22 -04:00
Arksine f7d8854587 bed_mesh: simplify configuration
The 'bed_shape' option has been removed.  The user will enter a 'bed_radius' if they have a round be, otherwise they should enter 'min_point' and 'max_point'.  When the bed is round the user should supply a 'round_probe_count' option, otherwise just 'probe_count'.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2019-02-25 13:34:14 -05:00
Arksine 7694c3e1b8 bed_mesh: fix get_position()
Fix a bug where the fade factor is calculated incorrectly when get_position() is called.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-02-25 13:34:14 -05:00
Arksine f308171be4 bed_mesh: refactor fade_target
Offset the entire mesh by the fade target amount rather than offset each z lookup.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-02-25 13:34:14 -05:00
Arksine cdcc320710 bed_mesh: add support for round beds
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-02-02 23:29:00 -05:00
Arksine 542f941f07 bed_mesh: log when fade completes.
- Also simplify the math for the mesh x and y multipliers.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2019-02-02 23:29:00 -05:00
Kevin O'Connor 857e7ed5f1 klippy: Convert printer_state("connect") to an event handler
Convert all users of the printer_state("connect") handler to register
a "klippy:connect" event handler instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 11:09:55 -05:00
Arksine cf6a56cebf bed_mesh: Introduce fade_target option
To deal potential z scaling when fade is enabled, a fade_target option has been introduced.  This option may either be set to 0.0 or any z position within the range of the mesh.  A value of 0.0 will result in previous behavior, where z adjustment phases out until no further adjustment is added.  A non-zero value will phase out adjustment until the target has been reached, after which the rest of the print will be offset along the z axis by the fade_target.  By default the fade_target will be calculated as an average of the mesh.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-11-30 11:37:21 -05:00
Arksine 35f41b7402 bed_mesh: Disable z-adjustment fade by default.
Due to various potential issues with fading out z-adjustment, it is better to disable by default and allow users to opt-in.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-11-30 11:37:21 -05:00
Lucas Fink f6c2e8b4eb bed_mesh: Fix some fragile identity comparisons
Signed-off-by: Lucas Fink <software@lfcode.ca>
2018-10-31 16:02:45 -04:00
Kevin O'Connor e4bb90a1ca bed_mesh: Do not automatically run G28 on BED_MESH_CALIBRATE / BED_MESH_MAP
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-10-22 11:26:01 -04:00
Arksine d29eb731a9 bed_mesh: save mesh state to 'default' profile after calibration
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-10-04 12:53:03 -04:00
Arksine b261d31ec5 bed_mesh: Add ability to save mesh state to persistent memory
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2018-10-02 16:26:35 -04:00