neopixel: report color data via get_status() method

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-01-21 19:31:09 -05:00 committed by KevinOConnor
parent e520fb7878
commit 65afad9428
1 changed files with 10 additions and 0 deletions

View File

@ -136,6 +136,16 @@ class PrinterNeoPixel:
else: else:
#Send update now (so as not to wake toolhead and reset idle_timeout) #Send update now (so as not to wake toolhead and reset idle_timeout)
lookahead_bgfunc(None) 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): def load_config_prefix(config):
return PrinterNeoPixel(config) return PrinterNeoPixel(config)