diff --git a/scanner.py b/scanner.py index 70adcfd..8e9bedb 100644 --- a/scanner.py +++ b/scanner.py @@ -338,13 +338,17 @@ def __init__(self, config: ConfigWrapper): cmd_SCANNER_CALIBRATE_help = "Calibrate scanner response curve" def cmd_SCANNER_CALIBRATE(self, gcmd: GCodeCommand): + orig_params = gcmd.get_command_parameters() if self.calibration_method != "scan": cmd = self.sensor_name + "_TOUCH" - params = {} + params: dict[str, str] = {} if gcmd.get("METHOD", "None").lower() == "manual": params["METHOD"] = "manual" else: params["CALIBRATE"] = "1" + + params.update(orig_params) + cmd = self.gcode.create_gcode_command(cmd, cmd, params) self.cmd_SCANNER_TOUCH(cmd) else: diff --git a/typings/gcode.pyi b/typings/gcode.pyi index f67c253..8c3a88e 100644 --- a/typings/gcode.pyi +++ b/typings/gcode.pyi @@ -1,4 +1,5 @@ from typing import Callable, NamedTuple, final, overload +# Types for https://github.com/Klipper3d/klipper/blob/master/klippy/gcode.py @final class CommandError(Exception): @@ -14,6 +15,8 @@ class GCodeCommand: pass def respond_info(self, msg: str, log: bool = True) -> None: pass + def get_command_parameters(self) -> dict[str, str]: + pass @overload def get(