更新 'src/Network/fgcom.cxx'

This commit is contained in:
zhongjin 2022-11-30 20:35:04 +08:00
parent dadc33d703
commit 9c2f4f46ba

View File

@ -470,8 +470,8 @@ void FGCom::connectToCommFrequency() {
// ensure that the current comm is still in range
//zhongjin
SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency()");
SG_LOG(SG_SOUND, SG_INFO, "FGCom: _currentCallFrequency=" << _currentCallFrequency);
//SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency()");
//SG_LOG(SG_SOUND, SG_INFO, "FGCom: _currentCallFrequency=" << _currentCallFrequency);
if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) {
@ -479,9 +479,11 @@ void FGCom::connectToCommFrequency() {
_currentCallFrequency = 0.0;
}
// don't connected (and disconnect if already connected) when tuned freq is 0
if (_currentCommFrequency < 1.0) {
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);
SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
_currentCallIdent = -1;
@ -490,6 +492,7 @@ void FGCom::connectToCommFrequency() {
}
if (_currentCallFrequency != _currentCommFrequency || _currentCallIdent == -1) {
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);
SG_LOG(SG_SOUND, SG_INFO, "FGCom: dump_call_number " << _currentCallIdent);
@ -501,6 +504,7 @@ void FGCom::connectToCommFrequency() {
std::string num = computePhoneNumber(_currentCommFrequency, getAirportCode(_currentCommFrequency));
_processingTimer.stamp();
if (!isInRange(_currentCommFrequency)) {
if (_currentCallIdent != -1) {
SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect call as not in range " << _currentCallIdent);
@ -511,11 +515,14 @@ void FGCom::connectToCommFrequency() {
}
return;
}
else
SG_LOG(SG_SOUND, SG_WARN, "FGCom: frequency");
SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency num=" << num);
if (!num.empty()) {
_currentCallIdent = iaxc_call(num.c_str());
SG_LOG(SG_SOUND, SG_INFO, "FGCom: iaxc_call(" << num << ") _currentCallIdent=" << _currentCallIdent);
if (_currentCallIdent == -1)
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: cannot call " << num.c_str());
else {