Fixed function so the hue stays in 2^16 range

develop
blaz-r 2021-07-18 15:03:30 +02:00
rodzic 05be57279b
commit 14870677d4
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -123,6 +123,9 @@ class Neopixel:
# https://github.com/adafruit/Adafruit_NeoPixel so all the credits for that
# go directly to them (license: https://github.com/adafruit/Adafruit_NeoPixel/blob/master/COPYING)
def colorHSV(self, hue, sat, val):
if hue >= 65536:
hue %= 65536
hue = (hue * 1530 + 32768) // 65536
if hue < 510:
b = 0