bugfix for some negative temperature conversions
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
2022-06-10 10:39:43 +02:00
parent f72dfa255d
commit 17d17dce06
17 changed files with 65 additions and 47 deletions

View File

@ -25,4 +25,7 @@ void max1227::prepareExternallyClockedTemperatureRead(uint8_t *spiBuf, size_t &s
sz += 25;
}
float max1227::getTemperature(int16_t temp) { return static_cast<float>(temp) * 0.125; }
float max1227::getTemperature(uint16_t raw) {
float temp = static_cast<float>((-2048 * (raw >> 11)) + (raw & 0x7FF)) * 0.125;
return temp;
}