mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Updated PFD to use the new GPSPosition object for GPS information.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1488 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
1553ca6799
commit
e74fc394e7
@ -51,6 +51,7 @@ PFDGadgetWidget::PFDGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
attitudeObj = NULL;
|
||||
headingObj = NULL;
|
||||
gcsBatteryObj = NULL;
|
||||
gpsObj = NULL;
|
||||
compassBandWidth = 0;
|
||||
pfdError = true;
|
||||
hqFonts = false;
|
||||
@ -108,6 +109,9 @@ void PFDGadgetWidget::connectNeedles() {
|
||||
if (gcsBatteryObj != NULL)
|
||||
disconnect(gcsBatteryObj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateBattery(UAVObject*)));
|
||||
|
||||
if (gpsObj != NULL)
|
||||
disconnect(gpsObj,SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateGPS(UAVObject*)));
|
||||
|
||||
// Safeguard: if artwork did not load properly, don't go further
|
||||
if (pfdError)
|
||||
return;
|
||||
@ -128,6 +132,15 @@ void PFDGadgetWidget::connectNeedles() {
|
||||
qDebug() << "Error: Object is unknown (PositionActual).";
|
||||
}
|
||||
|
||||
if (gcsGPSStats) {
|
||||
gpsObj = dynamic_cast<UAVDataObject*>(objManager->getObject("GPSPosition"));
|
||||
if (gpsObj != NULL) {
|
||||
connect(gpsObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateGPS(UAVObject*)));
|
||||
} else {
|
||||
qDebug() << "Error: Object is unknown (GPSPosition).";
|
||||
}
|
||||
}
|
||||
|
||||
if (gcsTelemetryArrow || gcsTelemetryStats ) {
|
||||
// Only register if the PFD wants link stats/status
|
||||
gcsTelemetryObj = dynamic_cast<UAVDataObject*>(objManager->getObject("GCSTelemetryStats"));
|
||||
@ -149,6 +162,23 @@ void PFDGadgetWidget::connectNeedles() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Updates the GPS stats
|
||||
*/
|
||||
void PFDGadgetWidget::updateGPS(UAVObject *object1) {
|
||||
UAVObjectField* field = object1->getField(QString("Satellites"));
|
||||
UAVObjectField* field1 = object1->getField(QString("HDOP"));
|
||||
if (field && field1) {
|
||||
QString s = QString("GPS: ") + field->getValue().toString() + "\nHDP: "
|
||||
+ field1->getValue().toString();
|
||||
if (s != satString) {
|
||||
gcsGPSStats->setPlainText(s);
|
||||
satString = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Updates the link stats
|
||||
*/
|
||||
@ -256,20 +286,6 @@ void PFDGadgetWidget::updateHeading(UAVObject *object1) {
|
||||
altitudeTarget = floor(field->getDouble()*10)/10*altitudeScaleHeight/30;
|
||||
}
|
||||
|
||||
// GPS Stats
|
||||
if (gcsGPSStats) {
|
||||
field = object1->getField(QString("Satellites"));
|
||||
UAVObjectField* field1 = object1->getField(QString("HDOP"));
|
||||
if (field && field1) {
|
||||
QString s = QString("GPS: ") + field->getValue().toString() + "\nHDP: "
|
||||
+ field1->getValue().toString();
|
||||
if (s != satString) {
|
||||
gcsGPSStats->setPlainText(s);
|
||||
satString = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dialTimer.isActive())
|
||||
dialTimer.start(); // Rearm the dial Timer which might be stopped.
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
public slots:
|
||||
void updateAttitude(UAVObject *object1);
|
||||
void updateHeading(UAVObject *object1);
|
||||
void updateGPS(UAVObject *object1);
|
||||
void updateAirspeed(UAVObject *object1);
|
||||
void updateAltitude(UAVObject *object1);
|
||||
void updateBattery(UAVObject *object1);
|
||||
@ -126,6 +127,7 @@ private:
|
||||
// Name of the fields to read when an update is received:
|
||||
UAVDataObject* attitudeObj;
|
||||
UAVDataObject* headingObj;
|
||||
UAVDataObject* gpsObj;
|
||||
UAVDataObject* gcsTelemetryObj;
|
||||
UAVDataObject* gcsBatteryObj;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user