mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-12-26 09:38:33 -07:00
probe_as_z_home: Added g28_probe_cmd_args configuration option
* Added the optional g28_probe_cmd_args configuration option to [probe_as_z_home] to allow gcode command arguments to be passed to the PROBE command during homing. * Updated documentation to 'Config_Reference.md'. Signed-off-by: Nick Weedon <nick@weedon.org.au>
This commit is contained in:
parent
3721130913
commit
9dde27aef3
2 changed files with 22 additions and 5 deletions
|
|
@ -2095,7 +2095,7 @@ sensor_type: ldc1612
|
|||
|
||||
This tool allows the homing procedure (```G28```) to use probing (i.e. the same as the ```PROBE``` command) so that in some cases the Z axis can be more accurately probed.
|
||||
|
||||
You should only use this option if you are occasionally experiencing innacurate homing.
|
||||
You should use this option if you are occasionally experiencing innacurate homing.
|
||||
|
||||
Configuring this tool will also cause the ```G28``` G-Code to emit a console message stating the correction that was performed. You can use this to measure the level of benefit that the tool is providing.
|
||||
|
||||
|
|
@ -2107,6 +2107,11 @@ See [command reference](G-Codes.md#G-Code_commands) for further information.
|
|||
|
||||
```
|
||||
[probe_as_z_home]
|
||||
#g28_probe_cmd_args:
|
||||
# Optional command arguments passed to the PROBE command while homing.
|
||||
# See [g-code PROBE command](G-Codes.md#probe).
|
||||
# Example:
|
||||
# g28_probe_cmd_args: SAMPLES=3 SAMPLES_TOLERANCE_RETRIES=5
|
||||
```
|
||||
|
||||
_Note: The standing homing procedure is still perofrmed before probing since this is required to ensure safety and compatibility with the probing method since probing requires homing to first be performed_
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class ProbeAsZHome:
|
|||
self.printer.load_object(config, 'homing')
|
||||
self.prev_G28 = self.gcode.register_command("G28", None)
|
||||
self.gcode.register_command("G28", self.cmd_G28)
|
||||
self.g28_probe_cmd_args = config.get("g28_probe_cmd_args", None)
|
||||
|
||||
def cmd_G28(self, gcmd):
|
||||
logging.debug("Probe As Home: Performing G28")
|
||||
|
|
@ -61,10 +62,21 @@ class ProbeAsZHome:
|
|||
current_pos[2] += retract_dist
|
||||
self.toolhead.move(current_pos, lift_speed)
|
||||
|
||||
# Use the probe options from the configuration here
|
||||
g28_gcmd = self.gcode.create_gcode_command("PROBE", "PROBE", {})
|
||||
probe_session = probe.start_probe_session(gcmd)
|
||||
probe_session.run_probe(gcmd)
|
||||
# Parse and pass any arguments defined in the g28_probe_cmd_args
|
||||
# configuration to the PROBE command.
|
||||
probe_args_dict = {}
|
||||
|
||||
if self.g28_probe_cmd_args is not None:
|
||||
probe_arg_tokens = self.g28_probe_cmd_args.split(" ")
|
||||
probe_arg_tokens = filter(lambda token: token.strip() != "",
|
||||
probe_arg_tokens)
|
||||
probe_args_dict = { operand[0]: operand[1] for operand in \
|
||||
[arg.split("=") for arg in probe_arg_tokens]}
|
||||
|
||||
probe_gcmd = self.gcode.create_gcode_command(
|
||||
"PROBE", "PROBE", probe_args_dict)
|
||||
probe_session = probe.start_probe_session(probe_gcmd)
|
||||
probe_session.run_probe(probe_gcmd)
|
||||
probed_pos = probe_session.pull_probed_results()[0]
|
||||
current_pos = self.toolhead.get_position()
|
||||
z_error_delta = probed_pos[2] - current_pos[2]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue