From c4c0e9abdec92b98d12021c4f364c9021c32144e Mon Sep 17 00:00:00 2001 From: smitty Date: Mon, 25 Nov 2024 20:02:19 -0500 Subject: [PATCH 1/2] fix aircraft undefined at sim startup --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index 259016e..94c3d1c 100644 --- a/main.py +++ b/main.py @@ -21,6 +21,7 @@ def connect_to_simulator(offline: bool): while not is_connected and not offline: try: sm = CustomSimconnect() + print(f"Connected to simulator") is_connected = True except Exception: print(f"Connection to simulator not possible. Retry in {waiting_time}s.") @@ -68,6 +69,7 @@ def run_aircraft_configuration(global_storage: GlobalStorage): vr = global_storage.mobiflight_variable_requests sq = global_storage.system_requests current_aircraft = "None" + aircraft = "" base_matching = global_storage.base_matching # Main program loop which checks for aircraft change # and reads the simvars for loaded configuration From 085c5550e0970e16a9e2eaf9be6a7851b0637f9f Mon Sep 17 00:00:00 2001 From: smitty Date: Wed, 27 Nov 2024 12:22:09 -0500 Subject: [PATCH 2/2] add timer --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 94c3d1c..d0c8138 100644 --- a/main.py +++ b/main.py @@ -14,14 +14,17 @@ from aircraftstaterequest import CustomSimconnect, SystemStateRequest + def connect_to_simulator(offline: bool): + start = time.time() sm = None is_connected = False waiting_time = 10 while not is_connected and not offline: try: sm = CustomSimconnect() - print(f"Connected to simulator") + end = time.time() + print(f"Connected to simulator after {int(end-start)}s") is_connected = True except Exception: print(f"Connection to simulator not possible. Retry in {waiting_time}s.")