File management and Completed Part 1

This commit is contained in:
Thorsteinngretar
2026-10-03 02:41:04 +00:00
parent 0b52148272
commit 6f3c388cef
37 changed files with 1458 additions and 0 deletions
@@ -0,0 +1,37 @@
#ifndef SPEED_ESTIMATOR_H
#define SPEED_ESTIMATOR_H
#include <stdint.h>
class Speed_estimator
{
public:
Speed_estimator(
double countsPerRevolution,
double sampleTimeSeconds
);
void reset(int32_t initialPosition);
double update(int32_t currentPosition);
double rpm() const;
private:
static const uint8_t WINDOW_SIZE = 10;
double countsPerRevolution;
double sampleTime;
int32_t previousPosition;
int32_t countHistory[WINDOW_SIZE];
int32_t rollingCounts;
uint8_t historyIndex;
uint8_t samplesFilled;
double currentRPM;
};
#endif