WIP: Multi gyro support#5762
Conversation
…GHTF7_TWING/config.c!
digitalentity
left a comment
There was a problem hiding this comment.
Review round 1.
I think we should treat read/calibration operations as using multiple sensors all the time - including averaging etc. Best approach would be to unify and decouple read/calibrate code from gyroDev alltogether.
I think we should have a list of gyros, but I can refactor that once we get iteration one working.
| case SECOND: | ||
| #ifdef USE_DUAL_GYRO | ||
| gyroDev[0].imuSensorToUse = gyroConfig()->gyro_to_use; | ||
| gyroDev[0].imuSensorToUse = gyroConfig()->gyro_to_use; |
There was a problem hiding this comment.
This is potentially unsafe if in future we introduce more possible values.
There was a problem hiding this comment.
True. I think same applies to accelerometer also.
|
|
||
| case MSP_SENSOR_ALIGNMENT: | ||
| sbufWriteU8(dst, gyroConfig()->gyro_align); | ||
| sbufWriteU8(dst, gyroConfig()->gyro2_align); |
There was a problem hiding this comment.
This will require Configurator support as well. I recommend adding new fields to the end of MSP frame.
There was a problem hiding this comment.
I will remove gyro2_align and acc2_align from fc_msp.
| case MSP_SET_SENSOR_ALIGNMENT: | ||
| if (dataSize >= 4) { | ||
| gyroConfigMutable()->gyro_align = sbufReadU8(src); | ||
| gyroConfigMutable()->gyro2_align = sbufReadU8(src); |
There was a problem hiding this comment.
This is unsafe. If we receive a legacy frame of old format, this will cause incorrect values to be set. Move the new fields to the end of the frame and use dataSize to check if we have received an old/new frame and act accordingly.
WIP & experimental