sistemato l'heading nella gestione dei target
This commit is contained in:
parent
5417fc1250
commit
e69ea0d069
@ -42,8 +42,6 @@ def build_tgtset_from_target_state(target: Target) -> str:
|
||||
Builds the 'tgtset' command from a target's CURRENT dynamic state.
|
||||
This is used for continuous updates during simulation.
|
||||
"""
|
||||
# Note: We do not include qualifiers like /s or /t in continuous updates
|
||||
# as they are typically set only at initialization.
|
||||
params = [
|
||||
target.target_id,
|
||||
f"{target.current_range_nm:.2f}",
|
||||
@ -52,13 +50,14 @@ def build_tgtset_from_target_state(target: Target) -> str:
|
||||
f"{target.current_heading_deg:.2f}",
|
||||
f"{target.current_altitude_ft:.2f}",
|
||||
]
|
||||
qualifiers = ["/s" if target.active else "/-s", "/t" if target.traceable else "/-t"]
|
||||
if hasattr(target, "restart") and getattr(target, "restart", False):
|
||||
qualifiers.append("/r")
|
||||
|
||||
command_parts = ["tgtset"] + [str(p) for p in params]
|
||||
command_parts = ["tgtset"] + [str(p) for p in params] + qualifiers
|
||||
full_command = " ".join(command_parts)
|
||||
|
||||
# We lower the log level to SPAM/VERBOSE if available, or DEBUG,
|
||||
# to avoid flooding the log during live simulation.
|
||||
logger.debug(f"Built state update command: {full_command!r}")
|
||||
logger.debug(f"Built command: {full_command!r}")
|
||||
return full_command
|
||||
|
||||
|
||||
|
||||
@ -200,7 +200,7 @@ class PPIDisplay(ttk.Frame):
|
||||
# )
|
||||
# except Exception:
|
||||
# pass
|
||||
#except Exception:
|
||||
# except Exception:
|
||||
# pass
|
||||
|
||||
for target in self.active_targets:
|
||||
|
||||
@ -596,7 +596,7 @@ class SfpDebugWindow(tk.Toplevel):
|
||||
temp_target.current_altitude_ft = alt_ft
|
||||
|
||||
# 3. Build the command string
|
||||
command_str = command_builder.build_tgtinit(temp_target)
|
||||
command_str = command_builder.build_tgtset_from_target_state(temp_target)
|
||||
# Ensure the command is trimmed, prefixed with '$' and terminated with a newline
|
||||
command_str = command_str.strip()
|
||||
# if not command_str.startswith("$"):
|
||||
@ -1221,10 +1221,10 @@ class SfpDebugWindow(tk.Toplevel):
|
||||
)
|
||||
# Debug: show parsed target count and sample raw values
|
||||
try:
|
||||
#self._log_to_widget(
|
||||
# self._log_to_widget(
|
||||
# f"PPI: parsed {len(targets)} JSON target(s); current_range={current_range}",
|
||||
# "DEBUG",
|
||||
#)
|
||||
# )
|
||||
for i, tt in enumerate(targets[:6]):
|
||||
try:
|
||||
fx = tt.get("flags", None)
|
||||
@ -1253,12 +1253,12 @@ class SfpDebugWindow(tk.Toplevel):
|
||||
rng_m = rng_nm = az_deg = elev_deg = (
|
||||
None
|
||||
)
|
||||
#msg = (
|
||||
# msg = (
|
||||
# f"PPI RAW[{i}]: flags={fx} x={tx} y={ty} z={tz} | range_m={rng_m:.1f} range_nm={rng_nm:.2f} az={az_deg:.2f}° elev={elev_deg:.2f}°"
|
||||
# if rng_m is not None
|
||||
# else f"PPI RAW[{i}]: flags={fx} x={tx} y={ty} z={tz}"
|
||||
#)
|
||||
#self._log_to_widget(msg, "DEBUG")
|
||||
# )
|
||||
# self._log_to_widget(msg, "DEBUG")
|
||||
except Exception:
|
||||
pass
|
||||
except Exception:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user