From 65afad94281cc421b649e32575683c545502c7be Mon Sep 17 00:00:00 2001 From: Arksine Date: Thu, 21 Jan 2021 19:31:09 -0500 Subject: [PATCH] neopixel: report color data via get_status() method Signed-off-by: Eric Callahan --- klippy/extras/neopixel.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/klippy/extras/neopixel.py b/klippy/extras/neopixel.py index 1af0def4..481f8825 100644 --- a/klippy/extras/neopixel.py +++ b/klippy/extras/neopixel.py @@ -136,6 +136,16 @@ class PrinterNeoPixel: else: #Send update now (so as not to wake toolhead and reset idle_timeout) lookahead_bgfunc(None) + def get_status(self, eventtime): + cdata = [] + elem_size = len(self.color_order) + for i in range(self.chain_count): + idx = i * elem_size + cdata.append( + {k: round(v / 255., 4) for k, v in + zip(self.color_order, self.color_data[idx:idx+elem_size])} + ) + return {'color_data': cdata} def load_config_prefix(config): return PrinterNeoPixel(config)