bug fixes

This commit is contained in:
2023-01-04 00:17:39 +01:00
parent 51ba70e297
commit 15689bf56b
5 changed files with 25 additions and 13 deletions
+1 -1
View File
@@ -27,7 +27,7 @@
* around the half accuracy of the positioning system * around the half accuracy of the positioning system
* *
*/ */
#define MIN_DISTANCE_BETWEEN_POINTS 1 #define MIN_DISTANCE_BETWEEN_POINTS 0.1
/** /**
* @brief This struct inherits the result of the navigation * @brief This struct inherits the result of the navigation
+19 -6
View File
@@ -13,6 +13,9 @@
MenuRoutePoints::MenuRoutePoints(Route *route) : MenuInformationSites() { MenuRoutePoints::MenuRoutePoints(Route *route) : MenuInformationSites() {
this->route = route; this->route = route;
}
void MenuRoutePoints::init() {
uint16_t amountPoints = this->route->getRouteInfo().totalPoints; uint16_t amountPoints = this->route->getRouteInfo().totalPoints;
if (amountPoints > UINT8_MAX) if (amountPoints > UINT8_MAX)
this->error = true; this->error = true;
@@ -21,6 +24,10 @@ MenuRoutePoints::MenuRoutePoints(Route *route) : MenuInformationSites() {
} }
void MenuRoutePoints::printPage() const { void MenuRoutePoints::printPage() const {
uint8_t currentPage = this->getCurrentPage();
if (this->lastPageNumber == currentPage)
return;
String lineOne = "N "; String lineOne = "N ";
String lineTwo = "E "; String lineTwo = "E ";
@@ -40,24 +47,30 @@ void MenuRoutePoints::printPage() const {
} }
Point p; Point p;
uint8_t currentPage = this->getCurrentPage();
if (currentPage == 0) if (currentPage == 0)
p = this->route->startRoute(); p = this->route->startRoute();
else if (currentPage == this->getCountPages())
p = this->route->endRoute();
else if (this->lastPageNumber - 1 == currentPage) else if (this->lastPageNumber - 1 == currentPage)
p = this->route->getPreviousPoint(); p = this->route->getPreviousPoint();
else if (this->lastPageNumber + 1 == currentPage) else if (this->lastPageNumber + 1 == currentPage)
p = this->route->getNextPoint(); p = this->route->getNextPoint();
else if (currentPage == this->getCountPages() - 1)
p = this->route->endRoute();
else else
std::cout << "Error in: MenuRoutePoints::printPage()" << std::endl; std::cout << "Error in: MenuRoutePoints::printPage()" << std::endl;
lineOne.concat(p.getLatitude()); char buf[20];
char* string;
info = this->route->getRouteInfo();
string = dtostrf(p.getLatitude(), 9, 7, buf);
lineOne.concat(string);
lineOne.concat(" "); lineOne.concat(" ");
lineOne.concat(info.currentPoint); lineOne.concat(info.currentPoint);
lineTwo.concat(p.getLongitude()); // lineOne.concat(currentPage);
string = dtostrf(p.getLongitude(), 9, 7, buf);
lineTwo.concat(string);
lineTwo.concat(" "); lineTwo.concat(" ");
lineTwo.concat(info.totalPoints); lineTwo.concat(info.totalPoints);
// std::cout << "MenuRoutePoints::printPage currentPage: " << (int) currentPage << std::endl;
this->print(lineOne, lineTwo); this->print(lineOne, lineTwo);
} }
+1 -1
View File
@@ -19,12 +19,12 @@
class MenuRoutePoints : public MenuInformationSites { class MenuRoutePoints : public MenuInformationSites {
public: public:
MenuRoutePoints(Route *route); MenuRoutePoints(Route *route);
void init () override;
void printPage() const override; void printPage() const override;
private: private:
Route* route; Route* route;
uint8_t lastPageNumber = 0;
bool error = false; bool error = false;
}; };
@@ -29,6 +29,7 @@ void MenuSysteminformation::printPage() const {
case 1: case 1:
lineOne = "Max alloc heap:"; lineOne = "Max alloc heap:";
lineTwo.concat(ESP.getMaxAllocHeap()); lineTwo.concat(ESP.getMaxAllocHeap());
break;
case 2: case 2:
lineOne = "Uptime in secs:"; lineOne = "Uptime in secs:";
@@ -59,9 +59,7 @@ void MenuAutopilot::printMenu() {
sprintf(buf2, "vorhanden."); sprintf(buf2, "vorhanden.");
} }
} }
if (!navigationStarted && !navigationEnded){
}
if (this->lcd) { if (this->lcd) {
this->lcd->clear(); this->lcd->clear();
this->lcd->setCursor(0, 0); this->lcd->setCursor(0, 0);