aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/Config_Reference.md5
-rw-r--r--klippy/extras/neopixel.py7
2 files changed, 6 insertions, 6 deletions
diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md
index c62d4274..780d5707 100644
--- a/docs/Config_Reference.md
+++ b/docs/Config_Reference.md
@@ -2557,8 +2557,9 @@ pin:
# provided pin. The default is 1 (which indicates only a single
# Neopixel is connected to the pin).
#color_order: GRB
-# Set the pixel order required by the LED hardware. Options are GRB,
-# RGB, BRG, BGR, GRBW, or RGBW. The default is GRB.
+# Set the pixel order required by the LED hardware (using a string
+# containing the letters R, G, B, W with W optional). The default is
+# GRB.
#initial_RED: 0.0
#initial_GREEN: 0.0
#initial_BLUE: 0.0
diff --git a/klippy/extras/neopixel.py b/klippy/extras/neopixel.py
index d4dabf9f..abca823e 100644
--- a/klippy/extras/neopixel.py
+++ b/klippy/extras/neopixel.py
@@ -12,8 +12,6 @@ RESET_MIN_TIME=.000050
MAX_MCU_SIZE = 500 # Sanity check on LED chain length
-COLOR_FORMATS = ["RGB", "GRB", "BRG", "BGR", "RGBW", "GRBW"]
-
class PrinterNeoPixel:
def __init__(self, config):
self.printer = printer = config.get_printer()
@@ -25,8 +23,9 @@ 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 COLOR_FORMATS}
- color_order = config.getchoice("color_order", formats, "GRB")
+ color_order = config.get("color_order", "GRB")
+ if sorted(color_order) not in (sorted("RGB"), sorted("RGBW")):
+ raise config.error("Invalid color_order '%s'" % (color_order,))
if 'W' in color_order:
color_index = [color_order.index(c) for c in "RGBW"]
else: