mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-02-06 02:52:42 +08:00
[PPRZ Center] Add @AIRCRAFT placeholder constant.
When you use @AIRCRAFT as a constant parameter to a program in your session, it will be automatically replaced by the name selected in the A/C dropdown combo box of the Paparazzi Center. This makes it possible to create generic sessions that start programs which need to know which aircraft is of interest. For example settings. This is a possible solution to the #1215 issue.
This commit is contained in:
@@ -181,6 +181,19 @@
|
||||
<program name="Messages"/>
|
||||
</session>
|
||||
|
||||
<session name="Messages and Settings">
|
||||
<program name="Data Link">
|
||||
<arg flag="-d" constant="/dev/ttyUSB0"/>
|
||||
<arg flag="-s" constant="57600"/>
|
||||
</program>
|
||||
<program name="Server">
|
||||
<arg flag="-n"/>
|
||||
</program>
|
||||
<program name="Messages"/>
|
||||
<program name="Settings">
|
||||
<arg flag="-ac" constant="@AIRCRAFT"/>
|
||||
</program>
|
||||
</session>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
@@ -244,7 +244,9 @@ let supervision = fun ?file gui log (ac_combo : Gtk_tools.combo) (target_combo :
|
||||
(fun arg ->
|
||||
let constant =
|
||||
try double_quote (Xml.attrib arg "constant") with _ -> "" in
|
||||
p := sprintf "%s %s %s" !p (ExtXml.attrib arg "flag") constant)
|
||||
let real_constant =
|
||||
if constant = "@AIRCRAFT" then (Gtk_tools.combo_value ac_combo) else constant in
|
||||
p := sprintf "%s %s %s" !p (ExtXml.attrib arg "flag") real_constant)
|
||||
(Xml.children program);
|
||||
run_and_monitor ?file gui log name !p)
|
||||
(Xml.children session)
|
||||
|
||||
Reference in New Issue
Block a user