refactore all captureRoute stuff

This commit is contained in:
2023-05-11 21:07:21 +02:00
parent 6874aed6ed
commit ed39cdb874
4 changed files with 96 additions and 9 deletions
+29 -1
View File
@@ -27,6 +27,12 @@
*/
class CaptureRoute : public ManualControl {
public:
enum NtripState {
NoNtrip,
Waiting,
Enabled
};
/**
* @brief Construct a new Capture Route object
*
@@ -35,6 +41,13 @@ class CaptureRoute : public ManualControl {
*/
CaptureRoute(MoveControl* moveControl, const ControlPadInput *input, Navigation* navigation);
/**
* @brief Destroy the Capture Route object
*
* Disconnect the NTRIP-Client
*/
~CaptureRoute();
/**
* @brief Calls runCaptureRoute and ManualControl::loop
*
@@ -64,6 +77,13 @@ class CaptureRoute : public ManualControl {
*/
RouteInfo getRouteInfo() const { return this->routeInfo; }
/**
* @brief Get the distance to the last saved oint
*
* @return double in meters
*/
double getDistanceToLastPoint();
/**
* @brief Tells if there are new informations to display
*
@@ -72,11 +92,19 @@ class CaptureRoute : public ManualControl {
*/
bool shouldUpdate();
private:
void checkNtrip();
Navigation* navigation;
RouteInfo routeInfo;
Point lastSavedPoint;
NtripState state = NtripState::Waiting;
uint32_t lastMillis = 0;
uint8_t ntripReconnectAttemps = 0;
uint8_t ntripReconnectMaxAttemps = 10;
uint16_t reconnectNtripDelayMillis = 1000;
uint16_t delay = 200;
uint32_t lastMillis = 0;
uint32_t reconnectNtripLastMillis = 0;
bool updateDisplay = false;
};