neopixel: add BGR for neopixel (#5160)

Signed-off-by: Thomas Liebold <electron2410@gmail.com>
This commit is contained in:
electron2410 2022-03-14 17:30:58 +01:00 committed by GitHub
parent 7731c30422
commit 02d770ae3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -2556,7 +2556,7 @@ pin:
# Neopixel is connected to the pin).
#color_order: GRB
# Set the pixel order required by the LED hardware. Options are GRB,
# RGB, BRG, GRBW, or RGBW. The default is GRB.
# RGB, BRG, BGR, GRBW, or RGBW. The default is GRB.
#initial_RED: 0.0
#initial_GREEN: 0.0
#initial_BLUE: 0.0

View File

@ -24,7 +24,7 @@ class PrinterNeoPixel:
self.oid = self.mcu.create_oid()
self.pin = pin_params['pin']
self.mcu.register_config_callback(self.build_config)
formats = {v: v for v in ["RGB", "GRB", "BRG", "RGBW", "GRBW"]}
formats = {v: v for v in ["RGB", "GRB", "BRG", "BGR", "RGBW", "GRBW"]}
self.color_order = config.getchoice("color_order", formats, "GRB")
elem_size = len(self.color_order)
self.chain_count = config.getint('chain_count', 1, minval=1,
@ -69,6 +69,8 @@ class PrinterNeoPixel:
color_data = [red, green, blue]
elif self.color_order == "BRG":
color_data = [blue, red, green]
elif self.color_order == "BGR":
color_data = [blue, green, red]
elif self.color_order == "GRBW":
color_data = [green, red, blue, white]
else: