diff options
author | Paul McGowan <mental405@gmail.com> | 2021-06-02 10:51:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-02 10:51:45 -0400 |
commit | c148f17ea3391e3720961270a12eb0645f688e12 (patch) | |
tree | 2a19278b93811246249d80b14a9986269efec3ca /klippy/extras/neopixel.py | |
parent | 9f4a0dc77f3d9f38e49d0f1aa56b7db58ae1c989 (diff) | |
download | kutter-c148f17ea3391e3720961270a12eb0645f688e12.tar.gz kutter-c148f17ea3391e3720961270a12eb0645f688e12.tar.xz kutter-c148f17ea3391e3720961270a12eb0645f688e12.zip |
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 <mental405@gmail.com>
Diffstat (limited to 'klippy/extras/neopixel.py')
-rw-r--r-- | klippy/extras/neopixel.py | 10 |
1 files changed, 8 insertions, 2 deletions
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) |