MCPcopy Index your code
hub / github.com/FrameworkComputer/inputmodule-rs / random_eq

Function random_eq

python/inputmodule/gui/ledmatrix.py:58–69  ·  view source on GitHub ↗

Display an equlizer looking animation with random values.

(dev)

Source from the content-addressed store, hash-verified

56
57
58def random_eq(dev):
59 """Display an equlizer looking animation with random values."""
60 while True:
61 if is_thread_stopped() or is_dev_disconnected(dev.device):
62 reset_thread()
63 return
64 # Lower values more likely, makes it look nicer
65 weights = [i * i for i in range(33, 0, -1)]
66 population = list(range(1, 34))
67 vals = random.choices(population, weights=weights, k=9)
68 eq(dev, vals)
69 time.sleep(0.2)
70
71
72def clock(dev):

Callers 1

main_cliFunction · 0.90

Calls 4

is_thread_stoppedFunction · 0.90
is_dev_disconnectedFunction · 0.90
reset_threadFunction · 0.90
eqFunction · 0.90

Tested by

no test coverage detected