Skip to content

Commit f9054b6

Browse files
committed
Make number of ticks the vizualizer lights up a led configurable
1 parent 801834a commit f9054b6

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

trellis_mpc/app_viz_spectrum.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ def __updateLEDs(self, matrix):
9191

9292
value = int(value * 8.0)
9393
for y in range(config.VIZ_NUM_BINS):
94-
self.__leds[x + ((7-y) * 8)] = (value > y)
94+
idx = x + ((7-y) * 8)
95+
if value > y:
96+
self.__leds[idx] = config.VIZ_GLOW_TICKS
97+
elif self.__leds[idx] > 0:
98+
self.__leds[idx] = self.__leds[idx] - 1
9599

96100
return
97101

trellis_mpc/board_curses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __updateLED(self, window, idx, active, selected):
8282

8383
if selected:
8484
color = curses.color_pair(COLOR_SELECTED)
85-
elif active:
85+
elif active > 0:
8686
color = curses.color_pair(COLOR_ACTIVE)
8787
else:
8888
color = curses.color_pair(COLOR_INACTIVE)

trellis_mpc/board_trellis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def getPressedButtons(self):
7575

7676
def setLEDs(self, leds=[]):
7777
for i in range(NUM_LEDS):
78-
if leds[i] == 1:
78+
if leds[i] > 0:
7979
self.__trellis.setLED(BOARDTRELLIS[i])
8080
else:
8181
self.__trellis.clrLED(BOARDTRELLIS[i])

trellis_mpc/config_template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
VIZ_NUM_BINS = 8
2323
VIZ_MIN_FREQUENCY = 10
2424
VIZ_MAX_FREQUENCY = 8000
25+
VIZ_GLOW_TICKS = 2
2526
VIZ_SECONDS_IDLE = 5

0 commit comments

Comments
 (0)