2019-12-17 06:06:29 -08:00
|
|
|
/**
|
|
|
|
* @author Matthew Kennedy, (c) 2019
|
|
|
|
*
|
|
|
|
* A function to convert resistance to thermistor temperature (NTC). Uses the
|
2020-03-30 22:07:08 -07:00
|
|
|
* Steinhart-Hart equation to avoid having to compute many logarithms at runtime.
|
2019-12-17 06:06:29 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "engine_configuration_generated_structures.h"
|
|
|
|
#include "sensor_converter_func.h"
|
|
|
|
|
|
|
|
class ThermistorFunc final : public SensorConverter {
|
|
|
|
public:
|
|
|
|
SensorResult convert(float ohms) const override;
|
|
|
|
|
|
|
|
void configure(thermistor_conf_s &cfg);
|
|
|
|
|
2020-04-07 13:07:09 -07:00
|
|
|
void showInfo(Logging* logger, float testRawValue) const override;
|
|
|
|
|
2019-12-17 06:06:29 -08:00
|
|
|
private:
|
|
|
|
// Steinhart-Hart coefficients
|
2020-07-29 02:29:55 -07:00
|
|
|
float m_a = 0;
|
|
|
|
float m_b = 0;
|
|
|
|
float m_c = 0;
|
2019-12-17 06:06:29 -08:00
|
|
|
};
|