first commit

This commit is contained in:
lumijiez
2025-04-28 18:30:29 +03:00
commit a4b88564a4
45 changed files with 2188 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
#ifndef THERMISTOR_CONTROLLER_H
#define THERMISTOR_CONTROLLER_H
#include <Arduino.h>
class ThermistorController {
private:
const int _thermistorPin;
const float _seriesResistor;
const float _bParameter;
const float _nominalTemp;
static const int _bufferSize = 10;
float _rawReadings[_bufferSize];
int _bufferIndex;
bool _bufferFilled;
float _filteredRaw;
float _smoothedRaw;
float _resistance;
float _temperatureC;
const float _weights[_bufferSize] = {0.05, 0.05, 0.05, 0.05, 0.1, 0.1, 0.1, 0.15, 0.15, 0.2};
const float _minTemp;
const float _maxTemp;
float applySaltPepperFilter();
float applyWeightedMovingAverage();
float calculateResistance(float adcValue);
float calculateTemperature(float resistance);
float applySaturation(float value, float min, float max);
public:
ThermistorController(
int thermistorPin,
float seriesResistor = 10000.0,
float bParameter = 3435.0,
float nominalTemp = 25.0,
float minTemp = -55.0,
float maxTemp = 125.0
);
void update();
float getRawValue() const;
float getFilteredRaw() const;
float getSmoothedRaw() const;
float getResistance() const;
float getTemperatureC() const;
float getTemperatureF() const;
};
#endif