iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.14k stars 1.48k forks source link

Force gyro_sync_denom=8 when gyro_lpf=256HZ #321

Closed DzikuVx closed 7 years ago

DzikuVx commented 8 years ago

As a result of awesome investigation by @theArchLadder in #218 , force gyro_sync_denom=8 when gyro_lpf=256HZ. This is because gyro enters 8kHz mode and higher denominator is required to keep looptime in reasonable ranges

theArchLadder commented 8 years ago

Can F1 targets use looptime of 1000? If not, it may make more sense to multiply gyro_sync_denom by 8 when 256hz is used. That way gyro_sync_denom=1 will give a looptime of 1000 and gyro_sync_denom=2 will give a looptime of 2000, like it usually is...

DzikuVx commented 8 years ago

Nope, F1 can not reach that low. Last time I checked it was about 1400us. But we can force gyro_sync_denom=16 depending on target

martinbudden commented 8 years ago

The defaults in betaflight are:

    masterConfig.gyro_lpf = 0;                 // 256HZ default
#ifdef STM32F10X
    masterConfig.gyro_sync_denom = 8;
#else
    masterConfig.gyro_sync_denom = 4;
#endif

There is also msp code to set values according to looptime: https://github.com/betaflight/betaflight/blob/betaflight/src/main/io/serial_msp.c#L108-L174

Remember also betaflight can switch off hardware (baro, compass, accelerometer) to achieve faster looptimes - normally this is not desired in iNav!

DzikuVx commented 7 years ago

With latest changes to Configurator, this ticket is obsolete. Configurator allows only to set correct values via GUI