neopixel: Use low priority for LED updates

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-08-06 22:25:26 -04:00
parent 4c09d8bf02
commit 115b888106
2 changed files with 8 additions and 2 deletions

View File

@ -5,6 +5,8 @@
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import bus import bus
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
class PrinterDotstar: class PrinterDotstar:
def __init__(self, config): def __init__(self, config):
self.printer = config.get_printer() self.printer = config.get_printer()
@ -36,7 +38,8 @@ class PrinterDotstar:
self.cmd_SET_LED, self.cmd_SET_LED,
desc=self.cmd_SET_LED_help) desc=self.cmd_SET_LED_help)
def send_data(self, minclock=0): def send_data(self, minclock=0):
self.spi.spi_send(self.color_data, minclock=minclock, reqclock=minclock) self.spi.spi_send(self.color_data, minclock=minclock,
reqclock=BACKGROUND_PRIORITY_CLOCK)
cmd_SET_LED_help = "Set the color of an LED" cmd_SET_LED_help = "Set the color of an LED"
def cmd_SET_LED(self, params): def cmd_SET_LED(self, params):
# Parse parameters # Parse parameters

View File

@ -4,6 +4,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
class PrinterNeoPixel: class PrinterNeoPixel:
def __init__(self, config): def __init__(self, config):
self.printer = config.get_printer() self.printer = config.get_printer()
@ -41,7 +43,8 @@ class PrinterNeoPixel:
"neopixel_send oid=%c data=%*s", cq=cmd_queue) "neopixel_send oid=%c data=%*s", cq=cmd_queue)
def send_data(self, minclock=0): def send_data(self, minclock=0):
self.neopixel_send_cmd.send([self.oid, self.color_data], self.neopixel_send_cmd.send([self.oid, self.color_data],
minclock=minclock) minclock=minclock,
reqclock=BACKGROUND_PRIORITY_CLOCK)
cmd_SET_LED_help = "Set the color of an LED" cmd_SET_LED_help = "Set the color of an LED"
def cmd_SET_LED(self, params): def cmd_SET_LED(self, params):
# Parse parameters # Parse parameters