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) {
|
if (temp->value < -39000) {
|
||||||
return temperatureMinimumValue;
|
return temperatureMinimumValue;
|
||||||
}
|
}
|
||||||
long converted = (temp->value - (temperatureShiftForStorage)) / 500;
|
// Add 250 to improve rounding
|
||||||
|
long converted = (temp->value - (temperatureShiftForStorage) + 250) / 500;
|
||||||
if (converted < temperatureMinimumValue) {
|
if (converted < temperatureMinimumValue) {
|
||||||
return temperatureMinimumValue;
|
return temperatureMinimumValue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user