calibration fixes

This commit is contained in:
hg
2014-11-20 22:43:06 +01:00
parent 80a394d651
commit b6ad21f3f6
4 changed files with 74 additions and 59 deletions

View File

@ -13,6 +13,12 @@ Thermometer::Thermometer() {
}
void Thermometer::setAlpha(float alpha) {
m_alpha = alpha;
Config::setFloat(m_eepromAddr + CONFIG_ALPHA, m_alpha);
}
void Thermometer::begin(bool initializeConfig, int eepromAddr) {
m_eepromAddr = eepromAddr;
@ -22,7 +28,7 @@ void Thermometer::begin(bool initializeConfig, int eepromAddr) {
}
m_lastSmoothedTemperature = INVALID_TEMPERATURE;
alpha = Config::getFloat(m_eepromAddr + CONFIG_ALPHA);
m_alpha = Config::getFloat(m_eepromAddr + CONFIG_ALPHA);
}
@ -34,5 +40,5 @@ void Thermometer::exec(float r) {
} else {
m_temperature = m_alpha * m_temperatureRaw + (1.0 - m_alpha) * m_lastSmoothedTemperature;
}
m_lastSmoothedTemperature = temperature;
m_lastSmoothedTemperature = m_temperature;
}