-
Notifications
You must be signed in to change notification settings - Fork 43
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
First draft for BMI088 driver #200
base: master
Are you sure you want to change the base?
Conversation
src/main/msp/msp.c
Outdated
scale = 8; | ||
} else if (acc.dev.acc_1G > 512 * 2) { | ||
scale = 4; | ||
} else if (acc.dev.acc_1G >= 512) { | ||
scale = 2; | ||
} else { | ||
}else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unncessary change
* | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IS this driver going to Betaflight too? If so, then this copyright is ok.
If this is for Rotorflight only, then please use Rotorflight one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intitially I planned to add the code to betaflight aswell, but I will add the RF copyright for now.
src/main/msp/msp.c
Outdated
scale = 1; | ||
} | ||
#endif | ||
|
||
for (int i = 0; i < 3; i++) { | ||
#if defined(USE_ACC) | ||
sbufWriteU16(dst, lrintf(acc.accADC[i] / scale)); | ||
sbufWriteU16(dst, lrintf((int16_t)acc.accADC[i] / scale)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this is for. Can. you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this corssesponds to the change above, for getting the ACC scaling right in the configurator. In case that is not neededl, both changes are unnecessary. So for getting the scaling of ACC right in the configurator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I am following. acc.accADC is a float. The scale variable used to be uint8_t, but you changed it to float. Why do you need to convert accADC to integer before dividing it by the scale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would understand if the (int16_t) was before the lrintf() function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, don't know why I introduced that cast. Doesn't make sense like that in the end.
I changed the scaling to float, since the scaling with +-12G is not an integer anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments about the MSP
removed the unneressary cast, is anything else left to be done? |
BMI088 consists of an ACC and Gyro digital part which are tied to the same SPI bus but require separate CS lines.
This required some hacks, since the current architecture trears the IMU as one device/component. This PR tires to intorduce an andditional CS pin without braking support for the other IMUs.
Tested with custom hardware for BMI088 adn RF configurator.
Open tests: