Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e119598 authored by Aaqib Ismail's avatar Aaqib Ismail
Browse files

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
parent 65dbca6f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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
                ]
            }
        },
+1 −1
Original line number Diff line number Diff line
@@ -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;
}