calibration started

This commit is contained in:
Wolfgang Hottgenroth
2014-11-19 22:25:33 +01:00
parent 9ab050c430
commit f201ce5c4a
5 changed files with 71 additions and 39 deletions

View File

@ -27,12 +27,12 @@ void Thermometer::begin(bool initializeConfig, int eepromAddr) {
void Thermometer::exec(float r) {
temperatureRaw = (r / PT1000_R0 - 1) / PT1000_Coeff;
m_temperatureRaw = (r / PT1000_R0 - 1) / PT1000_Coeff;
if (m_lastSmoothedTemperature == INVALID_TEMPERATURE) {
temperature = temperatureRaw;
m_temperature = m_temperatureRaw;
} else {
temperature = alpha * temperatureRaw + (1.0 - alpha) * m_lastSmoothedTemperature;
m_temperature = m_alpha * m_temperatureRaw + (1.0 - m_alpha) * m_lastSmoothedTemperature;
}
m_lastSmoothedTemperature = temperature;
}