mirror of
https://github.com/mon/PocketVoltex.git
synced 2026-09-26 16:38:09 +03:00
30 lines
791 B
Python
30 lines
791 B
Python
BRIGHTNESS_LEVELS = 64
|
|
STAGES = 3
|
|
LEDS = 8
|
|
RING = [0,2,4,6,7,5,3,1]
|
|
|
|
TOTAL = STAGES * BRIGHTNESS_LEVELS
|
|
INTERVAL = TOTAL / LEDS
|
|
|
|
RISE = range(0,BRIGHTNESS_LEVELS)
|
|
FALL = range(BRIGHTNESS_LEVELS-1,-1,-1)
|
|
OFF = [0]*BRIGHTNESS_LEVELS
|
|
|
|
R = FALL + OFF + RISE
|
|
Rdir = [0, 0, 1]
|
|
G = RISE + FALL + OFF
|
|
Gdir = [1, 0, 0]
|
|
B = OFF + RISE + FALL
|
|
Bdir = [0, 1, 0]
|
|
|
|
print "// Generated by FollowerGen.py"
|
|
print "static const uint8_t followStart[][4] = {"
|
|
for i in range(LEDS):
|
|
# map to the different order in the board
|
|
actualIndex = RING.index(i)
|
|
offset = INTERVAL * actualIndex
|
|
dirOffset = offset / BRIGHTNESS_LEVELS
|
|
dir = Rdir[dirOffset] | Gdir[dirOffset] << 1 | Bdir[dirOffset] << 2
|
|
print "\t{%d, %d, %d, %s}," % (R[offset], G[offset], B[offset],'{:#05b}'.format(dir))
|
|
print "};"
|