mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Make battery voltage / current filter cutoffs configurable.
This commit is contained in:
parent
c39ea81b6a
commit
3e1e467079
6 changed files with 25 additions and 15 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "string.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "build/debug.h"
|
||||
|
||||
|
@ -34,12 +35,13 @@
|
|||
|
||||
#include "pg/pg.h"
|
||||
#include "pg/pg_ids.h"
|
||||
#include "config/config_reset.h"
|
||||
|
||||
#include "sensors/adcinternal.h"
|
||||
#include "sensors/current.h"
|
||||
#include "sensors/battery.h"
|
||||
#include "sensors/esc_sensor.h"
|
||||
|
||||
#include "current.h"
|
||||
|
||||
const char * const currentMeterSourceNames[CURRENT_METER_COUNT] = {
|
||||
"NONE", "ADC", "VIRTUAL", "ESC", "MSP"
|
||||
};
|
||||
|
@ -86,7 +88,6 @@ void currentMeterReset(currentMeter_t *meter)
|
|||
// ADC/Virtual shared
|
||||
//
|
||||
|
||||
#define IBAT_LPF_FREQ 2.0f
|
||||
static biquadFilter_t adciBatFilter;
|
||||
|
||||
#ifndef CURRENT_METER_SCALE_DEFAULT
|
||||
|
@ -140,7 +141,7 @@ currentMeterADCState_t currentMeterADCState;
|
|||
void currentMeterADCInit(void)
|
||||
{
|
||||
memset(¤tMeterADCState, 0, sizeof(currentMeterADCState_t));
|
||||
biquadFilterInitLPF(&adciBatFilter, IBAT_LPF_FREQ, HZ_TO_INTERVAL_US(50));
|
||||
biquadFilterInitLPF(&adciBatFilter, GET_BATTERY_LPF_FREQUENCY(batteryConfig()->ibatLpfPeriod), HZ_TO_INTERVAL_US(50));
|
||||
}
|
||||
|
||||
void currentMeterADCRefresh(int32_t lastUpdateAt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue