fix speedometer for new encoder
This commit is contained in:
@@ -89,7 +89,7 @@ class Speedometer {
|
||||
*
|
||||
* @param dir Direction
|
||||
*/
|
||||
void setDirection(Direction dir) { this->currentDirection = dir; }
|
||||
void setDirection(Direction dir);
|
||||
|
||||
/**
|
||||
* @brief Set the number of last values to be taken into account for the average.
|
||||
@@ -150,6 +150,7 @@ class Speedometer {
|
||||
private:
|
||||
void init(uint8_t pin, double diameter, uint16_t steps);
|
||||
void initAvgBuf();
|
||||
void clearAvgBuf();
|
||||
void addValToBuf(int16_t val);
|
||||
void updateAvgBufSize();
|
||||
int16_t calcAverage();
|
||||
@@ -162,6 +163,7 @@ class Speedometer {
|
||||
double speed = 0;
|
||||
double diameter;
|
||||
|
||||
uint8_t printCounter = 0;
|
||||
uint8_t bufSize = BUFSIZE;
|
||||
uint8_t delayLoop = DELAY_SPEEDOMETER;
|
||||
uint8_t bufPos = 0;
|
||||
@@ -169,8 +171,8 @@ class Speedometer {
|
||||
|
||||
int16_t *buf = nullptr;
|
||||
|
||||
uint32_t last_millis_loop = 0;
|
||||
uint32_t last_millis_calc = 0;
|
||||
uint32_t lastMillisLoop = 0;
|
||||
uint32_t lastMillisCalc = 0;
|
||||
};
|
||||
|
||||
#endif // SPEEDOMETER_H
|
||||
|
||||
Reference in New Issue
Block a user