From c148f17ea3391e3720961270a12eb0645f688e12 Mon Sep 17 00:00:00 2001 From: Paul McGowan Date: Wed, 2 Jun 2021 10:51:45 -0400 Subject: neopixel: add sync parameter to prevent waking toolhead (#4339) neopixel: add sync param to prevent waking toolhead dotstar: refactor to match neopixel methods and add sync parameter Signed-off-by: Paul McGowan --- klippy/extras/neopixel.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'klippy/extras/neopixel.py') diff --git a/klippy/extras/neopixel.py b/klippy/extras/neopixel.py index e7785d97..1af0def4 100644 --- a/klippy/extras/neopixel.py +++ b/klippy/extras/neopixel.py @@ -119,6 +119,7 @@ class PrinterNeoPixel: white = gcmd.get_float('WHITE', 0., minval=0., maxval=1.) index = gcmd.get_int('INDEX', None, minval=1, maxval=self.chain_count) transmit = gcmd.get_int('TRANSMIT', 1) + sync = gcmd.get_int('SYNC', 1) # Update and transmit data def reactor_bgfunc(print_time): with self.mutex: @@ -128,8 +129,13 @@ class PrinterNeoPixel: def lookahead_bgfunc(print_time): reactor = self.printer.get_reactor() reactor.register_callback(lambda et: reactor_bgfunc(print_time)) - toolhead = self.printer.lookup_object('toolhead') - toolhead.register_lookahead_callback(lookahead_bgfunc) + if sync: + #Sync LED Update with print time and send + toolhead = self.printer.lookup_object('toolhead') + toolhead.register_lookahead_callback(lookahead_bgfunc) + else: + #Send update now (so as not to wake toolhead and reset idle_timeout) + lookahead_bgfunc(None) def load_config_prefix(config): return PrinterNeoPixel(config) -- cgit v1.2.3-70-g09d2