ntripClient runs now - gnss to spi

This commit is contained in:
2022-11-29 20:38:46 +01:00
parent e36b6475b8
commit 599f176622
12 changed files with 125 additions and 31 deletions
+44 -7
View File
@@ -11,8 +11,9 @@
#include "menuGPS.h"
MenuGPS::MenuGPS(SFE_UBLOX_GNSS* gps) {
this->gps = gps;
MenuGPS::MenuGPS(DriveManager* driveManager) {
this->gps = driveManager->getNavigation()->getGPS();
this->ntripClient = driveManager->getNavigation()->getNTRIPClient();
this->lastMillis = millis();
}
@@ -33,7 +34,7 @@ void MenuGPS::down() {
}
void MenuGPS::right() {
this->printMenu();
this->yes();
}
void MenuGPS::left() {
@@ -46,11 +47,12 @@ void MenuGPS::no() {
}
void MenuGPS::yes() {
this->runCommand();
this->printMenu();
}
void MenuGPS::printMenu() {
this->printPage(this->currentPage);
this->printPage();
}
void MenuGPS::update() {
@@ -61,7 +63,7 @@ void MenuGPS::update() {
this->lastMillis = millis();
}
void MenuGPS::printPage(uint8_t page) const {
void MenuGPS::printPage() const {
uint8_t fixType = gps->getFixType();
switch (this->currentPage) {
@@ -127,13 +129,48 @@ void MenuGPS::printPage(uint8_t page) const {
}
break;
case 3: {
bool status;
if (this->ntripClient->getClientState() == NTRIPClientStates::pushData)
status = true;
else
status = false;
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
lcd->print("NTRIP Client");
lcd->setCursor(0, 1);
if (status)
lcd->print("enabled");
else
lcd->print("disabled");
}
if (status)
std::cout << "NTRIP Client is enabled." << std::endl;
else
std::cout << "NTRIP Client is disabled" << std::endl;
}
break;
default:
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
lcd->printf("Page: %u", page);
lcd->printf("Page: %u", this->currentPage);
}
std::cout << "Page: " << (int) page << std::endl;
std::cout << "Page: " << (int) this->currentPage << std::endl;
break;
}
}
void MenuGPS::runCommand() const {
switch (this->currentPage) {
case 3:
if (this->ntripClient->getClientState() == NTRIPClientStates::pushData)
this->ntripClient->setActivated(false);
else
this->ntripClient->setActivated(true);
break;
}
}
+6 -2
View File
@@ -15,6 +15,8 @@
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#include "menuControl.h"
#include "driveModi/driveManager.h"
#include "ntripClient.h"
/**
* @brief A class to print informations about the GPS object
@@ -27,7 +29,7 @@ class MenuGPS : public MenuControl {
*
* @param gps
*/
MenuGPS(SFE_UBLOX_GNSS* gps);
MenuGPS(DriveManager* driveManager);
/**
@@ -77,9 +79,11 @@ class MenuGPS : public MenuControl {
private:
const uint8_t countPages = 7;
uint8_t currentPage = 0;
void printPage(const uint8_t page) const;
void printPage() const;
void runCommand() const;
SFE_UBLOX_GNSS* gps;
NTRIPClient* ntripClient;
const uint16_t delay = 5000;
uint32_t lastMillis = 0;