Skip to content

Conversation

@floBik
Copy link
Contributor

@floBik floBik commented Jun 17, 2024

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 floBik force-pushed the main branch 3 times, most recently from 639cd56 to 4f2e818 Compare June 27, 2024 11:07
@floBik floBik changed the title Removed unnecessary variable in BMX055.cpp Removed compilation warnings Jun 27, 2024
@floBik floBik changed the title Removed compilation warnings Fixed compilation warnings Jun 27, 2024
@floBik
Copy link
Contributor Author

floBik commented Aug 27, 2024

Hey @LiquidCGS,

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

@FedericoBusero
Copy link

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}}

@rafaelcamacho
Copy link

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 };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants