fix some issues
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "navigation.h"
|
||||
|
||||
bool Navigation::outputStatusPrintPVTdata = false;
|
||||
bool Navigation::newData = false;
|
||||
uint32_t Navigation::ubxUpdateTimeStatic = 0;
|
||||
UBX_NAV_PVT_data_t* Navigation::ubxDataStatic = nullptr;
|
||||
|
||||
@@ -81,6 +82,11 @@ void Navigation::loop() {
|
||||
this->gps->checkUblox();
|
||||
this->gps->checkCallbacks();
|
||||
|
||||
if (Navigation::newData) {
|
||||
this->updateCurrentLocation();
|
||||
Navigation::newData = false;
|
||||
}
|
||||
|
||||
if (this->isNtripInit)
|
||||
this->ntripClient->loop();
|
||||
}
|
||||
@@ -163,14 +169,11 @@ void Navigation::updateCurrentLocation() {
|
||||
Point p;
|
||||
p.lon = this->ubxData->lon;
|
||||
p.lat = this->ubxData->lat;
|
||||
p.fixType = this->ubxData->fixType;
|
||||
p.carrierSolution = this->ubxData->flags.all;
|
||||
|
||||
this->currentPosition = p;
|
||||
}
|
||||
|
||||
bool Navigation::nextPoint() {
|
||||
|
||||
bool Navigation::nextPoint() {
|
||||
if (!this->navigationStarted)
|
||||
return false;
|
||||
return this->setTargetPoint(this->route->getNextPoint());
|
||||
@@ -238,6 +241,7 @@ void Navigation::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
void Navigation::savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
Navigation::printPVTdata(ubxDataStruct);
|
||||
|
||||
Navigation::newData = true;
|
||||
Navigation::ubxDataStatic = ubxDataStruct;
|
||||
Navigation::ubxUpdateTimeStatic = millis();
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ class Navigation {
|
||||
static uint32_t ubxUpdateTimeStatic;
|
||||
|
||||
static bool outputStatusPrintPVTdata;
|
||||
static bool newData;
|
||||
};
|
||||
|
||||
#endif // NAVIGATION_H
|
||||
|
||||
@@ -56,8 +56,9 @@ void Point::init(uint32_t horizontalAccuracy) {
|
||||
if (horizontalAccuracy > 9999)
|
||||
this->accuracy = PointAccuracy::fourDigOfCM;
|
||||
else if (horizontalAccuracy > 999)
|
||||
this->accuracy = PointAccuracy::threeDigOfCM
|
||||
this->accuracy = PointAccuracy::threeDigOfCM;
|
||||
else if (horizontalAccuracy > 99)
|
||||
this->accuracy = PointAccuracy::twoDigOfCM;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,14 +22,6 @@
|
||||
#define ROUTE_DISTANCE_BETWEEN_LATITUDE 111300
|
||||
#define ROUTE_PI 3.14159265358979323846
|
||||
|
||||
enum PointAccuracy {
|
||||
none,
|
||||
fourDigOfCM,
|
||||
threeDigOfCM,
|
||||
twoDigOfCM,
|
||||
oneDigOfCM
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A to handle points on the earth
|
||||
*
|
||||
@@ -38,6 +30,15 @@ enum PointAccuracy {
|
||||
*/
|
||||
class Point{
|
||||
public:
|
||||
enum PointAccuracy {
|
||||
none,
|
||||
fourDigOfCM,
|
||||
threeDigOfCM,
|
||||
twoDigOfCM,
|
||||
oneDigOfCM
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Construct a new Point object
|
||||
*
|
||||
|
||||
@@ -109,11 +109,13 @@ void NTRIPClient::gpsConfiguration() {
|
||||
}
|
||||
|
||||
bool NTRIPClient::setActivated(bool b) {
|
||||
// std::cout << "NTRIPClient::setActivated: b - " << b << std::endl;
|
||||
if (b && this->state != NTRIPClientStates::notAvailable)
|
||||
this->activated = true;
|
||||
else if (b)
|
||||
return false;
|
||||
this->activated = false;
|
||||
else
|
||||
this->activated = false;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user