diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-04-18 12:55:32 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-04-18 12:55:32 -0400 |
commit | fb3bae4531740fa4ba8a6057aa5856f0c0582494 (patch) | |
tree | daf5b3bdb0bf2e7bf4cad799a20f7ce0d8f9f53e /klippy | |
parent | 260fd7d367b78a53170dde80fb53dac12df7576e (diff) | |
download | kutter-fb3bae4531740fa4ba8a6057aa5856f0c0582494.tar.gz kutter-fb3bae4531740fa4ba8a6057aa5856f0c0582494.tar.xz kutter-fb3bae4531740fa4ba8a6057aa5856f0c0582494.zip |
neopixel: Simplify color_order parsing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/extras/neopixel.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/klippy/extras/neopixel.py b/klippy/extras/neopixel.py index ef728fc2..b6daeb4d 100644 --- a/klippy/extras/neopixel.py +++ b/klippy/extras/neopixel.py @@ -33,12 +33,9 @@ class PrinterNeoPixel: raise config.error("color_order does not match chain_count") color_indexes = [] for lidx, co in enumerate(color_order): - rgb = "RGB" - if 'W' in co: - rgb = "RGBW" - if sorted(co) != sorted(rgb): + if sorted(co) not in (sorted("RGB"), sorted("RGBW")): raise config.error("Invalid color_order '%s'" % (co,)) - color_indexes.extend([(lidx, rgb.index(c)) for c in co]) + color_indexes.extend([(lidx, "RGBW".index(c)) for c in co]) self.color_map = list(enumerate(color_indexes)) if len(self.color_map) > MAX_MCU_SIZE: raise config.error("neopixel chain too long") |