added virtual destuctor for menu things

This commit is contained in:
2022-10-03 17:02:34 +02:00
parent a1a976be57
commit ee5bc9129a
9 changed files with 46 additions and 58 deletions
+16 -4
View File
@@ -34,6 +34,13 @@ void NTRIPClient::loop() {
this->gps->checkUblox();
this->gps->checkCallbacks();
if (millis() - this->lastGPGGAPushTime > this->pushGPGGATime) {
NMEA_GGA_data_t *data = nullptr;
uint8_t res = this->gps->getLatestNMEAGPGGA(data);
if (res == 2)
this->pushGPGGA(data);
}
switch (this->state) {
case NTRIPClientStates::openConnection:
if (millis() - this->lastNtripConnectTime > this->tryReconnectTime)
@@ -72,12 +79,11 @@ void NTRIPClient::loop() {
void NTRIPClient::gpsConfiguration() {
this->gps->setI2COutput(COM_TYPE_UBX | COM_TYPE_NMEA);
this->gps->setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3);
this->gps->(SFE_UBLOX_DGNSS_MODE_FIXED); // Set the differential mode - ambiguities are fixed whenever possible
this->gps->setDGNSSConfiguration(SFE_UBLOX_DGNSS_MODE_FIXED); // Set the differential mode - ambiguities are fixed whenever possible
this->gps->setNavigationFrequency(1);
this->gps->setMainTalkerID(SFE_UBLOX_MAIN_TALKER_ID_GP);
this->gps->enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C, 10);
this->gps->setNMEAGPGGAcallbackPtr(&pushGPGGA); // Set up the callback for GPGGA
this->gps->setAutoPVTcallbackPtr(&(NTRIPClient::printPVTdata));
}
@@ -140,7 +146,7 @@ bool NTRIPClient::beginClient() {
this->ntripClient->stop();
return false;
}
delay(10)
delay(10);
}
//Check reply
@@ -214,7 +220,7 @@ bool NTRIPClient::processConnection() {
void NTRIPClient::pushGPGGA(NMEA_GGA_data_t *nmeaData) {
if (this->ntripClient->connected() && this->transmitLocation) {
std::cout << "Pushing GGA to server: " << (const char *)nmeaData->nmea) << std::endl;
std::cout << "Pushing GGA to server: " << (const char *)nmeaData->nmea << std::endl;
this->ntripClient->print((const char *)nmeaData->nmea);
}
}
@@ -262,3 +268,9 @@ void NTRIPClient::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
<< "Carrier Solution: " << carrSolnString
<< "Horizontal Accuracy Estimate: " << hAcc << " mm" << std::endl;
}
bool NTRIPClient::isConnected() {
if (this->state == NTRIPClientStates::pushData)
return true;
return false;
}
+7 -1
View File
@@ -21,13 +21,17 @@ class NTRIPClient {
void loop();
void gpsConfiguration();
void pushGPGGA(NMEA_GGA_data_t *nmeaData);
void setTransmitLocation(bool b) { this->transmitLocation = b; }
void setActivated(bool b) { this->activated = b; }
bool isConnected();
NTRIPClientStates getClientState() { return this->state; }
static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
private:
void pushGPGGA(NMEA_GGA_data_t *nmeaData);
bool beginClient();
void closeConnection();
bool processConnection();
@@ -42,6 +46,7 @@ class NTRIPClient {
uint16_t port;
uint32_t lastReceivedRtcmTime = 0;
uint32_t lastNtripConnectTime = 0;
uint32_t lastGPGGAPushTime = 0;
uint32_t lastLoopTime = 0;
const char* host;
@@ -52,6 +57,7 @@ class NTRIPClient {
const uint16_t timeOut = 5000;
const uint16_t tryReconnectTime = 5000;
const uint16_t bufferSize = 512;
const uint16_t pushGPGGATime = 10000;
};
#endif