sensing well - need to debug oor

This commit is contained in:
Aditya Pulipaka
2025-11-20 17:13:46 -06:00
parent 725df1f1ec
commit f1fea28d73
4 changed files with 41 additions and 8 deletions

View File

@@ -17,15 +17,17 @@ class IndSensor {
bool oor;
float mmVal;
uint16_t analog;
float alpha; // EMA smoothing factor: 0-1, lower = more smoothing
// Constructor
IndSensor(IndSensorMap calibration, uint8_t analogPin);
IndSensor(IndSensorMap calibration, uint8_t analogPin, float emaAlpha = 0.3f);
// Read sensor directly from pin and convert to millimeters
float readMM();
private:
IndSensorMap consts;
uint8_t pin;
float filteredRaw;
// helper function to convert analog reading to millimeters
float toMM(uint16_t raw);