mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-1227 Fix high CPU usage: Change gyro oversampling to 46 (400Hz update rate) to lessen the cpu load and jitter due accel rate mismatch
This commit is contained in:
parent
7acb0ad385
commit
52c1d69c19
@ -242,7 +242,7 @@ static void AttitudeTask(__attribute__((unused)) void *parameters)
|
||||
gyro_queue = xQueueCreate(1, sizeof(float) * 4);
|
||||
PIOS_Assert(gyro_queue != NULL);
|
||||
PIOS_ADC_SetQueue(gyro_queue);
|
||||
PIOS_ADC_Config((PIOS_ADC_RATE / 1000.0f) * UPDATE_RATE);
|
||||
PIOS_ADC_Config(46);
|
||||
#endif
|
||||
}
|
||||
// Force settings update to make sure rotation loaded
|
||||
@ -401,7 +401,6 @@ static int32_t updateSensors(AccelStateData *accelState, GyroStateData *gyros)
|
||||
accelState->y = accel[1];
|
||||
accelState->z = accel[2];
|
||||
}
|
||||
|
||||
if (trim_requested) {
|
||||
if (trim_samples >= MAX_TRIM_FLIGHT_SAMPLES) {
|
||||
trim_requested = false;
|
||||
|
@ -455,7 +455,7 @@ static const struct pios_adc_cfg pios_adc_cfg = {
|
||||
.flags = (DMA1_FLAG_TC1 | DMA1_FLAG_TE1 | DMA1_FLAG_HT1 | DMA1_FLAG_GL1),
|
||||
.init = {
|
||||
.NVIC_IRQChannel = DMA1_Channel1_IRQn,
|
||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
|
||||
.NVIC_IRQChannelSubPriority = 0,
|
||||
.NVIC_IRQChannelCmd = ENABLE,
|
||||
},
|
||||
|
@ -210,7 +210,7 @@ extern uint32_t pios_com_hkosd_id;
|
||||
// PCKL2 = HCLK / 16
|
||||
// ADCCLK = PCLK2 / 2
|
||||
#define PIOS_ADC_RATE (72.0e6f / 1.0f / 8.0f / 252.0f / (PIOS_ADC_NUM_CHANNELS >> PIOS_ADC_USE_ADC2))
|
||||
#define PIOS_ADC_MAX_OVERSAMPLING 36
|
||||
#define PIOS_ADC_MAX_OVERSAMPLING 48
|
||||
|
||||
#define PIOS_ADC_TEMPERATURE_PIN 0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user