bed_mesh: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
c0796bc42d
commit
98c9a991a3
|
@ -179,29 +179,28 @@ class BedMesh:
|
||||||
"Mesh Leveling: Error splitting move ")
|
"Mesh Leveling: Error splitting move ")
|
||||||
self.last_position[:] = newpos
|
self.last_position[:] = newpos
|
||||||
cmd_BED_MESH_OUTPUT_help = "Retrieve interpolated grid of probed z-points"
|
cmd_BED_MESH_OUTPUT_help = "Retrieve interpolated grid of probed z-points"
|
||||||
def cmd_BED_MESH_OUTPUT(self, params):
|
def cmd_BED_MESH_OUTPUT(self, gcmd):
|
||||||
if self.gcode.get_int('PGP', params, 0):
|
if gcmd.get_int('PGP', 0):
|
||||||
# Print Generated Points instead of mesh
|
# Print Generated Points instead of mesh
|
||||||
self.bmc.print_generated_points(self.gcode.respond_info)
|
self.bmc.print_generated_points(gcmd.respond_info)
|
||||||
elif self.z_mesh is None:
|
elif self.z_mesh is None:
|
||||||
self.gcode.respond_info("Bed has not been probed")
|
gcmd.respond_info("Bed has not been probed")
|
||||||
else:
|
else:
|
||||||
self.bmc.print_probed_positions(self.gcode.respond_info)
|
self.bmc.print_probed_positions(gcmd.respond_info)
|
||||||
self.z_mesh.print_mesh(self.gcode.respond_raw,
|
self.z_mesh.print_mesh(gcmd.respond_raw, self.horizontal_move_z)
|
||||||
self.horizontal_move_z)
|
|
||||||
cmd_BED_MESH_MAP_help = "Serialize mesh and output to terminal"
|
cmd_BED_MESH_MAP_help = "Serialize mesh and output to terminal"
|
||||||
def cmd_BED_MESH_MAP(self, params):
|
def cmd_BED_MESH_MAP(self, gcmd):
|
||||||
if self.z_mesh is not None:
|
if self.z_mesh is not None:
|
||||||
params = self.z_mesh.mesh_params
|
params = self.z_mesh.mesh_params
|
||||||
outdict = {
|
outdict = {
|
||||||
'mesh_min': (params['min_x'], params['min_y']),
|
'mesh_min': (params['min_x'], params['min_y']),
|
||||||
'mesh_max': (params['max_x'], params['max_y']),
|
'mesh_max': (params['max_x'], params['max_y']),
|
||||||
'z_positions': self.bmc.probed_matrix}
|
'z_positions': self.bmc.probed_matrix}
|
||||||
self.gcode.respond_raw("mesh_map_output " + json.dumps(outdict))
|
gcmd.respond_raw("mesh_map_output " + json.dumps(outdict))
|
||||||
else:
|
else:
|
||||||
self.gcode.respond_info("Bed has not been probed")
|
gcmd.respond_info("Bed has not been probed")
|
||||||
cmd_BED_MESH_CLEAR_help = "Clear the Mesh so no z-adjusment is made"
|
cmd_BED_MESH_CLEAR_help = "Clear the Mesh so no z-adjusment is made"
|
||||||
def cmd_BED_MESH_CLEAR(self, params):
|
def cmd_BED_MESH_CLEAR(self, gcmd):
|
||||||
self.set_mesh(None)
|
self.set_mesh(None)
|
||||||
|
|
||||||
|
|
||||||
|
@ -451,29 +450,28 @@ class BedMeshCalibrate:
|
||||||
self.gcode.respond_info(
|
self.gcode.respond_info(
|
||||||
"No profile named [%s] to remove" % (prof_name))
|
"No profile named [%s] to remove" % (prof_name))
|
||||||
cmd_BED_MESH_PROFILE_help = "Bed Mesh Persistent Storage management"
|
cmd_BED_MESH_PROFILE_help = "Bed Mesh Persistent Storage management"
|
||||||
def cmd_BED_MESH_PROFILE(self, params):
|
def cmd_BED_MESH_PROFILE(self, gcmd):
|
||||||
options = collections.OrderedDict({
|
options = collections.OrderedDict({
|
||||||
'LOAD': self.load_profile,
|
'LOAD': self.load_profile,
|
||||||
'SAVE': self.save_profile,
|
'SAVE': self.save_profile,
|
||||||
'REMOVE': self.remove_profile
|
'REMOVE': self.remove_profile
|
||||||
})
|
})
|
||||||
for key in options:
|
for key in options:
|
||||||
name = self.gcode.get_str(key, params, None)
|
name = gcmd.get(key, None)
|
||||||
if name is not None:
|
if name is not None:
|
||||||
if name == "default" and key == 'SAVE':
|
if name == "default" and key == 'SAVE':
|
||||||
self.gcode.respond_info(
|
gcmd.respond_info(
|
||||||
"Profile 'default' is reserved, please chose"
|
"Profile 'default' is reserved, please chose"
|
||||||
" another profile name.")
|
" another profile name.")
|
||||||
else:
|
else:
|
||||||
options[key](name)
|
options[key](name)
|
||||||
return
|
return
|
||||||
self.gcode.respond_info(
|
gcmd.respond_info("Invalid syntax '%s'" % (gcmd.get_commandline(),))
|
||||||
"Invalid syntax '%s'" % (params['#original']))
|
|
||||||
cmd_BED_MESH_CALIBRATE_help = "Perform Mesh Bed Leveling"
|
cmd_BED_MESH_CALIBRATE_help = "Perform Mesh Bed Leveling"
|
||||||
def cmd_BED_MESH_CALIBRATE(self, params):
|
def cmd_BED_MESH_CALIBRATE(self, gcmd):
|
||||||
self.build_map = False
|
self.build_map = False
|
||||||
self.bedmesh.set_mesh(None)
|
self.bedmesh.set_mesh(None)
|
||||||
self.probe_helper.start_probe(params)
|
self.probe_helper.start_probe(gcmd)
|
||||||
def print_probed_positions(self, print_func):
|
def print_probed_positions(self, print_func):
|
||||||
if self.probed_matrix is not None:
|
if self.probed_matrix is not None:
|
||||||
msg = "Mesh Leveling Probed Z positions:\n"
|
msg = "Mesh Leveling Probed Z positions:\n"
|
||||||
|
|
Loading…
Reference in New Issue