calibration fixes
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user