-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircleblast.py
32 lines (27 loc) · 909 Bytes
/
circleblast.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
import time
from parkertree.remote import Client
from parkertree.simulation import DisplaySimulator
from parkertree.animations import Colors,CircleBlaster
from parkertree.datastore import LEDDB
# This is a 2d sim, load the data from view 0
led_db = LEDDB("data/led_db.pickle")
led_data = led_db.getView(0)
#t = Client("192.168.1.199", 3544)
#t.clear()
t = DisplaySimulator(led_data)
fb = CircleBlaster(led_data)
while True:
for frame in fb:
s = time.time()
t.setString(frame.pixel_data)
# sim.setString(frame.pixel_data)
e = time.time()
# sleep off however much time is left after displaying the
# last frame
d = e-s
if d < frame.display_time:
time.sleep(frame.display_time - d)
elif False:
lag = d - frame.display_time
print(f"Can't keep up! Lagged by {lag}s")