compilation works again
This commit is contained in:
@@ -21,7 +21,7 @@ void CalcAzimuth::drivingDirectionChange(Point point) {
|
||||
if (point.isInit() && point.isValid()) {
|
||||
this->directionChangeMode = true;
|
||||
this->lastChangePoint = point;
|
||||
this->state = CalcAzimuthState::Invalid;
|
||||
this->state = State::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ void CalcAzimuth::updateCurrentPosition(Point point) {
|
||||
this->positionChanged = true;
|
||||
}
|
||||
|
||||
void CalcAzimuth::CalcAzimuth::run() {
|
||||
void CalcAzimuth::run() {
|
||||
if (!this->positionChanged)
|
||||
return
|
||||
return;
|
||||
|
||||
this->positionChanged = false;
|
||||
this->updateAzimuth();
|
||||
@@ -42,47 +42,47 @@ void CalcAzimuth::updateAzimuth() {
|
||||
if (!this->directionChangeMode
|
||||
|| this->lastChangePoint.distanceTo(this->currentPosition) < 1.0)
|
||||
{
|
||||
this->state = CalcAzimuthState::Invalid;
|
||||
this->state = State::Invalid;
|
||||
this->calcAzimuth = 999;
|
||||
return;
|
||||
}
|
||||
|
||||
this->calcAzimuth = this->lastChangePoint.courseTo(this->currentPosition);
|
||||
|
||||
// Map point accuracy to CalcAzimuthState
|
||||
// Map point accuracy to State
|
||||
if (this->lastChangePoint.getAccuracy() == Point::Accuracy::oneDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::oneDigOfCM)
|
||||
{
|
||||
this->state = CalcAzimuthState::Good;
|
||||
this->state = State::Good;
|
||||
}
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::twoDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::twoDigOfCM)
|
||||
{
|
||||
this->state = CalcAzimuthState::Ok;
|
||||
this->state = State::Ok;
|
||||
}
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::threeDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::threeDigOfCM)
|
||||
{
|
||||
this->state = CalcAzimuthState::Bad;
|
||||
this->state = State::Bad;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->state = CalcAzimuthState::Invalid;
|
||||
this->state = State::Invalid;
|
||||
}
|
||||
|
||||
// Upgrade quality if the range grows up
|
||||
if (this->lastChangePoint.distanceTo(this->currentPosition) > 2.0) {
|
||||
switch (this->state) {
|
||||
case CalcAzimuthState::Bad :
|
||||
this->state = CalcAzimuthState::Ok;
|
||||
case State::Bad :
|
||||
this->state = State::Ok;
|
||||
break;
|
||||
|
||||
case CalcAzimuthState::Ok :
|
||||
this->state = CalcAzimuthState::Good;
|
||||
case State::Ok :
|
||||
this->state = State::Good;
|
||||
break;
|
||||
|
||||
case CalcAzimuthState::Good :
|
||||
this->state = CalcAzimuthState::Super;
|
||||
case State::Good :
|
||||
this->state = State::Super;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
class CalcAzimuth : public Component {
|
||||
public:
|
||||
enum CalcAzimuthState {
|
||||
enum State {
|
||||
Invalid,
|
||||
Bad,
|
||||
Ok,
|
||||
@@ -32,13 +32,13 @@ class CalcAzimuth : public Component {
|
||||
void disableCalcAzimuth() { this->directionChangeMode = false; }
|
||||
|
||||
int16_t getAzimuth() const { return this->calcAzimuth; }
|
||||
CalcAzimuthState getState() const { return this->state; }
|
||||
State getState() const { return this->state; }
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void updateAzimuth();
|
||||
|
||||
CalcAzimuthState state = CalcAzimuthState::Invalid;
|
||||
State state = State::Invalid;
|
||||
Point lastChangePoint;
|
||||
Point currentPosition;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user