stepper_enable: Add new extras module for stepper enable line tracking

Move the M18/M84 command handling from gcode.py to new stepper_enable
module.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-11-10 11:55:53 -05:00
parent 064804b688
commit f50e054bd0
3 changed files with 23 additions and 5 deletions

View file

@ -0,0 +1,20 @@
# Support for enable pins on stepper motor drivers
#
# Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
class StepperEnable:
def __init__(self, config):
self.printer = config.get_printer()
# Register M18/M84 commands
gcode = self.printer.lookup_object('gcode')
gcode.register_command("M18", self.cmd_M18)
gcode.register_command("M84", self.cmd_M18)
def cmd_M18(self, params):
# Turn off motors
toolhead = self.printer.lookup_object('toolhead')
toolhead.motor_off()
def load_config(config):
return StepperEnable(config)