Kierunek lotu (odlot/przylot) + poprawki UI częstotliwości
- przełącznik Odlot/Przylot determinuje handoff ATC (odlot: Tower->Departure; przylot: Tower->Ground) - osobne ścieżki handoffu dla odlotu i przylotu - kierunek lotu dodany do kontekstu i promptu (DIRECTION) - częstotliwości w osobnym przewijanym panelu (zawsze z suwakiem) - apt.dat wczytywany w tle od startu (pierwszy klik działa od razu)
This commit is contained in:
1 parent
16b1d7795a
commit
3c32bd97da
1 file changed
+51
-9
@@ -58,6 +58,10 @@ DEFAULT_CONFIG = {
|
||||
"change approved'. Use the 'Airport frequencies' list to give the correct "
|
||||
"frequency for the 'Next expected facility'. If the next facility has several "
|
||||
"frequencies, pick the most plausible one and state it clearly. "
|
||||
"DIRECTION: use the 'Flight phase' field. On DEPARTURE the flow is Delivery->"
|
||||
"Ground->Tower->Departure->Center (so Tower hands off to Departure). On ARRIVAL "
|
||||
"the flow is Center->Approach->Tower->Ground (so Tower hands off to Ground). "
|
||||
"Never hand off to yourself (e.g. Tower must NOT say 'contact Tower'). "
|
||||
"Use the nearby traffic list when issuing traffic advisories "
|
||||
"(e.g. bearing in clock positions and distance). "
|
||||
"Respond with ATC instructions only, no extra commentary."
|
||||
@@ -153,13 +157,23 @@ APT_FREQ_CODES = {
|
||||
}
|
||||
|
||||
# Sluzby ATC, ktore powinny przy przelaczeniu podac nastepna czestotliwosc.
|
||||
# Kolejnosc zyciowa: Delivery -> Ground -> Tower -> Departure -> Center -> Approach.
|
||||
NEXT_FACILITY_HINT = {
|
||||
# Dwie sciezki zalezne od kierunku lotu (odlot / przylot).
|
||||
# Odlot: Delivery -> Ground -> Tower -> Departure -> Center
|
||||
# Przylot: Center -> Approach -> Tower -> Ground
|
||||
NEXT_FACILITY_DEPARTURE = {
|
||||
"Delivery/Clearance": "Ground",
|
||||
"Ground": "Tower",
|
||||
"Tower": "Departure/Tracon",
|
||||
"Tower": "Departure",
|
||||
"Tracon/Approach-Departure": "Center",
|
||||
"Center": "Approach/Tracon",
|
||||
"Center": None,
|
||||
}
|
||||
|
||||
NEXT_FACILITY_ARRIVAL = {
|
||||
"Delivery/Clearance": "Ground",
|
||||
"Ground": None,
|
||||
"Tower": "Ground",
|
||||
"Tracon/Approach-Departure": "Tower",
|
||||
"Center": "Approach",
|
||||
}
|
||||
|
||||
ELEVATION_AGL_DATAREF = "sim/flightmodel/position/y_agl"
|
||||
@@ -208,6 +222,10 @@ class XSayATC:
|
||||
# Sluzba ATC, na ktora bylismy ostatnio nastrojeni (do resetu rozmowy)
|
||||
self._last_facility = None
|
||||
|
||||
# Kierunek lotu (odlot / przylot) — wybierany recznie przez pilota.
|
||||
# Determinuje handoff Tower/Ground/Approach/Departure.
|
||||
self.flight_phase = "departure" # "departure" | "arrival"
|
||||
|
||||
# Czestotliwosci lotnisk z apt.dat (leniwie wczytywane w tle)
|
||||
self._apt_freqs = {} # ICAO -> {kategoria: [freq_khz, ...]}
|
||||
self._apt_loading = False
|
||||
@@ -367,6 +385,11 @@ class XSayATC:
|
||||
ctx["Phase"] = "ground" if on_ground else "airborne"
|
||||
lines.append("Phase: " + ("on ground (taxi/ramp)" if on_ground else "airborne"))
|
||||
|
||||
# Kierunek lotu (odlot / przylot) — wybrany recznie przez pilota
|
||||
ctx["FlightPhase"] = self.flight_phase
|
||||
lines.append("Flight phase (pilot selection): " +
|
||||
("DEPARTURE" if self.flight_phase == "departure" else "ARRIVAL"))
|
||||
|
||||
# Czestotliwosci najblizszego lotniska (do podpowiedzi nastepnej czestotliwosci)
|
||||
icao = self._nearest_airport_icao()
|
||||
if icao:
|
||||
@@ -589,10 +612,12 @@ class XSayATC:
|
||||
return lines
|
||||
|
||||
def _next_facility_hint(self, name):
|
||||
"""Zwraca nastepna sluzbe ATC wg zyciowej kolejnosc, jesli znana."""
|
||||
"""Zwraca nastepna sluzbe ATC wg kierunku lotu (odlot / przylot)."""
|
||||
if not name:
|
||||
return None
|
||||
return NEXT_FACILITY_HINT.get(name)
|
||||
if self.flight_phase == "arrival":
|
||||
return NEXT_FACILITY_ARRIVAL.get(name)
|
||||
return NEXT_FACILITY_DEPARTURE.get(name)
|
||||
|
||||
def _freq_display_lines(self):
|
||||
"""Zwraca (icao, [linie]) czestotliwosci z cache. NIE liczy nic — tylko
|
||||
@@ -1086,6 +1111,15 @@ class XSayATC:
|
||||
|
||||
imgui.text(self.status)
|
||||
|
||||
imgui.separator()
|
||||
# Wybor kierunku lotu (determinuje handoff ATC)
|
||||
imgui.text("Kierunek lotu:")
|
||||
if imgui.radio_button("Odlot", self.flight_phase == "departure"):
|
||||
self.flight_phase = "departure"
|
||||
imgui.same_line()
|
||||
if imgui.radio_button("Przylot", self.flight_phase == "arrival"):
|
||||
self.flight_phase = "arrival"
|
||||
|
||||
imgui.separator()
|
||||
# Czestotliwosci najblizszego lotniska (odswiezane recznie przyciskiem)
|
||||
if imgui.button("Odswiez czestotliwosci"):
|
||||
@@ -1095,9 +1129,13 @@ class XSayATC:
|
||||
imgui.text(f"Czestotliwosci - {icao}:")
|
||||
else:
|
||||
imgui.text_colored("Czestotliwosci: (kliknij Odswiez)", 0.7, 0.7, 0.7, 1.0)
|
||||
if freq_lines:
|
||||
for ln in freq_lines:
|
||||
imgui.text(ln)
|
||||
# Wlasny przewijany obszar, zeby czestotliwosci mialy zawsze suwak
|
||||
with imgui.begin_child("freqs", 0, 120.0, border=True):
|
||||
if freq_lines:
|
||||
for ln in freq_lines:
|
||||
imgui.text(ln)
|
||||
else:
|
||||
imgui.text_colored("(brak danych)", 0.7, 0.7, 0.7, 1.0)
|
||||
|
||||
def _draw_config(self, windowID, refCon):
|
||||
imgui.text("Konfiguracja XSayATC")
|
||||
@@ -1164,6 +1202,10 @@ class XSayATC:
|
||||
def XPluginStart(self):
|
||||
self._ensure_datarefs()
|
||||
|
||||
# Rozpocznij wczytywanie czestotliwosci z apt.dat w tle od razu,
|
||||
# zeby pierwsze klikniecie "Odswiez czestotliwosci" nie musialo czekac.
|
||||
self._ensure_apt_freqs()
|
||||
|
||||
# Komenda PTT (przypisz klawisz w Settings > Keyboard)
|
||||
self._cmd = xp.createCommand("xsayatc/ptt", "XSayATC push-to-talk")
|
||||
xp.registerCommandHandler(self._cmd, self._ptt_handler, 1, None)
|
||||
|
||||
Reference in new issue
Block a user