quite some fixes
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
MenuSensorData::MenuSensorData(SensorData* sensorData) :
|
||||
MenuInformationSites(7) {
|
||||
this->sensorData = sensorData;
|
||||
this->noEqualLeft = true;
|
||||
}
|
||||
|
||||
void MenuSensorData::printPage() const {
|
||||
@@ -81,20 +82,20 @@ void MenuSensorData::printPage() const {
|
||||
lineTwo = "Ntrip: ";
|
||||
uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
||||
if (carrSoln == 0)
|
||||
lineOne = "None";
|
||||
lineOne.concat("None");
|
||||
else if (carrSoln == 1)
|
||||
lineOne = "Floating";
|
||||
lineOne.concat("Floating");
|
||||
else if (carrSoln == 2)
|
||||
lineOne = "Fixed";
|
||||
lineOne.concat("Fixed");
|
||||
else
|
||||
lineOne = "UNKNOWN";
|
||||
NTRIPClientStates status = this->sensorData->getNtripState();
|
||||
if (status == NTRIPClientStates::pushData)
|
||||
lineTwo = "enabled";
|
||||
lineTwo.concat("enabled");
|
||||
else if (status == NTRIPClientStates::notAvailable)
|
||||
lineTwo = " N/A";
|
||||
lineTwo.concat(" N/A");
|
||||
else
|
||||
lineTwo = "disabled";
|
||||
lineTwo.concat("disabled");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -105,8 +106,8 @@ void MenuSensorData::printPage() const {
|
||||
lineOne.concat(gpsData->hAcc);
|
||||
lineTwo.concat(gpsData->numSV);
|
||||
} else {
|
||||
lineOne = "-/-";
|
||||
lineTwo = "-/-";
|
||||
lineOne.concat("-/-");
|
||||
lineTwo.concat("-/-");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -24,7 +24,3 @@ void MenuDriveMode::left() {
|
||||
this->leaved = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuDriveMode::no() {
|
||||
this->left();
|
||||
}
|
||||
|
||||
@@ -32,11 +32,6 @@ class MenuDriveMode : public MenuInformationSites {
|
||||
*/
|
||||
void left() override;
|
||||
|
||||
/**
|
||||
* @brief Calls left.
|
||||
*/
|
||||
void no() override;
|
||||
|
||||
protected:
|
||||
void configureOnLeave() {}
|
||||
|
||||
|
||||
@@ -18,20 +18,20 @@ DirectionChangeSignal::DirectionChangeSignal(Autopilot* pilot) {
|
||||
}
|
||||
|
||||
DirectionChangeSignal::~DirectionChangeSignal() {
|
||||
pilot->getSensorData()->getCalcCompass()->disableCalcAzimuth();
|
||||
CalcAzimuth* calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||
if (calcAzimuth)
|
||||
calcAzimuth->disableCalcAzimuth();
|
||||
}
|
||||
|
||||
void DirectionChangeSignal::action() {
|
||||
pilot->getSensorData()->getCalcCompass()->drivingDirectionChange(pilot->getSensorData()->getCurrentPos());
|
||||
CalcAzimuth* calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||
if (calcAzimuth)
|
||||
calcAzimuth->drivingDirectionChange(pilot->getSensorData()->getCurrentPos());
|
||||
}
|
||||
|
||||
|
||||
Autopilot::Autopilot() {
|
||||
this->setInputMode(ManualControl::InputMode::Digital);
|
||||
this->directionChangeSignal = new DirectionChangeSignal(this);
|
||||
this->setDirectionChangeCallback(this->directionChangeSignal);
|
||||
this->navigation = new Navigation(this->sensorData);
|
||||
this->init();
|
||||
|
||||
}
|
||||
|
||||
Autopilot::~Autopilot() {
|
||||
@@ -247,3 +247,11 @@ void Autopilot::restartLoop() {
|
||||
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection, true);
|
||||
this->updateDisplay = true;
|
||||
}
|
||||
|
||||
void Autopilot::afterActivate() {
|
||||
this->setInputMode(ManualControl::InputMode::Digital);
|
||||
this->directionChangeSignal = new DirectionChangeSignal(this);
|
||||
this->setDirectionChangeCallback(this->directionChangeSignal);
|
||||
this->navigation = new Navigation(this->sensorData);
|
||||
this->init();
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ class Autopilot : public ManualControl {
|
||||
void askNavigationForOrder();
|
||||
void selfDriving();
|
||||
void restartLoop();
|
||||
void afterActivate() override;
|
||||
|
||||
Navigation* navigation;
|
||||
CourseCorrection courseCorrection;
|
||||
|
||||
@@ -10,16 +10,14 @@
|
||||
*/
|
||||
|
||||
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||
|
||||
CaptureRoute::CaptureRoute() {
|
||||
this->navigation = new Navigation(this->sensorData);
|
||||
this->navigation->getRoute()->clear();
|
||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||
this->routeInfo = navigation->getRouteInfo();
|
||||
}
|
||||
#include "captureRoute.h"
|
||||
|
||||
CaptureRoute::~CaptureRoute() {
|
||||
// this->navigation->getNTRIPClient()->setActivated(false);
|
||||
if (this->navigation)
|
||||
delete this->navigation;
|
||||
|
||||
if (this->sensorData->getNtripClient())
|
||||
this->sensorData->getNtripClient()->setActivated(false);
|
||||
}
|
||||
|
||||
void CaptureRoute::run() {
|
||||
@@ -34,6 +32,13 @@ void CaptureRoute::run() {
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureRoute::afterActivate() {
|
||||
this->navigation = new Navigation(this->sensorData);
|
||||
this->navigation->getRoute()->clear();
|
||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||
this->routeInfo = navigation->getRouteInfo();
|
||||
}
|
||||
|
||||
double CaptureRoute::getDistanceToLastPoint() const {
|
||||
if (!this->lastSavedPoint.isInit())
|
||||
return 0;
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
*/
|
||||
class CaptureRoute : public ManualControl {
|
||||
public:
|
||||
CaptureRoute();
|
||||
|
||||
/**
|
||||
* @brief Destroy the Capture Route object
|
||||
*
|
||||
@@ -68,8 +66,9 @@ class CaptureRoute : public ManualControl {
|
||||
bool shouldUpdate();
|
||||
private:
|
||||
void run() override;
|
||||
void afterActivate() override;
|
||||
|
||||
Navigation* navigation;
|
||||
Navigation* navigation = nullptr;
|
||||
RouteInfo routeInfo;
|
||||
Point lastSavedPoint;
|
||||
Navigation::Status status = Navigation::Status::Complete;
|
||||
|
||||
@@ -27,4 +27,5 @@ void DriveModi::activate(DriveModiParams params){
|
||||
void DriveModi::init() {
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||
this->loopDelay = 40;
|
||||
this->afterActivate();
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ class DriveModi : public Component {
|
||||
double getMaxRotation() const { return this->maxRotationSpeed; }
|
||||
|
||||
protected:
|
||||
virtual void afterActivate() {}
|
||||
|
||||
MoveControl *moveControl;
|
||||
const ControlPadInput* input;
|
||||
const SensorData* sensorData;
|
||||
|
||||
@@ -114,6 +114,7 @@ void setup() {
|
||||
sensorData = new SensorData();
|
||||
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
||||
sensorData->enableRealCompass();
|
||||
sensorData->enableNtrip(NtripConfig::host, NtripConfig::port, NtripConfig::mountPoint, NtripConfig::user, NtripConfig::password);
|
||||
// sensorData->enableGyroskop();
|
||||
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user