refactore
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @file calcAzimuth.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-09-03
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALC_AZIMUTH_H
|
||||
#define CALC_AZIMUTH_H
|
||||
|
||||
#include "component.h"
|
||||
#include "point.h"
|
||||
|
||||
class CalcAzimuth : public Component {
|
||||
public:
|
||||
enum CalcAzimuthState {
|
||||
Invalid,
|
||||
Bad,
|
||||
Ok,
|
||||
Good,
|
||||
Super
|
||||
};
|
||||
|
||||
CalcAzimuth(Point point);
|
||||
|
||||
void drivingDirectionChange(Point point);
|
||||
void updateCurrentPosition(Point point);
|
||||
void disableCalcAzimuth() { this->directionChangeMode = false; }
|
||||
|
||||
int16_t getAzimuth() const { return this->calcAzimuth; }
|
||||
CalcAzimuthState getState() const { return this->state; }
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void updateAzimuth();
|
||||
|
||||
CalcAzimuthState state = CalcAzimuthState::Invalid;
|
||||
Point lastChangePoint;
|
||||
Point currentPosition;
|
||||
|
||||
bool positionChanged = false;
|
||||
bool directionChangeMode = false;
|
||||
int16_t calcAzimuth = INT16_MAX;
|
||||
};
|
||||
|
||||
#endif //CALC_AZIMUTH_H
|
||||
Reference in New Issue
Block a user