Added a random blink call based on interrupts.
This commit is contained in:
parent
7a1c6894da
commit
3e6687ea34
1 changed files with 17 additions and 1 deletions
|
@ -6,6 +6,7 @@ import numpy as np
|
||||||
import math
|
import math
|
||||||
from scipy.optimize import linear_sum_assignment
|
from scipy.optimize import linear_sum_assignment
|
||||||
import threading
|
import threading
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
print("start configuring matrix")
|
print("start configuring matrix")
|
||||||
|
@ -215,10 +216,25 @@ def interrupt_timer():
|
||||||
update_screen()
|
update_screen()
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
# Create and start the interrupt thread
|
|
||||||
|
def random_blinks():
|
||||||
|
while True:
|
||||||
|
time.sleep(random.randint(5, 10))
|
||||||
|
|
||||||
|
proot_state = ProotState()
|
||||||
|
|
||||||
|
if proot_state.get_blinks_frames_ready():
|
||||||
|
proot_state.blink()
|
||||||
|
|
||||||
|
|
||||||
|
# Create and start screen update interrupts
|
||||||
screen_update_thread = threading.Thread(target=interrupt_timer)
|
screen_update_thread = threading.Thread(target=interrupt_timer)
|
||||||
screen_update_thread.start()
|
screen_update_thread.start()
|
||||||
|
|
||||||
|
# Create and start random blinks interrupts
|
||||||
|
screen_update_thread = threading.Thread(target=random_blinks)
|
||||||
|
screen_update_thread.start()
|
||||||
|
|
||||||
|
|
||||||
print("start setting ProotScreen")
|
print("start setting ProotScreen")
|
||||||
startT = curr_time = round(time.time()*1000)
|
startT = curr_time = round(time.time()*1000)
|
||||||
|
|
Loading…
Add table
Reference in a new issue