mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
[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:
@@ -9,6 +9,7 @@
|
|||||||
#include "afvclient.h"
|
#include "afvclient.h"
|
||||||
#include "blackcore/context/contextownaircraft.h"
|
#include "blackcore/context/contextownaircraft.h"
|
||||||
#include "blackcore/context/contextnetwork.h"
|
#include "blackcore/context/contextnetwork.h"
|
||||||
|
#include "blackcore/context/contextsimulator.h"
|
||||||
#include "blackcore/application.h"
|
#include "blackcore/application.h"
|
||||||
#include "blacksound/audioutilities.h"
|
#include "blacksound/audioutilities.h"
|
||||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||||
@@ -784,7 +785,8 @@ namespace BlackCore
|
|||||||
if (hasContext())
|
if (hasContext())
|
||||||
{
|
{
|
||||||
// for pilot client
|
// for pilot client
|
||||||
this->updateFromOwnAircraft(sApp->getIContextOwnAircraft()->getOwnAircraft(), false);
|
const CSimulatedAircraft aircraft = sApp->getIContextOwnAircraft()->getOwnAircraft();
|
||||||
|
this->updateFromOwnAircraft(aircraft, false);
|
||||||
|
|
||||||
// disconnect if NOT connected
|
// disconnect if NOT connected
|
||||||
this->autoLogoffWithoutFsdNetwork();
|
this->autoLogoffWithoutFsdNetwork();
|
||||||
@@ -845,10 +847,25 @@ namespace BlackCore
|
|||||||
transceiverCom1.frequencyHz = this->getAliasFrequencyHz(f1);
|
transceiverCom1.frequencyHz = this->getAliasFrequencyHz(f1);
|
||||||
transceiverCom2.frequencyHz = this->getAliasFrequencyHz(f2);
|
transceiverCom2.frequencyHz = this->getAliasFrequencyHz(f2);
|
||||||
|
|
||||||
const bool tx1 = com1.isTransmitEnabled();
|
bool tx1 = true;
|
||||||
const bool rx1 = com1.isReceiveEnabled();
|
bool rx1 = true;
|
||||||
const bool tx2 = com2.isTransmitEnabled(); // we only allow one (1) transmit
|
bool tx2 = false;
|
||||||
const bool rx2 = com2.isReceiveEnabled();
|
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
|
// enable, we currently treat receive as enable
|
||||||
// flight sim cockpits normally use rx and tx
|
// flight sim cockpits normally use rx and tx
|
||||||
@@ -965,7 +982,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CAfvClient::hasContext()
|
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)
|
bool CAfvClient::setOutputVolumeDb(double valueDb)
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
//! @{
|
//! @{
|
||||||
Q_INVOKABLE void setLoopBack(bool on) { m_loopbackOn = on; }
|
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
|
//! Input volume in dB, +-18dB
|
||||||
@@ -324,7 +324,9 @@ namespace BlackCore
|
|||||||
std::atomic_int m_connectMismatches { 0 };
|
std::atomic_int m_connectMismatches { 0 };
|
||||||
std::atomic_bool m_isStarted { false };
|
std::atomic_bool m_isStarted { false };
|
||||||
std::atomic_bool m_loopbackOn { 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;
|
QDateTime m_startDateTimeUtc;
|
||||||
|
|
||||||
double m_inputVolumeDb = 0.0;
|
double m_inputVolumeDb = 0.0;
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ namespace BlackCore
|
|||||||
return changed;
|
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; }
|
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; }
|
||||||
bool changed;
|
bool changed;
|
||||||
|
|||||||
@@ -319,9 +319,9 @@ namespace BlackGui
|
|||||||
void CSettingsSimulatorComponent::onApplyComSync()
|
void CSettingsSimulatorComponent::onApplyComSync()
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
CSimulatorSettings settings = getSimulatorSettings(ok);
|
CSimulatorSettings settings = this->getSimulatorSettings(ok);
|
||||||
if (!ok || !settings.setComIntegrated(ui->cb_ComSync->isChecked())) { return; }
|
if (!ok || !settings.setComIntegrated(ui->cb_ComSync->isChecked())) { return; }
|
||||||
setSimulatorSettings(settings);
|
this->setSimulatorSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsSimulatorComponent::onApplyCGSource()
|
void CSettingsSimulatorComponent::onApplyCGSource()
|
||||||
@@ -330,7 +330,7 @@ namespace BlackGui
|
|||||||
const CSimulatorSettings::CGSource source = ui->comp_CGSourceSelector->getValue();
|
const CSimulatorSettings::CGSource source = ui->comp_CGSourceSelector->getValue();
|
||||||
CSimulatorSettings settings = getSimulatorSettings(ok);
|
CSimulatorSettings settings = getSimulatorSettings(ok);
|
||||||
if (!ok || !settings.setCGSource(source)) { return; }
|
if (!ok || !settings.setCGSource(source)) { return; }
|
||||||
setSimulatorSettings(settings);
|
this->setSimulatorSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsSimulatorComponent::onApplyRecordGnd()
|
void CSettingsSimulatorComponent::onApplyRecordGnd()
|
||||||
|
|||||||
Reference in New Issue
Block a user