From 50d46eae2fe4ca93b7b45a39c85ae222a119c1d0 Mon Sep 17 00:00:00 2001
From: CiscoTheWolf <cisco@hostingwire.net>
Date: Tue, 23 May 2023 19:51:52 +0200
Subject: [PATCH] Increased timer granularity to ms

---
 rpi/antRender.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/rpi/antRender.py b/rpi/antRender.py
index 9499bb0..8879227 100644
--- a/rpi/antRender.py
+++ b/rpi/antRender.py
@@ -156,7 +156,7 @@ def interpolate_point_pairs(pairs: list[tuple[Point2D, Point2D]], percentage: fl
 
 
 print("start configuring matrix")
-startT = curr_time = round(time.time())
+startT = curr_time = round(time.time()*1000)
 
 # Configuration for the matrix
 options = RGBMatrixOptions()
@@ -167,42 +167,42 @@ options.parallel = 1
 options.hardware_mapping = 'regular'  # If you have an Adafruit HAT: 'adafruit-hat'
 matrix = RGBMatrix(options=options)
 
-endT = curr_time = round(time.time())
-print("configuring matrix took: " + str(endT - startT))
+endT = curr_time = round(time.time()*1000)
+print("configuring matrix took: " + str(endT - startT) + " ms")
 
 
 
 print("start loading images")
-startT = curr_time = round(time.time())
+startT = curr_time = round(time.time()*1000)
 
 Image1 = Image.open("faces/eyeLeftOpen.png")
 Image2 = Image.open("faces/eyeLeftClosed.png")
 
-endT = curr_time = round(time.time())
-print("loading images took: " + str(endT - startT))
+endT = curr_time = round(time.time()*1000)
+print("loading images took: " + str(endT - startT) + " ms")
 
 
 
 print("start generating pixel array")
-startT = curr_time = round(time.time())
+startT = curr_time = round(time.time()*1000)
 
 pixelArray1 = generate_point_array_from_image(Image1)
 pixelArray2 = generate_point_array_from_image(Image2)
 
-endT = curr_time = round(time.time())
-print("generating pixel array took: " + str(endT - startT))
+endT = curr_time = round(time.time()*1000)
+print("generating pixel array took: " + str(endT - startT) + " ms")
 
 
 
 
 
 print("start pairing points for one eye")
-startT = curr_time = round(time.time())
+startT = curr_time = round(time.time()*1000)
 
 LeftEyeBlinkPairs = pair_points(pixelArray1, pixelArray2)
 
-endT = curr_time = round(time.time())
-print("pairing points for one eye took: " + str(endT - startT))
+endT = curr_time = round(time.time()*1000)
+print("pairing points for one eye took: " + str(endT - startT) + " ms")
 
 
 DesiredBlinkState = 10
@@ -212,7 +212,7 @@ blinkFrameCanvases = []
 
 
 print("start populating matrices for each blink frame")
-startT = curr_time = round(time.time())
+startT = curr_time = round(time.time()*1000)
 
 for alpha in range(0,11):
     offscreen_interpolated_canvas = matrix.CreateFrameCanvas()
@@ -223,8 +223,8 @@ for alpha in range(0,11):
     offscreen_interpolated_canvas.SetImage(interpolated_image, unsafe=False)
     blinkFrameCanvases.append(offscreen_interpolated_canvas)
     
-endT = curr_time = round(time.time())
-print("populating matrices for each blink frame took: " + str(endT - startT))
+endT = curr_time = round(time.time()*1000)
+print("populating matrices for each blink frame took: " + str(endT - startT) + " ms")