Improve temperature rounding

This commit is contained in:
Christoph Hagen 2023-08-16 11:09:55 +02:00
parent e669040f58
commit aab838b47b

View File

@ -52,7 +52,8 @@ uint8_t byteForAbsoluteTemperature(Temperature* temp) {
if (temp->value < -39000) {
return temperatureMinimumValue;
}
long converted = (temp->value - (temperatureShiftForStorage)) / 500;
// Add 250 to improve rounding
long converted = (temp->value - (temperatureShiftForStorage) + 250) / 500;
if (converted < temperatureMinimumValue) {
return temperatureMinimumValue;
}