add menuTest

This commit is contained in:
2023-01-31 08:21:04 +01:00
parent c63428412f
commit d96f382702
7 changed files with 177 additions and 32 deletions
+13 -6
View File
@@ -14,6 +14,7 @@
#include <Arduino.h>
#include <cstdint>
#include <iostream>
#include <ESP32Encoder.h>
/**
@@ -39,6 +40,7 @@
class Speedometer {
public:
Speedometer();
~Speedometer();
/**
* @brief Initialize the speedometer
@@ -55,7 +57,7 @@ class Speedometer {
/**
* @brief Calls runSpeedometer() to update all Values.
*
* This function should be called every mainloop. If the delay is not reached, than the
* This function should be called every mainloop. If the delayLoop is not reached, than the
* functions returns immediately.
* @see runSpeedometer()
* @see DELAY_SPEEDOMETER
@@ -85,11 +87,11 @@ class Speedometer {
void setEncFilter(uint16_t val);
/**
* @brief Set the min delay between each loop
* @brief Set the min delayLoop between each loop
*
* @param delay time in Milliseconds
* @param delayLoop time in Milliseconds
*/
void setDelay(uint8_t delay);
void setDelay(uint8_t delayLoop);
/**
* @brief Get the calculated speed of the Wheel
@@ -98,6 +100,9 @@ class Speedometer {
*/
double getSpeed();
void calibrationMeasurementStart();
uint16_t calibrationMeasurementStop();
private:
void initAvgBuf();
@@ -108,15 +113,17 @@ class Speedometer {
ESP32Encoder encoder;
bool isInit = false;
bool calibrationRunning = false;
double speed = 0;
double diameter;
uint8_t bufSize = BUFSIZE;
uint8_t delayLoop = DELAY_SPEEDOMETER;
uint8_t bufPos = 0;
uint16_t steps;
uint8_t delay = DELAY_SPEEDOMETER;
int16_t *buf;
int16_t *buf = nullptr;
uint32_t last_millis_loop = 0;
uint32_t last_millis_calc = 0;