auto-sync

This commit is contained in:
rusEfi 2016-01-31 16:01:26 -05:00
parent 17dc1af997
commit 4d45716cc9
5 changed files with 24 additions and 14 deletions

View File

@ -240,6 +240,8 @@ static void periodicSlowCallback(Engine *engine) {
* listeners we invoke them from here.
*/
engine->configurationListeners.invokeJustArgCallbacks();
// todo: convert to a callback?
updateAccelParameters();
}
engine->watchdog();

View File

@ -95,8 +95,8 @@ int getTPS10bitAdc(DECLARE_ENGINE_PARAMETER_F) {
/**
* @brief Position on physical primary TPS
*/
static float getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) {
float tpsValue = getTpsValue(getTPS10bitAdc(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
static percent_t getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) {
percent_t tpsValue = getTpsValue(getTPS10bitAdc(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
return tpsValue;
}

View File

@ -25,6 +25,11 @@
#include "board_test.h"
#include "engine_controller.h"
/* Depth of the conversion buffer, channels are sampled X times each.*/
#define ADC_BUF_DEPTH_SLOW 8
#define ADC_BUF_DEPTH_FAST 4
static adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX];
static const char * adcHwChannelUsage[HW_MAX_ADC_INDEX];
@ -206,7 +211,10 @@ int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) {
if (adcHwChannelEnabled[hwChannel] == ADC_FAST) {
int internalIndex = fastAdc.internalAdcIndexByHardwareIndex[hwChannel];
return fastAdc.samples[internalIndex];
// todo if ADC_BUF_DEPTH_FAST EQ 1
// return fastAdc.samples[internalIndex];
int value = getAvgAdcValue(internalIndex, fastAdc.samples, ADC_BUF_DEPTH_FAST, fastAdc.size());
return value;
}
if (adcHwChannelEnabled[hwChannel] != ADC_SLOW) {
warning(OBD_PCM_Processor_Fault, "ADC is off [%s] index=%d", msg, hwChannel);
@ -504,6 +512,10 @@ static void configureInputs(void) {
void initAdcInputs(bool boardTestMode) {
printMsg(&logger, "initAdcInputs()");
if (ADC_BUF_DEPTH_FAST > MAX_ADC_GRP_BUF_DEPTH)
firmwareError("ADC_BUF_DEPTH_FAST too high");
if (ADC_BUF_DEPTH_SLOW > MAX_ADC_GRP_BUF_DEPTH)
firmwareError("ADC_BUF_DEPTH_SLOW too high");
configureInputs();

View File

@ -26,10 +26,6 @@ int getAdcHardwareIndexByInternalIndex(int index);
void printFullAdcReportIfNeeded(void);
int getInternalAdcValue(const char *msg, adc_channel_e index);
/* Depth of the conversion buffer, channels are sampled X times each.*/
#define ADC_BUF_DEPTH_SLOW 8
#define ADC_BUF_DEPTH_FAST 1
// max(ADC_BUF_DEPTH_SLOW, ADC_BUF_DEPTH_FAST)
#define MAX_ADC_GRP_BUF_DEPTH 8

View File

@ -41,7 +41,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 29 20:39:58 EST 2016
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jan 31 12:30:25 EST 2016
pageSize = 16088
page = 1
@ -504,10 +504,10 @@ page = 1
alternatorControl_pFactor = scalar, F32, 2172, "value", 1, 0, 0, 1000, 2
alternatorControl_iFactor = scalar, F32, 2176, "value", 1, 0, 0, 1000, 2
alternatorControl_dFactor = scalar, F32, 2180, "value", 1, 0, 0, 1000, 2
tpsAccelLength = scalar, S32, 2184, "len", 1, 0, 1, 200, 3
tpsAccelLength = scalar, S32, 2184, "cycles", 1, 0, 1, 200, 0
tpsAccelEnrichmentThreshold = scalar, F32, 2188, "roc", 1, 0, 0, 200, 3
tpsAccelEnrichmentMultiplier = scalar, F32, 2192, "coeff", 1, 0, 0, 200, 3
engineLoadAccelLength = scalar, S32, 2196, "len", 1, 0, 1, 200, 3
engineLoadAccelLength = scalar, S32, 2196, "cycles", 1, 0, 1, 200, 0
engineLoadDecelEnleanmentThreshold = scalar, F32, 2200, "roc", 1, 0, 0, 200, 3
engineLoadDecelEnleanmentMultiplier = scalar, F32, 2204, "coeff", 1, 0, 0, 200, 3
engineLoadAccelEnrichmentThreshold = scalar, F32, 2208, "roc", 1, 0, 0, 200, 3
@ -894,7 +894,7 @@ fileVersion = { 20160122 }
#endif
throttleGauge = TPS, "Throttle Position", "%", 0, 100, 0, 0, 100, 100, 0, 0
throttleGauge = TPS, "Throttle Position", "%", 0, 100, 0, 0, 100, 100, 2, 2
afr1Gauge = AFRactual, "Air:Fuel Ratio 1", "", 10, 19.4, 12, 13, 15, 16, 2, 2
mafGaugeVolts = MAF, "Mass Air Flow", "v", 0, 5, 0, 1, 3, 4, 1, 1
VBattGauge = VBatt, "Battery Voltage", "V", 8, 21, 9, 10, 17, 19, 1, 1
@ -917,7 +917,7 @@ fileVersion = { 20160122 }
rpmAccelerationGa = rpmAcceleration, "rpm delta", "dRpm", 0, 3, 0, 1, 3, 4, 1, 1
massAirFlowValueGa = massAirFlowValue,"Air Flow", "kg/hr", 0, 50, -999, -999, 999, 999, 1, 1
veValueGauge = veValue, "fuel: VE", "", 0, 120, 10, 10, 100, 100, 1, 1
deltaTpsGauge = deltaTps, "fuel: tps delta", "", 0, 120, 10, 10, 100, 100, 1, 1
deltaTpsGauge = deltaTps, "fuel: TPS delta", "", 0, 120, 10, 10, 100, 100, 1, 1
baroCorrectionGauge = baroCorrection,"BaroCorr", "%", 0, 120, 10, 10, 100, 100, 1, 1
pedalPositionGauge = pedalPosition,"Pedal Position", "%", 0, 120, 10, 10, 100, 100, 1, 1
knockCountGauge = knockCount,"Knock count", "count", 0, 120, 10, 10, 100, 100, 1, 1
@ -994,7 +994,7 @@ fileVersion = { 20160122 }
entry = rpm, "RPM", int, "%d"
entry = coolant, "CLT", float, "%.2f"
entry = intake, "IAT", float, "%.2f"
entry = TPS, "TPS", float, "%d"
entry = TPS, "TPS", float, "%.2f"
entry = MAF, "MAF", float, "%.2f"
entry = MAPValue, "MAP", float, "%.1f"
entry = AFRactual, "AFR", float, "%.2f"
@ -1008,7 +1008,7 @@ fileVersion = { 20160122 }
entry = pedalPosition, "pedal", float, "%.3f"
entry = triggerErrorsCounter, "trg err",int, "%d"
entry = pulseWidth, "injPulse", float, "%.3f"
entry = pulseWidth, "fuel: pulse", float, "%.3f"
entry = baseFuel, "fuel: base", float, "%.2f"
entry = veValue, "fuel: VE", float, "%.3f"
entry = engineLoadAccelDelta, "fuel: EL delta",float, "%.3f"