bauen klappt wieder, navigation ist kaputt, todo: und fixme: beachten!

This commit is contained in:
2022-08-17 16:37:47 +02:00
parent f2d57cc13f
commit c7cb0d3895
7 changed files with 104 additions and 71 deletions
+62 -61
View File
@@ -11,7 +11,7 @@
#include "menuGPS.h"
MenuGPS::MenuGPS(TinyGPSPlus* gps) {
MenuGPS::MenuGPS(SFE_UBLOX_GNSS* gps) {
this->gps = gps;
this->last_millis = millis();
}
@@ -62,67 +62,68 @@ void MenuGPS::update() {
}
void MenuGPS::printPage(uint8_t page) const {
switch (this->currentPage) {
case 0:
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
if (gps->satellites.isValid() && gps->satellites.value() > 2) {
lcd->printf("Sats: %3.d", gps->satellites.value());
lcd->setCursor(0, 1);
lcd->printf("HDOP: %f", gps->hdop.hdop());
} else {
lcd->printf("Data isn't valid");
lcd->setCursor(0, 1);
lcd->printf("or no GPS signal");
}
}
if (gps->satellites.isValid() && gps->satellites.value() > 2)
std::cout << "Sats: " << gps->satellites.value()
<< "HDOP: " << gps->hdop.hdop() << std::endl;
else
std::cout << "Data isn't valid or no GPS signal" << std::endl;
break;
//FIXME: new gpslib
// switch (this->currentPage) {
// case 0:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// if (gps->satellites.isValid() && gps->satellites.value() > 2) {
// lcd->printf("Sats: %3.d", gps->satellites.value());
// lcd->setCursor(0, 1);
// lcd->printf("HDOP: %f", gps->hdop.hdop());
// } else {
// lcd->printf("Data isn't valid");
// lcd->setCursor(0, 1);
// lcd->printf("or no GPS signal");
// }
// }
// if (gps->satellites.isValid() && gps->satellites.value() > 2)
// std::cout << "Sats: " << gps->satellites.value()
// << "HDOP: " << gps->hdop.hdop() << std::endl;
// else
// std::cout << "Data isn't valid or no GPS signal" << std::endl;
// break;
case 1:
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
if (gps->location.isValid() && gps->satellites.value() > 2) {
lcd->printf("Lat: %9.6f", gps->location.lat());
lcd->setCursor(0, 1);
lcd->printf("Lng: %9.6f", gps->location.lng());
} else {
lcd->printf("Data isn't valid");
lcd->setCursor(0, 1);
lcd->printf("or NO GPS signal");
}
}
if (gps->satellites.isValid() && gps->satellites.value() > 2)
std::cout << "Lat: " << gps->location.lat()
<< "Lng: " << gps->location.lng() << std::endl;
else
std::cout << "Data isn't valid or NO GPS signal" << std::endl;
break;
// case 1:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// if (gps->location.isValid() && gps->satellites.value() > 2) {
// lcd->printf("Lat: %9.6f", gps->location.lat());
// lcd->setCursor(0, 1);
// lcd->printf("Lng: %9.6f", gps->location.lng());
// } else {
// lcd->printf("Data isn't valid");
// lcd->setCursor(0, 1);
// lcd->printf("or NO GPS signal");
// }
// }
// if (gps->satellites.isValid() && gps->satellites.value() > 2)
// std::cout << "Lat: " << gps->location.lat()
// << "Lng: " << gps->location.lng() << std::endl;
// else
// std::cout << "Data isn't valid or NO GPS signal" << std::endl;
// break;
case 2:
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
lcd->printf("Chars processed");
lcd->setCursor(0, 1);
lcd->printf("-> %u", gps->charsProcessed());
}
std::cout << "Chars processed: " << gps->charsProcessed() << std::endl;
break;
// case 2:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// lcd->printf("Chars processed");
// lcd->setCursor(0, 1);
// lcd->printf("-> %u", gps->charsProcessed());
// }
// std::cout << "Chars processed: " << gps->charsProcessed() << std::endl;
// break;
default:
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
lcd->printf("Page: %u", page);
}
std::cout << "Page: " << (int) page << std::endl;
break;
}
// default:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// lcd->printf("Page: %u", page);
// }
// std::cout << "Page: " << (int) page << std::endl;
// break;
// }
}
+3 -3
View File
@@ -12,7 +12,7 @@
#ifndef MENU_GPS_H
#define MENU_GPS_H
#include <TinyGPS++.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#include "menuControl.h"
@@ -27,7 +27,7 @@ class MenuGPS : public MenuControl {
*
* @param gps
*/
MenuGPS(TinyGPSPlus* gps);
MenuGPS(SFE_UBLOX_GNSS* gps);
/**
@@ -79,7 +79,7 @@ class MenuGPS : public MenuControl {
uint8_t currentPage = 0;
void printPage(const uint8_t page) const;
TinyGPSPlus* gps;
SFE_UBLOX_GNSS* gps;
const uint16_t delay = 5000;
uint32_t last_millis = 0;