fan: Use new GCodeCommand wrappers

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-04-24 22:59:38 -04:00
parent 33c6667881
commit d04476c82e
1 changed files with 3 additions and 4 deletions

View File

@ -56,12 +56,11 @@ class PrinterFan:
toolhead = self.printer.lookup_object('toolhead') toolhead = self.printer.lookup_object('toolhead')
toolhead.register_lookahead_callback((lambda pt: toolhead.register_lookahead_callback((lambda pt:
self.set_speed(pt, value))) self.set_speed(pt, value)))
def cmd_M106(self, params): def cmd_M106(self, gcmd):
# Set fan speed # Set fan speed
gcode = self.printer.lookup_object('gcode') value = gcmd.get_float('S', 255., minval=0.) / 255.
value = gcode.get_float('S', params, 255., minval=0.) / 255.
self._delayed_set_speed(value) self._delayed_set_speed(value)
def cmd_M107(self, params): def cmd_M107(self, gcmd):
# Turn fan off # Turn fan off
self._delayed_set_speed(0.) self._delayed_set_speed(0.)