Improve temperature rounding
This commit is contained in:
parent
e669040f58
commit
aab838b47b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user