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;
+4 -1
View File
@@ -17,7 +17,10 @@ Modi& operator++(Modi& m, int) {
DriveManager::DriveManager(MoveControl *moveControl, bool wifi) {
this->moveControl = moveControl;
this->navigation = new Navigation();
SPIClass spiPort(HSPI);
spiPort.begin(UBLOX_GNSS_SPI_SCK, UBLOX_GNSS_SPI_CIPO, UBLOX_GNSS_SPI_COPI, UBLOX_GNSS_SPI_CS);
this->navigation = new Navigation(spiPort, UBLOX_GNSS_SPI_CS);
if (wifi)
this->navigation->initNtrip(NTRIP_HOST, NTRIP_PORT, NTRIP_MOUNT_POINT, NTRIP_USER, NTRIP_PASSWORD);
// if (wifi)
+2 -5
View File
@@ -12,16 +12,13 @@
#ifndef DRIVE_MANAGER_H
#define DRIVE_MANAGER_H
//GPS Serial Pins
#define GPS_RX 17
#define GPS_TX 16
#define GPS_BAUD 9600
#include <Arduino.h>
#include <SPI.h>
#include "moveControl.h"
#include "driveModi/driveModi.h"
#include "navigation.h"
#include "config.h"
#include "networkConfig.h"
#include "debugTimes.h"
+1 -1
View File
@@ -253,7 +253,7 @@ void makeMenu() {
MenuCaptureRoute* cap_m = new MenuCaptureRoute(driveManager);
MenuAutopilot* auto_m = new MenuAutopilot(driveManager);
MenuTestMode* test_m = new MenuTestMode(driveManager);
MenuGPS* gps_m = new MenuGPS(driveManager->getNavigation()->getGPS());
MenuGPS* gps_m = new MenuGPS(driveManager);
MenuAkku* akku_m = new MenuAkku(mainBattery);
// Set Menus on LCD