aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/output_pin.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-04-25 00:12:01 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-05-05 11:08:12 -0400
commit53093a7a15a6c8750bdb8289d88fd48ed7acc780 (patch)
treeceac392c2e37c0cb368d4295b522463fa5c115b0 /klippy/extras/output_pin.py
parent3c4091548e57ad37b61d43cce0d60e29467e0314 (diff)
downloadkutter-53093a7a15a6c8750bdb8289d88fd48ed7acc780.tar.gz
kutter-53093a7a15a6c8750bdb8289d88fd48ed7acc780.tar.xz
kutter-53093a7a15a6c8750bdb8289d88fd48ed7acc780.zip
output_pin: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/output_pin.py')
-rw-r--r--klippy/extras/output_pin.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/klippy/extras/output_pin.py b/klippy/extras/output_pin.py
index dbc1fab4..92c055fd 100644
--- a/klippy/extras/output_pin.py
+++ b/klippy/extras/output_pin.py
@@ -35,16 +35,15 @@ class PrinterOutputPin:
'shutdown_value', 0., minval=0., maxval=self.scale) / self.scale
self.mcu_pin.setup_start_value(self.last_value, shutdown_value)
pin_name = config.get_name().split()[1]
- self.gcode = self.printer.lookup_object('gcode')
- self.gcode.register_mux_command("SET_PIN", "PIN", pin_name,
- self.cmd_SET_PIN,
- desc=self.cmd_SET_PIN_help)
+ gcode = self.printer.lookup_object('gcode')
+ gcode.register_mux_command("SET_PIN", "PIN", pin_name,
+ self.cmd_SET_PIN,
+ desc=self.cmd_SET_PIN_help)
def get_status(self, eventtime):
return {'value': self.last_value}
cmd_SET_PIN_help = "Set the value of an output pin"
- def cmd_SET_PIN(self, params):
- value = self.gcode.get_float('VALUE', params,
- minval=0., maxval=self.scale)
+ def cmd_SET_PIN(self, gcmd):
+ value = gcmd.get_float('VALUE', minval=0., maxval=self.scale)
value /= self.scale
if value == self.last_value:
return
@@ -54,7 +53,7 @@ class PrinterOutputPin:
self.mcu_pin.set_pwm(print_time, value)
else:
if value not in [0., 1.]:
- raise self.gcode.error("Invalid pin value")
+ raise gcmd.error("Invalid pin value")
self.mcu_pin.set_digital(print_time, value)
self.last_value = value
self.last_value_time = print_time