1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Gyro Speed selectable through Gui by Looptime setting

This commit is contained in:
borisbstyle 2016-02-03 11:57:12 +01:00
parent 63dcc3dc1d
commit 3fc0d85003

View file

@ -1203,6 +1203,7 @@ static bool processInCommand(void)
uint32_t i; uint32_t i;
uint16_t tmp; uint16_t tmp;
uint8_t rate; uint8_t rate;
uint16_t gyroRefreshRate;
#ifdef GPS #ifdef GPS
uint8_t wp_no; uint8_t wp_no;
int32_t lat = 0, lon = 0, alt = 0; int32_t lat = 0, lon = 0, alt = 0;
@ -1247,7 +1248,34 @@ static bool processInCommand(void)
masterConfig.disarm_kill_switch = read8(); masterConfig.disarm_kill_switch = read8();
break; break;
case MSP_SET_LOOP_TIME: case MSP_SET_LOOP_TIME:
read16(); gyroRefreshRate = read16();
if (gyroRefreshRate != targetLooptime) {
switch (gyroRefreshRate) {
#ifdef STM32F303xC
default:
case(1000):
masterConfig.gyro_lpf = 1;
break;
case(500):
masterConfig.gyro_lpf = 0;
break;
#else
default:
case(1000):
masterConfig.gyro_lpf = 1;
masterConfig.acc_hardware = 0;
masterConfig.baro_hardware = 0;
masterConfig.mag_hardware = 0;
break;
case(500):
masterConfig.gyro_lpf = 0;
masterConfig.acc_hardware = 1;
masterConfig.baro_hardware = 1;
masterConfig.mag_hardware = 1;
break;
#endif
}
}
break; break;
case MSP_SET_PID_CONTROLLER: case MSP_SET_PID_CONTROLLER:
currentProfile->pidProfile.pidController = constrain(read8(), 1, 2); currentProfile->pidProfile.pidController = constrain(read8(), 1, 2);