From 3e6687ea342e4fcd2d315a83042454c0f2778ec5 Mon Sep 17 00:00:00 2001
From: CiscoTheWolf <cisco@hostingwire.net>
Date: Tue, 23 May 2023 22:24:51 +0200
Subject: [PATCH] Added a random blink call based on interrupts.

---
 rpi/antRender.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/rpi/antRender.py b/rpi/antRender.py
index 2452b1f..6a2d632 100644
--- a/rpi/antRender.py
+++ b/rpi/antRender.py
@@ -6,6 +6,7 @@ import numpy as np
 import math
 from scipy.optimize import linear_sum_assignment
 import threading
+import random
 
 
 print("start configuring matrix")
@@ -215,10 +216,25 @@ def interrupt_timer():
         update_screen()
         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.start()
 
+# Create and start random blinks interrupts
+screen_update_thread = threading.Thread(target=random_blinks)
+screen_update_thread.start()
+
 
 print("start setting ProotScreen")
 startT = curr_time = round(time.time()*1000)