From 137f3004f7e60364dfd3d4bb50649242b6b83bf0 Mon Sep 17 00:00:00 2001 From: Prohurtz <48768484+RedHawk989@users.noreply.github.com> Date: Sun, 19 Mar 2023 17:07:05 -0500 Subject: [PATCH] fix flip right axis, fix http add --- EyeTrackApp/camera.py | 6 ++---- EyeTrackApp/osc_calibrate_filter.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/EyeTrackApp/camera.py b/EyeTrackApp/camera.py index eca3a36..5b2cff3 100644 --- a/EyeTrackApp/camera.py +++ b/EyeTrackApp/camera.py @@ -59,10 +59,8 @@ class Camera: if ( self.config.capture_source != None and self.config.capture_source != "" ): - # if len(self.current_capture_source) > 2 and "http" not in self.current_capture_source: - # self.current_capture_source = f"http://{self.current_capture_source}/" - # print(self.current_capture_source) - if (self.current_capture_source[:3] == "COM"): + + if (self.config.capture_source[:3] == "COM"): if ( self.serial_connection is None or self.camera_status == CameraState.DISCONNECTED diff --git a/EyeTrackApp/osc_calibrate_filter.py b/EyeTrackApp/osc_calibrate_filter.py index c952b54..c2a2dee 100644 --- a/EyeTrackApp/osc_calibrate_filter.py +++ b/EyeTrackApp/osc_calibrate_filter.py @@ -1,9 +1,16 @@ import sys from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC import numpy as np +from enum import IntEnum + +class EyeId(IntEnum): + RIGHT = 0 + LEFT = 1 + BOTH = 2 + SETTINGS = 3 def cal_osc(self, cx, cy): - if self.eye_id == "EyeId.RIGHT": + if self.eye_id == EyeId.RIGHT: flipx = self.settings.gui_flip_x_axis_right else: flipx = self.settings.gui_flip_x_axis_left @@ -61,7 +68,7 @@ def cal_osc(self, cx, cy): if yu > 0: out_y = max(0.0, min(1.0, yu)) - if flipx: #TODO Check for working function + if flipx: if xr >= 0: out_x = -abs(max(0.0, min(1.0, xr))) if xl > 0: @@ -72,7 +79,7 @@ def cal_osc(self, cx, cy): if xl > 0: out_x = -abs(max(0.0, min(1.0, xl))) except: - print("[ERROR] Eye Calibration Invalid!") + print("\033[91m[ERROR] Eye Calibration Invalid!\033[0m") out_x = 0.5 out_y = 0.5 try: