Skip to content

Commit

Permalink
- Allow COMn_VLT to be literal strings "true" or "false"
Browse files Browse the repository at this point in the history
- FGFS: simplify protocol file.
  the "operable" property is a common one and honors powered, turned on and serviceable.
  see: https://forum.flightgear.org/viewtopic.php?p=382015#p382015
- FGFS: Support standard squelch property
  • Loading branch information
hbeni committed Feb 19, 2021
1 parent 6e5b5a2 commit 8eae6ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
35 changes: 6 additions & 29 deletions client/fgfs/Protocol/fgcom-mumble.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,13 @@
<format>COM1_CWKHZ=%s</format>
<node>/instrumentation/comm[0]/frequencies/selected-channel-width-khz</node>
</chunk>
<chunk>
<name>com1-powered</name>
<type>string</type>
<format>COM1_VLT=%s</format> <!-- in volts -->
<node>/system/electrical/outputs/comm[0]</node>
</chunk>
<chunk>
<name>com1-powerbutton</name>
<type>string</type>
<format>COM1_PBT=%s</format> <!-- 0=inactive, 1=active -->
<node>/instrumentation/comm[0]/power-btn</node>
<node>/instrumentation/comm[0]/operable</node>
<!-- ^^ we use the operable property because it honors all conditions (powered, serviceable, turned on) --->
</chunk>
<chunk>
<name>com1-serviceable</name>
<type>string</type>
<format>COM1_SRV=%s</format> <!-- 0=failed, 1=operable -->
<node>/instrumentation/comm[0]/serviceable</node>
</chunk>
<chunk>
<name>com1-ptt</name>
<type>string</type>
<format>COM1_PTT=%s</format> <!-- 0=inactive, 1=active -->
Expand All @@ -94,7 +82,7 @@
<name>com1-squelch</name>
<type>string</type>
<format>COM1_SQC=%s</format> <!-- 0.0=cutoff nothing, 1.0=cutoff any -->
<node>/instrumentation/comm[0]/squelch</node>
<node>/instrumentation/comm[0]/cutoff-signal-quality</node>
</chunk>

<!-- COM 2 -->
Expand All @@ -110,23 +98,12 @@
<format>COM2_CWKHZ=%s</format>
<node>/instrumentation/comm[1]/frequencies/selected-channel-width-khz</node>
</chunk>
<chunk>
<name>com2-powered</name>
<type>string</type>
<format>COM2_VLT=%s</format> <!-- in volts -->
<node>/system/electrical/outputs/comm[1]</node>
</chunk>
<chunk>
<name>com2-powerbutton</name>
<type>string</type>
<format>COM2_PBT=%s</format> <!-- 0=inactive, 1=active -->
<node>/instrumentation/comm[1]/power-btn</node>
</chunk>
<chunk>
<name>com2-serviceable</name>
<type>string</type>
<format>COM2_SRV=%s</format> <!-- 0=failed, 1=operable -->
<node>/instrumentation/comm[1]/serviceable</node>
<node>/instrumentation/comm[1]/operable</node>
<!-- ^^ we use the operable property because it honors all conditions (powered, serviceable, turned on) --->
</chunk>
<chunk>
<name>com2-ptt</name>
Expand All @@ -150,7 +127,7 @@
<name>com2-squelch</name>
<type>string</type>
<format>COM1_SQC=%s</format> <!-- 0.0=cutoff nothing, 1.0=cutoff any -->
<node>/instrumentation/comm[1]/squelch</node>
<node>/instrumentation/comm[1]/cutoff-signal-quality</node>
</chunk>


Expand Down
7 changes: 6 additions & 1 deletion client/mumble-plugin/lib/io_UDPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,12 @@ std::map<int, fgcom_udp_parseMsg_result> fgcom_udp_parseMsg(char buffer[MAXLINE]
}
if (radio_var == "VLT") {
float oldValue = fgcom_local_client[iid].radios[radio_id].volts;
fgcom_local_client[iid].radios[radio_id].volts = std::stof(token_value);
if (token_value == "true" || token_value == "false") {
// support literal strings in case aircraft sends just a boolean as string
fgcom_local_client[iid].radios[radio_id].volts = (token_value == "true")? true : false;
} else {
fgcom_local_client[iid].radios[radio_id].volts = std::stof(token_value);
}
// do not send right now: if (fgcom_local_client[iid].radios[radio_id].volts != oldValue ) parseResult[iid].radioData.insert(radio_id);
}
if (radio_var == "PBT") {
Expand Down

0 comments on commit 8eae6ac

Please sign in to comment.