mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Allow to enable trace for P3D/FSX SB offsets
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "blackmisc/aviation/aircraftparts.h"
|
||||
#include "blackmisc/aviation/aircraftenginelist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include <tuple>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -374,5 +376,14 @@ namespace BlackSimPlugin
|
||||
dtb(lightBeacon), dtb(lightNav), dtb(lightLogo), dtb(lightRecognition),
|
||||
dtb(lightCabin));
|
||||
}
|
||||
|
||||
QString DataDefinitionClientAreaSb::toQString() const
|
||||
{
|
||||
return u"0 (running): " % QString::number(data[0]) %
|
||||
u" 1 (connected): " % QString::number(data[1]) %
|
||||
u" 17 (standby): " % QString::number(data[17]) %
|
||||
u" 19 (ident): " % QString::number(data[19]);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -227,6 +227,9 @@ namespace BlackSimPlugin
|
||||
data[17] = 1; // 1..standby, 0..mode C
|
||||
data[19] = 0; // no ident
|
||||
}
|
||||
|
||||
//! Values
|
||||
QString toQString() const;
|
||||
};
|
||||
|
||||
//! Client areas
|
||||
|
||||
@@ -208,6 +208,14 @@ namespace BlackSimPlugin
|
||||
this->triggerAutoTraceSendId();
|
||||
CLogMessage(this).warning(u"Setting transponder mode failed (SB offsets)");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_logSbOffsets)
|
||||
{
|
||||
const QString lm = "SB sent: ident " % QString::number(ident) % u" standby " % QString::number(standby);
|
||||
CLogMessage(this).info(lm);
|
||||
}
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
else if (m_useFsuipc && m_fsuipc)
|
||||
@@ -864,6 +872,11 @@ namespace BlackSimPlugin
|
||||
void CSimulatorFsxCommon::updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea)
|
||||
{
|
||||
if (m_skipCockpitUpdateCycles > 0) { return; }
|
||||
|
||||
// log SB offset
|
||||
if (m_logSbOffsets) { CLogMessage(this).info(u"SB from sim: " % sbDataArea.toQString()); }
|
||||
|
||||
// SB XPDR mode
|
||||
CTransponder::TransponderMode newMode = CTransponder::StateIdent;
|
||||
if (!sbDataArea.isIdent())
|
||||
{
|
||||
@@ -875,6 +888,7 @@ namespace BlackSimPlugin
|
||||
CTransponder xpdr = myAircraft.getTransponder();
|
||||
xpdr.setTransponderMode(newMode);
|
||||
this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), xpdr, this->identifier());
|
||||
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::updateOwnAircraftFromSimulatorFsuipc(const CTransponder &xpdr)
|
||||
@@ -1344,6 +1358,15 @@ namespace BlackSimPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
// .driver sblog on|off
|
||||
if (parser.matchesPart(1, "sblog") && parser.hasPart(2))
|
||||
{
|
||||
const bool on = parser.toBool(2);
|
||||
m_logSbOffsets = on;
|
||||
CLogMessage(this, CLogCategory::cmdLine()).info(u"SB log. offsets is '%1'") << boolToOnOff(on);
|
||||
return true;
|
||||
}
|
||||
|
||||
return CSimulatorFsCommon::parseDetails(parser);
|
||||
}
|
||||
|
||||
@@ -1353,6 +1376,7 @@ namespace BlackSimPlugin
|
||||
CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"});
|
||||
CSimpleCommandParser::registerCommand({".drv sendid on|off", "Trace simConnect sendId on|off"});
|
||||
CSimpleCommandParser::registerCommand({".drv sboffsets on|off", "SB offsets via simConnect on|off"});
|
||||
CSimpleCommandParser::registerCommand({".drv sblog on|off", "SB offsets logging on|off"});
|
||||
}
|
||||
|
||||
CCallsign CSimulatorFsxCommon::getCallsignForPendingProbeRequests(DWORD requestId, bool remove)
|
||||
|
||||
@@ -584,6 +584,7 @@ namespace BlackSimPlugin
|
||||
bool m_simConnected = false; //!< Is simulator connected?
|
||||
bool m_simSimulating = false; //!< Simulator running?
|
||||
bool m_useSbOffsets = true; //!< with SB offsets
|
||||
bool m_logSbOffsets = false; //!< log SB offsets
|
||||
bool m_traceSendId = false; //!< trace the send ids, meant for debugging
|
||||
bool m_useAddSimulatedObj = false; //!< simulated object use if AI Non ATC object fails
|
||||
qint64 m_traceAutoUntilTs = -1; //!< allows to automatically trace for some time
|
||||
@@ -594,9 +595,9 @@ namespace BlackSimPlugin
|
||||
int m_ownAircraftUpdateCycles = 0; //!< own aircraft update
|
||||
|
||||
// tracing dispatch performance
|
||||
int m_dispatchErrors = 0; //!< number of dispatched failed, \sa dispatch
|
||||
int m_dispatchProcCount = 0; //!< number of dispatchProc counts
|
||||
int m_dispatchProcEmptyCount = 0; //!< number dispatchProc doing nothing
|
||||
int m_dispatchErrors = 0; //!< number of dispatched failed, \sa dispatch
|
||||
int m_dispatchProcCount = 0; //!< number of dispatchProc counts
|
||||
int m_dispatchProcEmptyCount = 0; //!< number dispatchProc doing nothing
|
||||
qint64 m_dispatchTimeMs = -1; //!< \sa ISimulator::getStatisticsSimulatorSpecific
|
||||
qint64 m_dispatchMaxTimeMs = -1; //!< \sa ISimulator::getStatisticsSimulatorSpecific
|
||||
qint64 m_dispatchProcTimeMs = -1; //!< \sa ISimulator::getStatisticsSimulatorSpecific
|
||||
@@ -609,7 +610,7 @@ namespace BlackSimPlugin
|
||||
|
||||
// sending via SimConnect
|
||||
QList<TraceFsxSendId> m_sendIdTraces; //!< Send id traces for debugging, latest first
|
||||
int m_receiveExceptionCount = 0; //!< exceptions
|
||||
int m_receiveExceptionCount = 0; //!< exceptions
|
||||
int m_requestSimObjectDataCount = 0; //!< requested SimObjects
|
||||
|
||||
// settings
|
||||
|
||||
Reference in New Issue
Block a user