gps now over spi

This commit is contained in:
2022-12-09 14:10:57 +01:00
parent 599f176622
commit f14992c040
26 changed files with 974 additions and 225 deletions
+25 -10
View File
@@ -64,12 +64,12 @@ void MenuGPS::update() {
}
void MenuGPS::printPage() const {
uint8_t fixType = gps->getFixType();
uint8_t fixType = this->gps->getFixType();
switch (this->currentPage) {
case 0: {
uint8_t siv = gps->getSIV();
uint16_t hdop = gps->getHorizontalDOP();
uint8_t siv = this->gps->getSIV();
uint16_t hdop = this->gps->getHorizontalDOP();
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
@@ -88,12 +88,12 @@ void MenuGPS::printPage() const {
<< " HDOP: " << (int) hdop << std::endl;
else
std::cout << "Data isn't valid or no GPS signal" << std::endl;
}
}
break;
case 1: {
int32_t lat = gps->getLatitude();
int32_t lng = gps->getLongitude();
int32_t lat = this->gps->getLatitude();
int32_t lng = this->gps->getLongitude();
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
@@ -112,11 +112,11 @@ void MenuGPS::printPage() const {
<< " Lng: " << lng << std::endl;
else
std::cout << "Data isn't valid or NO GPS signal" << std::endl;
}
}
break;
case 2: {
uint32_t unixEpoch = gps->getUnixEpoch();
uint32_t unixEpoch = this->gps->getUnixEpoch();
if (this->lcd) {
lcd->clear();
@@ -126,7 +126,7 @@ void MenuGPS::printPage() const {
lcd->printf("-> %u", unixEpoch);
}
std::cout << "Unix Epoch: " << (int) unixEpoch << std::endl;
}
}
break;
case 3: {
@@ -150,9 +150,24 @@ void MenuGPS::printPage() const {
std::cout << "NTRIP Client is enabled." << std::endl;
else
std::cout << "NTRIP Client is disabled" << std::endl;
}
}
break;
case 4: {
uint32_t accuracy = this->gps->getHorizontalAccuracy();
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
lcd->printf("Hrizntl Accuracy");
lcd->setCursor(0, 1);
lcd->printf("-> %u", accuracy);
}
std::cout << "Horizontal Accuracy Estimate: " << (int) accuracy << std::endl;
}
break;
default:
if (this->lcd) {
lcd->clear();
+3 -2
View File
@@ -18,8 +18,8 @@ Modi& operator++(Modi& m, int) {
DriveManager::DriveManager(MoveControl *moveControl, bool wifi) {
this->moveControl = moveControl;
SPIClass spiPort(HSPI);
spiPort.begin(UBLOX_GNSS_SPI_SCK, UBLOX_GNSS_SPI_CIPO, UBLOX_GNSS_SPI_COPI, UBLOX_GNSS_SPI_CS);
this->spiPort = new SPIClass(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);
@@ -29,6 +29,7 @@ DriveManager::DriveManager(MoveControl *moveControl, bool wifi) {
DriveManager::~DriveManager() {
delete this->navigation;
delete this->spiPort;
}
void DriveManager::loop() {
+1
View File
@@ -119,6 +119,7 @@ class DriveManager {
MoveControl *moveControl;
DriveModi *currentModusPtr = nullptr;
Navigation* navigation;
SPIClass* spiPort;
};
+10 -7
View File
@@ -61,6 +61,8 @@ void makeMenu(void);
void setup() {
Serial.begin(115200);
// DebugTimes::setConsolOutput(true);
DebugTimes setupTime;
char wifiIndicator = 'X';
mainBattery = new Battery(35, 692000, 218500);
@@ -79,12 +81,12 @@ void setup() {
driveManager = new DriveManager(&moveController, wifiIsActive);
if (wifiIsActive) {
const char* remoteHost = "www.google.com";
std::cout << "Pinging host: " << remoteHost << std::endl;
if (Ping.ping(remoteHost))
std::cout << "Ping successful..." << std::endl;
else
std::cout << "Ping failed. :/" << std::endl;
// const char* remoteHost = "www.google.com";
// std::cout << "Pinging host: " << remoteHost << std::endl;
// if (Ping.ping(remoteHost))
// std::cout << "Ping successful..." << std::endl;
// else
// std::cout << "Ping failed. :/" << std::endl;
if (Network::checkMQTT()) {
DebugMqtt::init(Network::getMqttClient(), Loglevel::debug);
@@ -122,6 +124,8 @@ void setup() {
lcd->print("Press PS-Button");
makeMenu();
setupTime.stopConsol("Setup");
}
void loop() {
@@ -131,7 +135,6 @@ void loop() {
Network::checkMQTT();
wifiTime.stopConsol("WiFi-Time", 5);
}
driveManager->loop();
DebugTimes mainBatteryTime;