use callback to save data from gnss module
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
#include "menuGPS.h"
|
||||
|
||||
MenuGPS::MenuGPS(DriveManager* driveManager) {
|
||||
this->gps = driveManager->getNavigation()->getGPS();
|
||||
this->ntripClient = driveManager->getNavigation()->getNTRIPClient();
|
||||
this->navigation = driveManager->getNavigation();
|
||||
this->ntripClient = this->navigation->getNTRIPClient();
|
||||
this->lastMillis = millis();
|
||||
}
|
||||
|
||||
@@ -64,19 +64,20 @@ void MenuGPS::update() {
|
||||
}
|
||||
|
||||
void MenuGPS::printPage() const {
|
||||
uint8_t fixType = this->gps->getFixType();
|
||||
UBX_NAV_PVT_data_t* gpsData = this->navigation->getUbxData();
|
||||
uint8_t fixType = gpsData->fixType;
|
||||
|
||||
switch (this->currentPage) {
|
||||
case 0: {
|
||||
uint8_t siv = this->gps->getSIV();
|
||||
uint16_t hdop = this->gps->getHorizontalDOP();
|
||||
uint8_t siv = gpsData->numSV;
|
||||
uint32_t pDOP = gpsData->pDOP;
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
if (fixType) {
|
||||
lcd->printf("Sats: %3.u", siv);
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->printf("HDOP: %u", hdop);
|
||||
lcd->printf("PDOP: %u", pDOP);
|
||||
} else {
|
||||
lcd->printf("Data isn't valid");
|
||||
lcd->setCursor(0, 1);
|
||||
@@ -85,15 +86,15 @@ void MenuGPS::printPage() const {
|
||||
}
|
||||
if (fixType)
|
||||
std::cout << "Sats: " << (int) siv
|
||||
<< " HDOP: " << (int) hdop << std::endl;
|
||||
<< " PDOP: " << (int) pDOP << std::endl;
|
||||
else
|
||||
std::cout << "Data isn't valid or no GPS signal" << std::endl;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: {
|
||||
int32_t lat = this->gps->getLatitude();
|
||||
int32_t lng = this->gps->getLongitude();
|
||||
int32_t lat = gpsData->lat;
|
||||
int32_t lng = gpsData->lon;
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
@@ -116,7 +117,7 @@ void MenuGPS::printPage() const {
|
||||
break;
|
||||
|
||||
case 2: {
|
||||
uint32_t unixEpoch = this->gps->getUnixEpoch();
|
||||
uint32_t unixEpoch = gpsData->sec;
|
||||
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
@@ -154,7 +155,7 @@ void MenuGPS::printPage() const {
|
||||
break;
|
||||
|
||||
case 4: {
|
||||
uint32_t accuracy = this->gps->getHorizontalAccuracy();
|
||||
uint32_t accuracy = gpsData->hAcc;
|
||||
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "menuControl.h"
|
||||
#include "driveModi/driveManager.h"
|
||||
#include "navigation.h"
|
||||
#include "ntripClient.h"
|
||||
|
||||
/**
|
||||
@@ -82,8 +83,8 @@ class MenuGPS : public MenuControl {
|
||||
void printPage() const;
|
||||
void runCommand() const;
|
||||
|
||||
SFE_UBLOX_GNSS* gps;
|
||||
NTRIPClient* ntripClient;
|
||||
Navigation* navigation;
|
||||
|
||||
const uint16_t delay = 5000;
|
||||
uint32_t lastMillis = 0;
|
||||
|
||||
Reference in New Issue
Block a user