Fix setting gamma correction.
This commit is contained in:
parent
e93bc2f828
commit
55fd4c501f
9
main.py
9
main.py
@ -106,12 +106,9 @@ class SerialWriter(threading.Thread):
|
|||||||
gr = int(math.pow(i/255, r)*255)
|
gr = int(math.pow(i/255, r)*255)
|
||||||
gg = int(math.pow(i/255, g)*255)
|
gg = int(math.pow(i/255, g)*255)
|
||||||
gb = int(math.pow(i/255, b)*255)
|
gb = int(math.pow(i/255, b)*255)
|
||||||
assert gr >= 0 and gr <= 255
|
buf[i] = max(0, min(255, gr))
|
||||||
assert gg >= 0 and gg <= 255
|
buf[i+256] = max(0, min(255, gg))
|
||||||
assert gb >= 0 and gb <= 255
|
buf[i+512] = max(0, min(255, gb))
|
||||||
buf[i] =gr
|
|
||||||
buf[i+255] = gg
|
|
||||||
buf[i+511] = gb
|
|
||||||
ser.write(b"\x02")
|
ser.write(b"\x02")
|
||||||
ser.write(buf)
|
ser.write(buf)
|
||||||
self.updateGamma = False
|
self.updateGamma = False
|
||||||
|
Loading…
Reference in New Issue
Block a user