neopixel: Update neopixel.py to add BRG color order (#5110)

Add BRG color option.
Document BRG color option.

Signed-off-by: Timothy Abraham <Timothyabe93@gmail.com>
This commit is contained in:
Tim Abraham 2022-01-12 12:18:08 -05:00 committed by GitHub
parent 090fcf928f
commit babb067b60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -2560,7 +2560,7 @@ pin:
# Neopixel is connected to the pin).
#color_order: GRB
# Set the pixel order required by the LED hardware. Options are GRB,
# RGB, GRBW, or RGBW. The default is GRB.
# RGB, BRG, 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", "RGBW", "GRBW"]}
formats = {v: v for v in ["RGB", "GRB", "BRG", "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,
@ -67,6 +67,8 @@ class PrinterNeoPixel:
color_data = [green, red, blue]
elif self.color_order == "RGB":
color_data = [red, green, blue]
elif self.color_order == "BRG":
color_data = [blue, red, green]
elif self.color_order == "GRBW":
color_data = [green, red, blue, white]
else: