bme680 icon indicating copy to clipboard operation
bme680 copied to clipboard

Avoid floating point precision when reading values from the sensor

Open huntc opened this issue 4 years ago • 1 comments

Should we make the following fields of the FieldData struct public?

    temperature: i16,
    pressure: u32,
    humidity: u32,
    gas_resistance: u32,

My first requirement is to encode these fields into a packet for wireless communication. I'd prefer to avoid the floating point functions such as temperature_celsius given the additionally complexity with decoding floating point precision (I'm thinking about a JS API for transforming data that is in my world).

Related: should I be concerned with just 20 bits of the u32s? I'm looking for the most compact representation of the above data.

huntc avatar Apr 29 '21 06:04 huntc

I have the same problem, don't want to use f32 on a Cortex M0.

Maybe I wouldn't make it public but add getters to the int values. But it's almost the same.

shufps avatar Jul 06 '24 07:07 shufps