1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

GCS\gpsdisplay: updated gui output, more data parsed

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1249 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
sambas 2010-08-09 06:41:10 +00:00 committed by sambas
parent 9a5a34a323
commit 61d0626bcf
5 changed files with 51 additions and 2 deletions

Binary file not shown.

View File

@ -87,6 +87,8 @@ GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent)
parser=new NMEAParser();
connect(parser,SIGNAL(sv(int)),this,SLOT(setSVs(int)));
connect(parser,SIGNAL(position(double,double,double)),this,SLOT(setPosition(double,double,double)));
connect(parser,SIGNAL(speedheading(double,double)),this,SLOT(setSpeedHeading(double,double)));
connect(parser,SIGNAL(datetime(double,double)),this,SLOT(setDateTime(double,double)));
}
@ -95,6 +97,34 @@ GpsDisplayWidget::~GpsDisplayWidget()
delete widget;
}
void GpsDisplayWidget::setSpeedHeading(double speed, double heading)
{
QString temp = "Speed: ";
temp.append(QString::number(speed,'g',10));
temp.append(" Heaging: ");
temp.append(QString::number(heading,'g',10));
widget->speed_label->setText(QString::number(speed,'g',10));
widget->speed_label->adjustSize();
widget->bear_label->setText(QString::number(heading,'g',10));
widget->bear_label->adjustSize();
widget->textBrowser->append(temp);
}
void GpsDisplayWidget::setDateTime(double date, double time)
{
QString temp = "Date: ";
temp.append(QString::number(date,'g',10));
temp.append(" Time: ");
temp.append(QString::number(time,'g',10));
widget->gdate_label->setText(QString::number(date,'g',10));
widget->gdate_label->adjustSize();
widget->gtime_label->setText(QString::number(time,'g',10));
widget->gdate_label->adjustSize();
widget->textBrowser->append(temp);
}
void GpsDisplayWidget::setSVs(int sv)
{
QString temp = "Fix: Sats: ";
@ -111,8 +141,13 @@ void GpsDisplayWidget::setPosition(double lat, double lon, double alt)
temp.append(QString::number(lon,'g',10));
temp.append(" ");
temp.append(QString::number(alt,'g',10));
widget->label->setText(temp);
widget->label->adjustSize();
widget->lat_label->setText(QString::number(lat,'g',10));
widget->lat_label->adjustSize();
widget->long_label->setText(QString::number(lon,'g',10));
widget->long_label->adjustSize();
//widget->alt_label->setText(QString::number(alt,'g',10));
//widget->alt_label->adjustSize();
widget->textBrowser->append(temp);
}

View File

@ -56,6 +56,8 @@ private slots:
void connectButtonClicked();
void setSVs(int);
void setPosition(double, double, double);
void setDateTime(double, double);
void setSpeedHeading(double, double);
private:
Ui_GpsDisplayWidget* widget;

View File

@ -263,6 +263,7 @@ void NMEAParser::nmeaProcessGPGGA(char* packet)
QString* nmeaString = new QString( packet );
QStringList tokenslist = nmeaString->split(",");
GpsData.GPStime = tokenslist.at(1).toDouble();
GpsData.Latitude = tokenslist.at(2).toDouble();
int deg = (int)GpsData.Latitude/100;
double min = ((GpsData.Latitude)-(deg*100))/60.0;
@ -285,6 +286,8 @@ void NMEAParser::nmeaProcessGPGGA(char* packet)
GpsData.GeoidSeparation = tokenslist.at(11).toDouble();
emit position(GpsData.Latitude,GpsData.Longitude,GpsData.Altitude);
emit sv(GpsData.SV);
emit datetime(GpsData.GPSdate,GpsData.GPStime);
}
/**
@ -306,9 +309,13 @@ void NMEAParser::nmeaProcessGPRMC(char* packet)
QString* nmeaString = new QString( packet );
QStringList tokenslist = nmeaString->split(",");
GpsData.GPStime = tokenslist.at(1).toDouble();
GpsData.Groundspeed = tokenslist.at(7).toDouble();
GpsData.Groundspeed = GpsData.Groundspeed*0.51444;
GpsData.Heading = tokenslist.at(8).toDouble();
GpsData.GPSdate = tokenslist.at(9).toDouble();
emit datetime(GpsData.GPSdate,GpsData.GPStime);
emit speedheading(GpsData.Groundspeed,GpsData.Heading);
}

View File

@ -49,6 +49,9 @@ typedef struct struct_GpsData
double HDOP;
double VDOP;
double GeoidSeparation;
double GPStime;
double GPSdate;
}GpsData_t;
class NMEAParser: public QObject
@ -75,6 +78,8 @@ public:
signals:
void sv(int);
void position(double,double,double);
void datetime(double,double);
void speedheading(double,double);
private slots:
};