Change temp approximations to be accurate

We need to use a more accurate ratio of celsius to fahrenheit along
with better min/max temperature conversions so if a client sets the
value using standard conversion or using this table, they will produce
the same result. Also, we need to round to the closest increment instead
of truncating.

Bug: 305274504
Bug: 313720524
Test: atest CtsCarTestCases:CarPropertyManagerTest
Test: atest FakeVehicleHardwareTest
Change-Id: Ia4d53e1a904fb2b40f5ec428ab548895c8f307ed
This commit is contained in:
Aaqib Ismail 2023-11-30 17:43:22 -08:00
parent 65dbca6faf
commit 5e119598fa
2 changed files with 5 additions and 5 deletions

View file

@ -2368,9 +2368,9 @@
160,
280,
5,
600,
840,
10
608,
824,
9
]
},
{
@ -2380,7 +2380,7 @@
66.19999694824219,
"VehicleUnit::FAHRENHEIT",
19.0,
66.0
66.2
]
}
},

View file

@ -434,7 +434,7 @@ int FakeVehicleHardware::getHvacTempNumIncrements(int requestedTemp, int minTemp
int increment) {
requestedTemp = std::max(requestedTemp, minTemp);
requestedTemp = std::min(requestedTemp, maxTemp);
int numIncrements = (requestedTemp - minTemp) / increment;
int numIncrements = std::round((requestedTemp - minTemp) / static_cast<float>(increment));
return numIncrements;
}