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
|
||||
|
||||
|
||||
|
||||
@ -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("$"):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user