Correcting defaults for min and max sensor bounds
Hardcoded (-127,128) seems wrong to me
Using (-128,127) which I think was the intention
This matches what a signed byte would be
Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: Ia0f1e7b25b673be50593e2cc056c69f3bb0b76cd
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 2e99c6a..7aff404 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -1300,8 +1300,11 @@
auto maxObject = sensorObject->second.find("MaxValue");
auto minObject = sensorObject->second.find("MinValue");
- double max = 128;
- double min = -127;
+
+ // If min and/or max are left unpopulated,
+ // then default to what a signed byte would be, namely (-128,127) range.
+ auto max = static_cast<double>(std::numeric_limits<int8_t>::max());
+ auto min = static_cast<double>(std::numeric_limits<int8_t>::lowest());
if (maxObject != sensorObject->second.end())
{
max = std::visit(VariantToDoubleVisitor(), maxObject->second);