diff --git a/measurementGD.py b/measurementGD.py index b6e614e..d1da7d3 100644 --- a/measurementGD.py +++ b/measurementGD.py @@ -5,13 +5,20 @@ import datetime import threading import time -import winsound from abc import abstractmethod +import cv2 import numpy as np from gdx import gdx +disp = np.zeros((600, 1200, 3)) + 0.2 +cv2.imshow("disp", disp) +cv2.waitKey(1) +x = 0 +lx = x +ly = 0 + class DataWorker(threading.Thread): def __init__(self, out_filename=""): @@ -49,6 +56,17 @@ self._start = time.perf_counter() while self._running: measurements = self.read() + print(measurements[0]) + global x, disp, lx, ly + x += 2 + if x >= 1200: + x = 0 + disp = np.zeros((600, 1200, 3)) + 0.2 + y = int(-measurements[0] * 50 + 500) + cv2.line(disp, (lx, ly), (x, y), (0, 1.0, 1.0), 2) + ly = y + lx = x + # cv2.circle(disp, (x, y), 3, (0, 1.0, 1.0), 2) elapse = time.perf_counter() - self._start current = self._start_time + datetime.timedelta(seconds=elapse) measurements.insert(0, current.strftime("%H:%M:%S.%f")) @@ -104,16 +122,20 @@ # Wait for stop print("measurement start.") - winsound.Beep(1000, 200) - recode_dulation = 30 # sec - for i in range(recode_dulation): - time.sleep(1) - print(i + 1, "/", recode_dulation, "sec") - # input("Press ENTER to stop") - print("measurement end.") - winsound.Beep(1000, 150) - time.sleep(0.15) - winsound.Beep(1000, 150) + while 1: + cv2.imshow("disp", disp) + cv2.waitKey(1) + + # winsound.Beep(1000, 200) + # recode_dulation = 5 # sec + # for i in range(recode_dulation): + # time.sleep(1) + # print(i + 1, "/", recode_dulation, "sec") + # # input("Press ENTER to stop") + # print("measurement end.") + # winsound.Beep(1000, 150) + # time.sleep(0.15) + # winsound.Beep(1000, 150) # Closing - godirect_worker.stop() + # godirect_worker.stop()