Skip to content

Commit

Permalink
添加配置变量,控制是否在校准后自动保存bedmesh数据到config中.
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoGeTiertime committed Dec 10, 2024
1 parent 8b4032f commit 9ab9e61
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion klippy/extras/bed_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def __init__(self, config, bedmesh):
self._init_mesh_config(config)
self._generate_points(config.error)
self._profile_name = "default"
self._autosave = config.getint('autosave', 1)
self.probe_helper = probe.ProbePointsHelper(
config, self.probe_finalize, self._get_adjusted_points())
self.probe_helper.minimum_points(3)
Expand Down Expand Up @@ -670,6 +671,7 @@ def update_config(self, gcmd):
self.origin = self.orig_config['origin']
self.mesh_min = self.orig_config['mesh_min']
self.mesh_max = self.orig_config['mesh_max']
self._autosave = gcmd.get_int('AUTOSAVE', self._autosave)
for key in list(self.mesh_config.keys()):
self.mesh_config[key] = self.orig_config[key]

Expand Down Expand Up @@ -873,7 +875,7 @@ def probe_finalize(self, offsets, positions):
z_mesh.set_zero_reference(*self.zero_ref_pos)
self.bedmesh.set_mesh(z_mesh)
self.gcode.respond_info("Mesh Bed Leveling Complete")
if self._profile_name is not None:
if self._autosave and (self._profile_name is not None):
self.bedmesh.save_profile(self._profile_name)
def _dump_points(self, probed_pts, corrected_pts, offsets):
# logs generated points with offset applied, points received
Expand Down

0 comments on commit 9ab9e61

Please sign in to comment.