auto-sync

This commit is contained in:
rusEfi 2016-09-10 22:03:38 -04:00
parent 4a571e3a7b
commit 5212e2b28d
4 changed files with 17 additions and 3 deletions

View File

@ -409,8 +409,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
* TPS
*/
engineConfiguration->tpsAdcChannel = EFI_ADC_2;
engineConfiguration->tpsMax = 125; // convert 12to10 bit (ADC/4)
engineConfiguration->tpsMin = 625; // convert 12to10 bit (ADC/4)
engineConfiguration->tpsMax = 625; // convert 12to10 bit (ADC/4)
engineConfiguration->tpsMin = 125; // convert 12to10 bit (ADC/4)
/**
* IAT D15/W7

View File

@ -17,6 +17,11 @@ Biquad::Biquad() {
z1 = z2 = 0;
}
void Biquad::initValue(float input) {
z1 = input * (1 - a0);
z2 = input * (1 - a0 - a1 + b1);
}
float Biquad::getValue(float input) {
float result = input * a0 + z1;
z1 = input * a1 + z2 - b1 * result;

View File

@ -11,6 +11,7 @@
class Biquad {
public:
Biquad();
void initValue(float input);
float getValue(float input);
float a0, a1, a2, b1, b2;

View File

@ -25,11 +25,13 @@
#include "board_test.h"
#include "engine_controller.h"
#include "maf.h"
#include "biquad.h"
/* Depth of the conversion buffer, channels are sampled X times each.*/
#define ADC_BUF_DEPTH_SLOW 8
#define ADC_BUF_DEPTH_FAST 4
Biquad biq[ADC_MAX_CHANNELS_COUNT];
static adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX];
static const char * adcHwChannelUsage[HW_MAX_ADC_INDEX];
@ -489,8 +491,14 @@ static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
for (int i = 0; i < slowAdc.size(); i++) {
int value = getAvgAdcValue(i, slowAdc.samples, ADC_BUF_DEPTH_SLOW, slowAdc.size());
adcsample_t prev = slowAdc.values.adc_data[i];
slowAdc.values.adc_data[i] = (slowAdcCounter == 0) ? value :
float result = (slowAdcCounter == 0) ? value :
CONFIG(slowAdcAlpha) * value + (1 - CONFIG(slowAdcAlpha)) * prev;
// if (slowAdcCounter == 0) {
// biq[i].initValue(value);
// }
// float result = biq[i].getValue(value);
slowAdc.values.adc_data[i] = result;
}
slowAdcCounter++;
}