Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElectronicCats, switch initialize method #87

Closed
stefcarpi opened this issue Oct 7, 2024 · 3 comments
Closed

ElectronicCats, switch initialize method #87

stefcarpi opened this issue Oct 7, 2024 · 3 comments
Assignees

Comments

@stefcarpi
Copy link
Contributor

stefcarpi commented Oct 7, 2024

In the initialize method there is no break statement in the switch for accelRange and gyroRange: the resolution is always set to the maximum available range. It should be fixed.

`

void MPU6050_Base::initialize(ACCEL_FS accelRange, GYRO_FS gyroRange) {
setClockSource(MPU6050_CLOCK_PLL_XGYRO);

switch (accelRange) 
{
case ACCEL_FS::A2G:
    setFullScaleAccelRange(MPU6050_ACCEL_FS_2);
    accelerationResolution = 2.0 / 16384.0;

case ACCEL_FS::A4G:
    setFullScaleAccelRange(MPU6050_ACCEL_FS_4);
    accelerationResolution = 4.0 / 16384.0;

case ACCEL_FS::A8G:
    setFullScaleAccelRange(MPU6050_ACCEL_FS_8);
    accelerationResolution = 8.0 / 16384.0;

case ACCEL_FS::A16G:
    setFullScaleAccelRange(MPU6050_ACCEL_FS_16);
    accelerationResolution = 16.0 / 16384.0;
}

switch (gyroRange) 
{
case GYRO_FS::G250DPS:
    setFullScaleGyroRange(MPU6050_GYRO_FS_250);
    gyroscopeResolution = 250.0 / 16384.0;

case GYRO_FS::G500DPS:
    setFullScaleGyroRange(MPU6050_GYRO_FS_500);
    gyroscopeResolution = 500.0 / 16384.0;

case GYRO_FS::G1000DPS:
    setFullScaleGyroRange(MPU6050_GYRO_FS_1000);
    gyroscopeResolution = 1000.0 / 16384.0;

case GYRO_FS::G2000DPS:
    setFullScaleGyroRange(MPU6050_GYRO_FS_2000);
    gyroscopeResolution = 2000.0 / 16384.0;
}

setSleepEnabled(false); // thanks to Jack Elston for pointing this one out!

}`

@Eric286
Copy link
Contributor

Eric286 commented Oct 7, 2024

Hello @stefcarpi

Thank you for pointing this out!

We’ll review this with our team to ensure it's addressed properly.

If you notice anything else or have further suggestions, feel free to let us know. We appreciate your feedback!

Best regards,

@stefcarpi
Copy link
Contributor Author

Hello!
Ok, thanks, I've made a pull request to fix this,
cheers!

@sabas1080
Copy link
Member

#88

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

No branches or pull requests

3 participants