added virtual destuctor for menu things
This commit is contained in:
@@ -25,9 +25,7 @@ Navigation::Navigation(Route* route) {
|
||||
this->gps->setI2COutput(COM_TYPE_UBX);
|
||||
this->gps->setUSBOutput(COM_TYPE_UBX | COM_TYPE_NMEA);
|
||||
|
||||
this->gps->setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3);
|
||||
|
||||
this->gps->getNavigationFrequency(1);
|
||||
this->gps->setNavigationFrequency(1);
|
||||
|
||||
if (route)
|
||||
this->route = route;
|
||||
@@ -38,55 +36,17 @@ Navigation::Navigation(Route* route) {
|
||||
Navigation::~Navigation() {
|
||||
delete this->gps;
|
||||
|
||||
if (this->isNtripInit) {
|
||||
if (this->isNtripInit)
|
||||
delete this->ntripClient;
|
||||
|
||||
delete this->host;
|
||||
delete this->mountPoint;
|
||||
delete this->user;
|
||||
delete this->password;
|
||||
}
|
||||
|
||||
if (this->route)
|
||||
delete this->route;
|
||||
}
|
||||
|
||||
void Navigation::initNtrip(String host, uint16_t port, String mountPoint, String user, String password) {
|
||||
this->host = new char[host.length() + 1];
|
||||
this->mountPoint = new char[mountPoint.length() + 1];
|
||||
this->user = new char[user.length() + 1];
|
||||
this->password = new char[password.length() + 1];
|
||||
|
||||
strcpy(this->host, host.c_str());
|
||||
strcpy(this->mountPoint, mountPoint.c_str());
|
||||
strcpy(this->user, user.c_str());
|
||||
strcpy(this->password, password.c_str());
|
||||
this->port = port;
|
||||
|
||||
this->ntripClient = new NTRIPClient;
|
||||
this->ntripClient = new NTRIPClient(this->gps, host.c_str(), port, mountPoint.c_str(), user.c_str(), password.c_str());
|
||||
this->ntripClient->gpsConfiguration();
|
||||
this->isNtripInit = true;
|
||||
|
||||
std::cout << "Requesting SourceTable." << std::endl;
|
||||
if(this->ntripClient->reqSrcTbl(this->host, (int) this->port)){
|
||||
char buffer[512];
|
||||
delay(5);
|
||||
while(this->ntripClient->available()) {
|
||||
this->ntripClient->readLine(buffer,sizeof(buffer));
|
||||
std::cout << buffer << std::endl;
|
||||
}
|
||||
} else {
|
||||
std::cout << "SourceTable request error" << std::endl;
|
||||
}
|
||||
std::cout << "Requesting SourceTable is OK" << std::endl;
|
||||
this->ntripClient->stop(); //Need to call "stop" function for next request.
|
||||
|
||||
std::cout << "Requesting MountPoint's Raw data" << std::endl;
|
||||
if(!this->ntripClient->reqRaw(this->host, this->port, this->mountPoint,
|
||||
this->user, this->password)){
|
||||
delay(15000);
|
||||
ESP.restart();
|
||||
}
|
||||
std::cout << "Requesting MountPoint is OK" << std::endl;
|
||||
}
|
||||
|
||||
void Navigation::loop() {
|
||||
@@ -95,14 +55,8 @@ void Navigation::loop() {
|
||||
if (millis() - this->lastMillis < this->timeToWait)
|
||||
return;
|
||||
|
||||
if (this->isNtripInit) {
|
||||
uint8_t rtcmData[512 * 4];
|
||||
uint16_t rtcmCount = this->ntripClient->available();
|
||||
if (rtcmCount) {
|
||||
this->ntripClient->readBytes(rtcmData, rtcmCount);
|
||||
this->gps->pushRawData(rtcmData, rtcmCount);
|
||||
}
|
||||
}
|
||||
if (this->isNtripInit)
|
||||
this->ntripClient->loop();
|
||||
}
|
||||
|
||||
void Navigation::newRoute() {
|
||||
|
||||
Reference in New Issue
Block a user