change some things, because azimuth is now

by default a signed value
This commit is contained in:
2023-08-07 21:41:03 +02:00
parent 47a6e770fe
commit d6bc7e4239
4 changed files with 7 additions and 8 deletions
+1 -3
View File
@@ -192,9 +192,7 @@ void Navigation::updateCurrentLocation() {
int16_t Navigation::calculateCourseCorrection(Point& point) {
int16_t targetCourse = point.courseTo(this->targetPoint);
// correction = targetCourse - currentCourse
int16_t signedAzimuth = this->azimuth > 180 ? this->azimuth - 360 : this->azimuth;
int16_t correctionCourse = targetCourse - signedAzimuth;
int16_t correctionCourse = targetCourse - this->azimuth;
if (correctionCourse > 180)
correctionCourse -= 360;
else if (correctionCourse < -180)