mirror of https://github.com/Desuuuu/klipper.git
fan: Do not flush look-ahead queue on fan speed change
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
8158dbcc21
commit
e576571340
|
@ -52,16 +52,18 @@ class PrinterFan:
|
|||
self.last_fan_value = value
|
||||
def get_status(self, eventtime):
|
||||
return {'speed': self.last_fan_value}
|
||||
def _delayed_set_speed(self, value):
|
||||
toolhead = self.printer.lookup_object('toolhead')
|
||||
toolhead.register_lookahead_callback((lambda pt:
|
||||
self.set_speed(pt, value)))
|
||||
def cmd_M106(self, params):
|
||||
# Set fan speed
|
||||
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
|
||||
gcode = self.printer.lookup_object('gcode')
|
||||
value = gcode.get_float('S', params, 255., minval=0.) / 255.
|
||||
self.set_speed(print_time, value)
|
||||
self._delayed_set_speed(value)
|
||||
def cmd_M107(self, params):
|
||||
# Turn fan off
|
||||
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
|
||||
self.set_speed(print_time, 0.)
|
||||
self._delayed_set_speed(0.)
|
||||
|
||||
def load_config(config):
|
||||
return PrinterFan(config)
|
||||
|
|
Loading…
Reference in New Issue