Increased timer granularity to ms

This commit is contained in:
CiscoTheWolf 2023-05-23 19:51:52 +02:00
parent 215028dad9
commit 50d46eae2f

View file

@ -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")