[AFV] Ref T739, check if COM integration is used and make sure to use TX/RX defaults if NOT

There was a bug that COM integration was used although it was disabled
This commit is contained in:
Klaus Basan
2019-10-16 17:33:38 +02:00
parent 725a798cba
commit f980fd02d5
4 changed files with 31 additions and 12 deletions

View File

@@ -9,6 +9,7 @@
#include "afvclient.h"
#include "blackcore/context/contextownaircraft.h"
#include "blackcore/context/contextnetwork.h"
#include "blackcore/context/contextsimulator.h"
#include "blackcore/application.h"
#include "blacksound/audioutilities.h"
#include "blackmisc/audio/audiodeviceinfolist.h"
@@ -784,7 +785,8 @@ namespace BlackCore
if (hasContext())
{
// for pilot client
this->updateFromOwnAircraft(sApp->getIContextOwnAircraft()->getOwnAircraft(), false);
const CSimulatedAircraft aircraft = sApp->getIContextOwnAircraft()->getOwnAircraft();
this->updateFromOwnAircraft(aircraft, false);
// disconnect if NOT connected
this->autoLogoffWithoutFsdNetwork();
@@ -845,10 +847,25 @@ namespace BlackCore
transceiverCom1.frequencyHz = this->getAliasFrequencyHz(f1);
transceiverCom2.frequencyHz = this->getAliasFrequencyHz(f2);
const bool tx1 = com1.isTransmitEnabled();
const bool rx1 = com1.isReceiveEnabled();
const bool tx2 = com2.isTransmitEnabled(); // we only allow one (1) transmit
const bool rx2 = com2.isReceiveEnabled();
bool tx1 = true;
bool rx1 = true;
bool tx2 = false;
bool rx2 = true;
// make sure to use defaults with COM integration disabled
if (hasContext())
{
const bool integrated = sApp->getIContextSimulator()->getSimulatorSettings().isComIntegrated();
m_integratedComUnit = integrated;
}
if (m_integratedComUnit)
{
tx1 = com1.isTransmitEnabled();
rx1 = com1.isReceiveEnabled();
tx2 = com2.isTransmitEnabled(); // we only allow one (1) transmit
rx2 = com2.isReceiveEnabled();
}
// enable, we currently treat receive as enable
// flight sim cockpits normally use rx and tx
@@ -965,7 +982,7 @@ namespace BlackCore
bool CAfvClient::hasContext()
{
return sApp && !sApp->isShuttingDown() && sApp->getIContextOwnAircraft() && sApp->getIContextNetwork();
return sApp && !sApp->isShuttingDown() && sApp->getIContextOwnAircraft() && sApp->getIContextNetwork() && sApp->getIContextSimulator();
}
bool CAfvClient::setOutputVolumeDb(double valueDb)

View File

@@ -184,7 +184,7 @@ namespace BlackCore
//! \threadsafe
//! @{
Q_INVOKABLE void setLoopBack(bool on) { m_loopbackOn = on; }
Q_INVOKABLE bool isLoopback() const { return m_loopbackOn; }
Q_INVOKABLE bool isLoopback() const { return m_loopbackOn; }
//! @}
//! Input volume in dB, +-18dB
@@ -324,7 +324,9 @@ namespace BlackCore
std::atomic_int m_connectMismatches { 0 };
std::atomic_bool m_isStarted { false };
std::atomic_bool m_loopbackOn { false };
std::atomic_bool m_winCoInitialized { false }; //!< Windows only CoInitializeEx
std::atomic_bool m_winCoInitialized { false }; //!< Windows only CoInitializeEx
std::atomic_bool m_integratedComUnit {false}; //!< is COM unit sychr
QDateTime m_startDateTimeUtc;
double m_inputVolumeDb = 0.0;

View File

@@ -298,7 +298,7 @@ namespace BlackCore
return changed;
}
bool CContextOwnAircraft::updateCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const CTransponder &transponder, const CIdentifier &originator)
bool CContextOwnAircraft::updateCockpit(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder, const CIdentifier &originator)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; }
bool changed;

View File

@@ -319,9 +319,9 @@ namespace BlackGui
void CSettingsSimulatorComponent::onApplyComSync()
{
bool ok = false;
CSimulatorSettings settings = getSimulatorSettings(ok);
CSimulatorSettings settings = this->getSimulatorSettings(ok);
if (!ok || !settings.setComIntegrated(ui->cb_ComSync->isChecked())) { return; }
setSimulatorSettings(settings);
this->setSimulatorSettings(settings);
}
void CSettingsSimulatorComponent::onApplyCGSource()
@@ -330,7 +330,7 @@ namespace BlackGui
const CSimulatorSettings::CGSource source = ui->comp_CGSourceSelector->getValue();
CSimulatorSettings settings = getSimulatorSettings(ok);
if (!ok || !settings.setCGSource(source)) { return; }
setSimulatorSettings(settings);
this->setSimulatorSettings(settings);
}
void CSettingsSimulatorComponent::onApplyRecordGnd()