Closed BjarneBitscrambler closed 3 years ago
Only used structs are instantiated; the rest are only declared. Memory use is decreased simply by not using any of the lower-order fusion algorithms, which was accomplished by using the #defines in build.h
to turn off all except the 9DOF algorithm.
If one wanted to use all the algorithms, while still saving some memory, then it might be worthwhile combining the structs into one. This would, however, preclude running all the algorithms in parallel.
The fusion code has 7 different algorithms (with various combinations of accel, gyro, and magnetometer sensors, plus complexity). Each algorithm deposits its results in its own struct, named on the pattern SV_xxxx (e.g. SV_6DOF_GB_BASIC).
All these structs are part of the sensor fusion global
sfg
object. We could decrease memory used by creating a union of these structs and access them through a SV_COMMON struct. This might also reduce the number of conditional compilation #ifdef - #endif code blocks.