From d0f7f47dc94f1ba8b9489f937dd190a06d9bf7e3 Mon Sep 17 00:00:00 2001 From: Rick Sellens Date: Thu, 30 Jan 2020 17:09:35 -0500 Subject: [PATCH] Warning about scaling --- src/NMEA_data.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/NMEA_data.cpp b/src/NMEA_data.cpp index d3d05ed..72a44ef 100644 --- a/src/NMEA_data.cpp +++ b/src/NMEA_data.cpp @@ -367,7 +367,11 @@ void Adafruit_GPS::initDataValue(nmea_index_t idx, char *label, char *fmt, /*! @brief Attempt to add history to a data value table entry. If it fails to malloc the space, history will not be added. Test the pointer for a - check if needed. + check if needed. Select scale and offset values carefully so that + operations and results will fit inside 16 bit integer limits. For example + a scale of 1.0 and an offset of 100000.0 would be a good choice for + atmospheric pressure in Pa with values ranging ~ +/- 3500, while a scale + of 10.0 would be pushing the integer limits. @param idx The data index for the value to have history recorded @param scale Value for scaling the integer history list @param offset Value for scaling the integer history list