Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix aircraft undefined at sim startup #131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +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()
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.")
Expand Down Expand Up @@ -68,6 +72,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
Expand Down
Loading