06-03-2022 08:11 PM - edited 06-03-2022 08:12 PM
There appears to be a casting issue in this function that is causing negative temperatures to be returned as larger positive values.
Specifically in this line : temp_raw_scaled = (int32_t)data[BMA4_TEMP_BYTE] * BMA4_SCALE_TEMP;
Test case to demonstrate: set data = 0x81
The expected return value in deg C would be -104C
Actual return value is 152,000 C
07-01-2022 10:15 AM
Hi john-rubis,
In this function bma4_get_temperature(), temp_unit supported BMA4_FAHREN and BMA4_KELVIN, not supported BMA4_DEG.