mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Minor fixes, style
* make sure ATC view is updated when disconnected * prepared rounding, can be enabled at any time
This commit is contained in:
committed by
Mat Sutcliffe
parent
1deeaf39e8
commit
e1498adc8e
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
@@ -50,7 +51,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (tokens.size() < 7)
|
if (tokens.size() < 7)
|
||||||
{
|
{
|
||||||
BlackMisc::CLogMessage(static_cast<AtcDataUpdate *>(nullptr)).warning(u"Wrong number of arguments.");
|
CLogMessage(static_cast<AtcDataUpdate *>(nullptr)).warning(u"Wrong number of arguments.");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -881,8 +881,11 @@ namespace BlackCore
|
|||||||
|
|
||||||
CFrequency freq(atcDataUpdate.m_frequencykHz, CFrequencyUnit::kHz());
|
CFrequency freq(atcDataUpdate.m_frequencykHz, CFrequencyUnit::kHz());
|
||||||
freq.switchUnit(CFrequencyUnit::MHz()); // we would not need to bother, but this makes it easier to identify
|
freq.switchUnit(CFrequencyUnit::MHz()); // we would not need to bother, but this makes it easier to identify
|
||||||
const CLength networkRange(atcDataUpdate.m_visibleRange, CLengthUnit::NM());
|
|
||||||
|
|
||||||
|
// Here we could round to channel spacing, based on https://discordapp.com/channels/539048679160676382/539486489977946112/651514202405601291
|
||||||
|
// CComSystem::roundToChannelSpacing(freq, CComSystem::ChannelSpacing25KHz);
|
||||||
|
|
||||||
|
const CLength networkRange(atcDataUpdate.m_visibleRange, CLengthUnit::NM());
|
||||||
const CLength range = fixAtcRange(networkRange, cs);
|
const CLength range = fixAtcRange(networkRange, cs);
|
||||||
const CCoordinateGeodetic position(atcDataUpdate.m_latitude, atcDataUpdate.m_longitude, 0);
|
const CCoordinateGeodetic position(atcDataUpdate.m_latitude, atcDataUpdate.m_longitude, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
this->clearOnlineViews();
|
this->clearOnlineViews();
|
||||||
|
this->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
#include "blackgui/models/listmodelcallsignobjects.h"
|
#include "blackgui/models/listmodelcallsignobjects.h"
|
||||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
|
|
||||||
class QObject;
|
|
||||||
|
|
||||||
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
|
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -41,7 +39,7 @@ namespace BlackGui
|
|||||||
explicit CSimulatedAircraftListModel(QObject *parent = nullptr);
|
explicit CSimulatedAircraftListModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CSimulatedAircraftListModel() {}
|
virtual ~CSimulatedAircraftListModel() override {}
|
||||||
|
|
||||||
//! Mode
|
//! Mode
|
||||||
void setAircraftMode(AircraftMode mode);
|
void setAircraftMode(AircraftMode mode);
|
||||||
|
|||||||
@@ -585,9 +585,9 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// "extreme" values for which we are surely not on ground
|
// "extreme" values for which we are surely not on ground
|
||||||
if (qAbs(this->getPitch().value(CAngleUnit::deg())) > 20) { if (details) { *details = QStringLiteral("max.pitch"); }; return true; } // some tail wheel aircraft already have 11° pitch on ground
|
if (qAbs(this->getPitch().value(CAngleUnit::deg())) > 20) { if (details) { *details = QStringLiteral("max.pitch"); } return true; } // some tail wheel aircraft already have 11° pitch on ground
|
||||||
if (qAbs(this->getBank().value(CAngleUnit::deg())) > 10) { if (details) { *details = QStringLiteral("max.bank"); }; return true; }
|
if (qAbs(this->getBank().value(CAngleUnit::deg())) > 10) { if (details) { *details = QStringLiteral("max.bank"); } return true; }
|
||||||
if (this->getGroundSpeed() > sureRotateSpeed) { if (details) { *details = u"gs. > vr " % sureRotateSpeed.valueRoundedWithUnit(1); }; return true; }
|
if (this->getGroundSpeed() > sureRotateSpeed) { if (details) { *details = u"gs. > vr " % sureRotateSpeed.valueRoundedWithUnit(1); } return true; }
|
||||||
|
|
||||||
// use the most accurate or reliable guesses here first
|
// use the most accurate or reliable guesses here first
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
@@ -643,7 +643,7 @@ namespace BlackMisc
|
|||||||
if (this->getGroundSpeed() < guessedRotateSpeed)
|
if (this->getGroundSpeed() < guessedRotateSpeed)
|
||||||
{
|
{
|
||||||
this->setOnGround(OnGround, CAircraftSituation::OnGroundByGuessing);
|
this->setOnGround(OnGround, CAircraftSituation::OnGroundByGuessing);
|
||||||
if (details) { *details = QStringLiteral("Guessing, max.guessed gs.") + guessedRotateSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1); };
|
if (details) { *details = QStringLiteral("Guessing, max.guessed gs.") + guessedRotateSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1); }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -726,7 +726,7 @@ namespace BlackMisc
|
|||||||
QString CAircraftSituation::getGroundElevationAndInfo() const
|
QString CAircraftSituation::getGroundElevationAndInfo() const
|
||||||
{
|
{
|
||||||
static const QString n("null");
|
static const QString n("null");
|
||||||
if (m_groundElevationPlane.isNull()) { return n; };
|
if (m_groundElevationPlane.isNull()) { return n; }
|
||||||
|
|
||||||
return m_groundElevationPlane.getAltitude().toQString(true) %
|
return m_groundElevationPlane.getAltitude().toQString(true) %
|
||||||
u" [" % this->getGroundElevationInfoAsString() % u']';
|
u" [" % this->getGroundElevationInfoAsString() % u']';
|
||||||
|
|||||||
Reference in New Issue
Block a user