1
0
Fork 0

FGComm; logic change to disconnect comm when selected channel set to 0.

It will be reconnected if PTT is set; and not disconnected until selected channel is again set to 0.
This commit is contained in:
Richard Harrison 2019-03-20 15:13:11 +01:00
parent b42969ae91
commit b9dc64ab87

View file

@ -331,9 +331,15 @@ void FGCom::setupCommFrequency(int channel) {
channel = _selected_comm_node->getIntValue();
}
}
// always fallback to comm 1
// disconnect if channel set to 0
if (channel < 1) {
channel = 1;
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as channel 0 " << _currentCallIdent);
_currentCallIdent = -1;
}
_currentCommFrequency = 0;
return;
}
if (channel > 0)
@ -373,6 +379,16 @@ void FGCom::connectToCommFrequency() {
_currentCallFrequency = 0;
}
// don't connected (and disconnect if already connected) when tuned freq is 0
if (_currentCommFrequency < 1) {
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
_currentCallIdent = -1;
}
return;
}
if (_currentCallFrequency != _currentCommFrequency || _currentCallIdent == -1) {
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);