FastIMU icon indicating copy to clipboard operation
FastIMU copied to clipboard

Fixed compilation warnings

Open floBik opened this issue 1 year ago • 3 comments

Removed unnecessary magReading variable in F_BMX055.cpp because it generated a warning that caused problems with some compiler setups. The initialisation of AccelData, GyroData, MagData and calData has been refactored as it was also generating warnings.

floBik avatar Jun 17 '24 11:06 floBik

Hey @LiquidCGS,

Could you take a look at this PR to see if it works for you or if it needs some tweaking?

floBik avatar Aug 27 '24 11:08 floBik

Also on RISC-V (ES32-C3) the zero-initialisation causes lots of warnings about incorrect initialisation. The suggested solution however would create a problem when a new variable is added to the struct.

As a suggestion, I would rather create some defines in IMUBase.hpp


#define ACCELDATA_ZERO  { 0, 0, 0 }
#define GYRODATA_ZERO   { 0, 0, 0 }
#define CALDATA_ZERO    {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}

FedericoBusero avatar Mar 16 '25 11:03 FedericoBusero

Also on RISC-V (ES32-C3) the zero-initialisation causes lots of warnings about incorrect initialisation. The suggested solution however would create a problem when a new variable is added to the struct.

As a suggestion, I would rather create some defines in IMUBase.hpp


#define ACCELDATA_ZERO  { 0, 0, 0 }
#define GYRODATA_ZERO   { 0, 0, 0 }
#define CALDATA_ZERO    {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}

And

AccelData accel = { 0 }; GyroData gyro = { 0 };

to

AccelData accel = { 0.0f, 0.0f, 0.0f }; GyroData gyro = { 0.0f, 0.0f, 0.0f };

rafaelcamacho avatar May 24 '25 20:05 rafaelcamacho