quite some fixes

This commit is contained in:
2023-09-23 22:47:07 +02:00
parent d0c5421ad9
commit e48f680fec
14 changed files with 69 additions and 49 deletions
+15 -7
View File
@@ -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();
}