quite some fixes
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
#include "sensorData.h"
|
||||
|
||||
bool SensorData::outputStatusPrintPVTdata = false;
|
||||
bool SensorData::newData = false;
|
||||
uint32_t SensorData::ubxUpdateTimeStatic = 0;
|
||||
UBX_NAV_PVT_data_t* SensorData::ubxDataStatic = nullptr;
|
||||
|
||||
@@ -161,7 +160,6 @@ void SensorData::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
void SensorData::savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
SensorData::printPVTdata(ubxDataStruct);
|
||||
|
||||
SensorData::newData = true;
|
||||
SensorData::ubxDataStatic = ubxDataStruct;
|
||||
SensorData::ubxUpdateTimeStatic = millis();
|
||||
}
|
||||
@@ -189,12 +187,9 @@ void SensorData::runAsChild() {
|
||||
if (this->gnss) {
|
||||
this->gnss->checkUblox();
|
||||
this->gnss->checkCallbacks();
|
||||
}
|
||||
|
||||
if (SensorData::newData) {
|
||||
SensorData::newData = false;
|
||||
// TODO: Update data
|
||||
}
|
||||
if (SensorData::ubxUpdateTimeStatic != this->lastUbxUpdate)
|
||||
this->updateUbxData();
|
||||
}
|
||||
}
|
||||
|
||||
void SensorData::initGnss() {
|
||||
@@ -210,3 +205,14 @@ void SensorData::initGnss() {
|
||||
this->gnss->setNavigationFrequency(1);
|
||||
this->gnss->setAutoPVT(true);
|
||||
}
|
||||
|
||||
void SensorData::updateUbxData() {
|
||||
this->gnssData = SensorData::ubxDataStatic;
|
||||
this->lastUbxUpdate = SensorData::ubxUpdateTimeStatic;
|
||||
|
||||
Point::Coordinates coords;
|
||||
coords.lat = this->gnssData->lat / 10000000.0;
|
||||
coords.lon = this->gnssData->lon / 10000000.0;
|
||||
|
||||
this->currentPosition = Point(coords, this->gnssData->hAcc);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ class SensorData : public Component {
|
||||
void run() override;
|
||||
void runAsChild() override;
|
||||
void initGnss();
|
||||
void updateUbxData();
|
||||
|
||||
|
||||
QMC5883LCompass* realCompass = nullptr;
|
||||
CalcAzimuth* calcCompass = nullptr;
|
||||
@@ -93,8 +95,9 @@ class SensorData : public Component {
|
||||
uint16_t port;
|
||||
int16_t realAzimuth = INT16_MAX;
|
||||
int16_t calcAzimuth = INT16_MAX;
|
||||
uint32_t lastUbxUpdate = 0;
|
||||
|
||||
float yawPitchRoll[3];
|
||||
float yawPitchRoll[3] {0, 0, 0};
|
||||
|
||||
// static
|
||||
static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
|
||||
@@ -103,7 +106,6 @@ class SensorData : public Component {
|
||||
static UBX_NAV_PVT_data_t* ubxDataStatic;
|
||||
static uint32_t ubxUpdateTimeStatic;
|
||||
static bool outputStatusPrintPVTdata;
|
||||
static bool newData;
|
||||
};
|
||||
|
||||
#endif //SENSOR_DATA_H
|
||||
|
||||
Reference in New Issue
Block a user