mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Cleaned up parameter group handling.
Fixed missing include.
This commit is contained in:
parent
9eb83d1e5f
commit
09d396c05c
41 changed files with 125 additions and 157 deletions
|
@ -133,11 +133,19 @@ void currentMeterADCInit(void)
|
|||
|
||||
void currentMeterADCRefresh(int32_t lastUpdateAt)
|
||||
{
|
||||
#ifdef USE_ADC
|
||||
const uint16_t iBatSample = adcGetChannel(ADC_CURRENT);
|
||||
currentMeterADCState.amperageLatest = currentMeterADCToCentiamps(iBatSample);
|
||||
currentMeterADCState.amperage = currentMeterADCToCentiamps(biquadFilterApply(&adciBatFilter, iBatSample));
|
||||
|
||||
updateCurrentmAhDrawnState(¤tMeterADCState.mahDrawnState, currentMeterADCState.amperageLatest, lastUpdateAt);
|
||||
#else
|
||||
UNUSED(lastUpdateAt);
|
||||
UNUSED(currentMeterADCToCentiamps);
|
||||
|
||||
currentMeterADCState.amperageLatest = 0;
|
||||
currentMeterADCState.amperage = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void currentMeterADCRead(currentMeter_t *meter)
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "pg/pg.h"
|
||||
|
||||
#include "drivers/rangefinder/rangefinder.h"
|
||||
|
||||
#include "pg/pg.h"
|
||||
|
||||
typedef enum {
|
||||
RANGEFINDER_NONE = 0,
|
||||
RANGEFINDER_HCSR04 = 1,
|
||||
|
|
|
@ -144,9 +144,10 @@ STATIC_UNIT_TESTED uint16_t voltageAdcToVoltage(const uint16_t src, const voltag
|
|||
void voltageMeterADCRefresh(void)
|
||||
{
|
||||
for (uint8_t i = 0; i < MAX_VOLTAGE_SENSOR_ADC && i < ARRAYLEN(voltageMeterAdcChannelMap); i++) {
|
||||
voltageMeterADCState_t *state = &voltageMeterADCStates[i];
|
||||
#ifdef USE_ADC
|
||||
// store the battery voltage with some other recent battery voltage readings
|
||||
|
||||
voltageMeterADCState_t *state = &voltageMeterADCStates[i];
|
||||
const voltageSensorADCConfig_t *config = voltageSensorADCConfig(i);
|
||||
|
||||
uint8_t channel = voltageMeterAdcChannelMap[i];
|
||||
|
@ -157,6 +158,12 @@ void voltageMeterADCRefresh(void)
|
|||
// always calculate the latest voltage, see getLatestVoltage() which does the calculation on demand.
|
||||
state->voltageFiltered = voltageAdcToVoltage(filteredSample, config);
|
||||
state->voltageUnfiltered = voltageAdcToVoltage(rawSample, config);
|
||||
#else
|
||||
UNUSED(voltageAdcToVoltage);
|
||||
|
||||
state->voltageFiltered = 0;
|
||||
state->voltageUnfiltered = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue