cleaning
refactore all components now have a base class compnent for loop functions
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||
|
||||
#include "debugTimes.h"
|
||||
#include "component.h"
|
||||
|
||||
/**
|
||||
* @brief States for the state machine.
|
||||
@@ -39,7 +40,7 @@ enum NTRIPClientStates {
|
||||
* data and push it to a given gnss module. This module have to be compatible
|
||||
* with the SparkFun u-blox GNSS Arduino Library.
|
||||
*/
|
||||
class NTRIPClient {
|
||||
class NTRIPClient : public Component {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new NTRIPClient object
|
||||
@@ -54,14 +55,6 @@ class NTRIPClient {
|
||||
NTRIPClient(SFE_UBLOX_GNSS* gps, const char* host, uint16_t port, const char* mountPoint, const char* user, const char* password);
|
||||
~NTRIPClient();
|
||||
|
||||
/**
|
||||
* @brief Runs the state machine.
|
||||
*
|
||||
* See NTRIPClientStates for more information.
|
||||
* Should be called ever main loop.
|
||||
*/
|
||||
void loop();
|
||||
|
||||
/**
|
||||
* @brief Configure the Gnss module to accept correction data
|
||||
*
|
||||
@@ -100,6 +93,8 @@ class NTRIPClient {
|
||||
NTRIPClientStates getClientState() { return this->state; }
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void runAsChild() override;
|
||||
void pushGPGGA();
|
||||
bool beginClient();
|
||||
void closeConnection();
|
||||
@@ -119,14 +114,12 @@ class NTRIPClient {
|
||||
uint32_t lastReceivedRtcmTime = 0;
|
||||
// uint32_t lastNtripConnectTime = 0; // can deleted?
|
||||
uint32_t lastGPGGAPushTime = 0;
|
||||
uint32_t lastLoopTime = 0;
|
||||
uint32_t lastReconnectTime = 0;
|
||||
|
||||
char host[128];
|
||||
char mountPoint[128];
|
||||
char user[128];
|
||||
char password[128];
|
||||
const uint8_t delayTime = 20;
|
||||
const uint8_t maxReconnectAttemps = 10;
|
||||
const uint16_t reconnectDelayTime = 1000;
|
||||
const uint16_t timeOut = 10000;
|
||||
|
||||
Reference in New Issue
Block a user