mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Fix incorrect DMA index for RSSI and Current.
The result was that RSSI and Current were transposed when both were used together.
This commit is contained in:
parent
5b236a8133
commit
56010f2da7
1 changed files with 13 additions and 13 deletions
|
@ -64,19 +64,6 @@ void adcInit(drv_adc_config_t *init)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CURRENT_METER_ADC_GPIO
|
|
||||||
if (init->enableCurrentMeter) {
|
|
||||||
GPIO_InitStructure.GPIO_Pin = CURRENT_METER_ADC_GPIO_PIN;
|
|
||||||
GPIO_Init(CURRENT_METER_ADC_GPIO, &GPIO_InitStructure);
|
|
||||||
|
|
||||||
adcConfig[ADC_CURRENT].adcChannel = CURRENT_METER_ADC_CHANNEL;
|
|
||||||
adcConfig[ADC_CURRENT].dmaIndex = adcChannelCount;
|
|
||||||
adcConfig[ADC_CURRENT].sampleTime = ADC_SampleTime_601Cycles5;
|
|
||||||
adcConfig[ADC_CURRENT].enabled = true;
|
|
||||||
adcChannelCount++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RSSI_ADC_GPIO
|
#ifdef RSSI_ADC_GPIO
|
||||||
if (init->enableRSSI) {
|
if (init->enableRSSI) {
|
||||||
GPIO_InitStructure.GPIO_Pin = RSSI_ADC_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = RSSI_ADC_GPIO_PIN;
|
||||||
|
@ -90,6 +77,19 @@ void adcInit(drv_adc_config_t *init)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CURRENT_METER_ADC_GPIO
|
||||||
|
if (init->enableCurrentMeter) {
|
||||||
|
GPIO_InitStructure.GPIO_Pin = CURRENT_METER_ADC_GPIO_PIN;
|
||||||
|
GPIO_Init(CURRENT_METER_ADC_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
|
adcConfig[ADC_CURRENT].adcChannel = CURRENT_METER_ADC_CHANNEL;
|
||||||
|
adcConfig[ADC_CURRENT].dmaIndex = adcChannelCount;
|
||||||
|
adcConfig[ADC_CURRENT].sampleTime = ADC_SampleTime_601Cycles5;
|
||||||
|
adcConfig[ADC_CURRENT].enabled = true;
|
||||||
|
adcChannelCount++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERNAL1_ADC_GPIO
|
#ifdef EXTERNAL1_ADC_GPIO
|
||||||
GPIO_InitStructure.GPIO_Pin = EXTERNAL1_ADC_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = EXTERNAL1_ADC_GPIO_PIN;
|
||||||
GPIO_Init(EXTERNAL1_ADC_GPIO, &GPIO_InitStructure);
|
GPIO_Init(EXTERNAL1_ADC_GPIO, &GPIO_InitStructure);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue