WIP: initial support for fixed-point data for sensors#17408
WIP: initial support for fixed-point data for sensors#17408raiden00pl wants to merge 10 commits intoapache:masterfrom
Conversation
4dfeb92 to
8cd1558
Compare
5fdb41a to
329d6ff
Compare
0404a32 to
dde5a82
Compare
|
One more thing about this; we should investigate if b16 is ever too small for a sensor's resolution. I would imagine a) having those sensors depend on the float representation, so users can only use them with floats What do you think? |
|
It would be best to choose sensor units that make sense for both float and fixed-point. With this architecture it should be possible to add other data types for sensors, but using 64-bit data seems like a overkill to me. So far, the highest resolution of data in commercial available sensors that I have seen is 24 bits. |
|
Hi @raiden00pl: I'm testing a new way to Build PRs in Our Own NuttX Repos, wonder if you would like to try out, and give your feedback to @simbit18 and me? Thank you so much :-)
|
dde5a82 to
18a7abb
Compare
18a7abb to
6874545
Compare
new sensor framework can now select between float data type and fixed-point data type Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for bmp280_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for bmp180_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for hyt271_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for adxl362_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for adxl372_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for bh1749nuc_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for bmm150_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
support for fixed-point data for bmi270_uorb Signed-off-by: raiden00pl <raiden00@railab.me>
add sensors scope demo with fixed16 as sensor data type Signed-off-by: raiden00pl <raiden00@railab.me>
|
I'm hoping to try using this with an upcoming project; do you think we could add an option so that the user can choose between b16 and b32? I'm using a barometer in a rocket which should experience a pretty wide range of pressures, I'd like to avoid saturation but like the integer format. |



Summary
WIP code for fixed-math data type for sensors.
All sensor math operations will require modification to use
sensor_data_xxxmacros.At the moment, no sensor is modified to handle this properly. I'll probably choose the easiest sensor to port with a small amount of math operations to provide PoC.
EDIT: ported
bmp280_uorbto fixed-math, probably the easiest one :)Ultimately, all sensor units must be checked to see if the data unit make sense for the b16_t type.
Doing this work all at once is a lot of work which I don't want to do, so I suggest introducing this change gradually:
depends on SENSORS_USE_FLOATImpact
Testing