auto-sync

This commit is contained in:
rusEfi 2015-04-11 00:04:25 -05:00
parent fe488d9684
commit 55859f8073
11 changed files with 33 additions and 18 deletions

View File

@ -333,7 +333,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
boardConfiguration->adcHwChannelEnabled[12] = ADC_SLOW; // CLT boardConfiguration->adcHwChannelEnabled[12] = ADC_SLOW; // CLT
boardConfiguration->adcHwChannelEnabled[13] = ADC_SLOW; // AFR boardConfiguration->adcHwChannelEnabled[13] = ADC_SLOW; // AFR
boardConfiguration->adcHwChannelEnabled[14] = ADC_SLOW; // VBatt boardConfiguration->adcHwChannelEnabled[14] = ADC_SLOW; // VBatt
boardConfiguration->adcHwChannelEnabled[15] = ADC_SLOW; // TPS boardConfiguration->adcHwChannelEnabled[15] = ADC_FAST; // TPS
/** /**

View File

@ -556,9 +556,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->manifold_air_pressure = getMap(); tsOutputChannels->manifold_air_pressure = getMap();
tsOutputChannels->engineLoad = engineLoad; tsOutputChannels->engineLoad = engineLoad;
tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration(); tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
tsOutputChannels->maxDelta = engine->accelEnrichment.maxDelta; tsOutputChannels->maxDelta = engine->mapAccelEnrichment.maxDelta;
tsOutputChannels->minDelta = engine->accelEnrichment.minDelta; tsOutputChannels->minDelta = engine->mapAccelEnrichment.minDelta;
tsOutputChannels->currentMapAccelDelta = engine->accelEnrichment.getEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap(); tsOutputChannels->currentMapAccelDelta = engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
tsOutputChannels->checkEngine = hasErrorCodes(); tsOutputChannels->checkEngine = hasErrorCodes();
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)

View File

@ -21,8 +21,6 @@ EXTERN_ENGINE
//static THD_WORKING_AREA(aeThreadStack, UTILITY_THREAD_STACK_SIZE); //static THD_WORKING_AREA(aeThreadStack, UTILITY_THREAD_STACK_SIZE);
//#endif //#endif
static AccelEnrichmemnt mapInstance;
static AccelEnrichmemnt tpsInstance;
static Logging *logger; static Logging *logger;
void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfiguration, float engineLoad) { void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfiguration, float engineLoad) {
@ -39,7 +37,7 @@ void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfig
// return diffEnrichment; // return diffEnrichment;
//} //}
float AccelEnrichmemnt::getEnrichment(DECLARE_ENGINE_PARAMETER_F) { float AccelEnrichmemnt::getMapEnrichment(DECLARE_ENGINE_PARAMETER_F) {
float d = cb.maxValue(cb.getSize()); float d = cb.maxValue(cb.getSize());
if (d > engineConfiguration->mapAccelEnrichmentThreshold) { if (d > engineConfiguration->mapAccelEnrichmentThreshold) {
return d * engineConfiguration->mapAccelEnrichmentMultiplier; return d * engineConfiguration->mapAccelEnrichmentMultiplier;
@ -57,6 +55,11 @@ void AccelEnrichmemnt::reset() {
currentEngineLoad = NAN; currentEngineLoad = NAN;
} }
void AccelEnrichmemnt::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F) {
float tps = getTPS();
cb.add(delta);
}
void AccelEnrichmemnt::onEngineCycle(DECLARE_ENGINE_PARAMETER_F) { void AccelEnrichmemnt::onEngineCycle(DECLARE_ENGINE_PARAMETER_F) {
float currentEngineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F); float currentEngineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
@ -105,11 +108,11 @@ AccelEnrichmemnt::AccelEnrichmemnt() {
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) #if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
static void accelInfo() { static void accelInfo() {
scheduleMsg(logger, "MAP accel length=%d", mapInstance.cb.getSize()); // scheduleMsg(logger, "MAP accel length=%d", mapInstance.cb.getSize());
scheduleMsg(logger, "MAP accel th=%f/mult=%f", engineConfiguration->mapAccelEnrichmentThreshold, engineConfiguration->mapAccelEnrichmentMultiplier); scheduleMsg(logger, "MAP accel th=%f/mult=%f", engineConfiguration->mapAccelEnrichmentThreshold, engineConfiguration->mapAccelEnrichmentMultiplier);
scheduleMsg(logger, "MAP decel th=%f/mult=%f", engineConfiguration->decelEnrichmentThreshold, engineConfiguration->decelEnrichmentMultiplier); scheduleMsg(logger, "MAP decel th=%f/mult=%f", engineConfiguration->decelEnrichmentThreshold, engineConfiguration->decelEnrichmentMultiplier);
scheduleMsg(logger, "TPS accel length=%d", tpsInstance.cb.getSize()); // scheduleMsg(logger, "TPS accel length=%d", tpsInstance.cb.getSize());
scheduleMsg(logger, "TPS accel th=%f/mult=%f", engineConfiguration->tpsAccelEnrichmentThreshold, engineConfiguration->tpsAccelEnrichmentMultiplier); scheduleMsg(logger, "TPS accel th=%f/mult=%f", engineConfiguration->tpsAccelEnrichmentThreshold, engineConfiguration->tpsAccelEnrichmentMultiplier);
} }
@ -144,12 +147,12 @@ static void setDecelMult(float value) {
} }
static void setTpsAccelLen(int len) { static void setTpsAccelLen(int len) {
tpsInstance.cb.setSize(len); engine->tpsAccelEnrichment.cb.setSize(len);
accelInfo(); accelInfo();
} }
static void setMapAccelLen(int len) { static void setMapAccelLen(int len) {
mapInstance.cb.setSize(len); engine->mapAccelEnrichment.cb.setSize(len);
accelInfo(); accelInfo();
} }

View File

@ -20,10 +20,12 @@ public:
AccelEnrichmemnt(); AccelEnrichmemnt();
void updateDiffEnrichment(engine_configuration_s *engineConfiguration, void updateDiffEnrichment(engine_configuration_s *engineConfiguration,
float engineLoad); float engineLoad);
float getEnrichment(DECLARE_ENGINE_PARAMETER_F); float getMapEnrichment(DECLARE_ENGINE_PARAMETER_F);
float getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F);
// float getDiffEnrichment(void); // float getDiffEnrichment(void);
void onEngineCycle(DECLARE_ENGINE_PARAMETER_F); void onEngineCycle(DECLARE_ENGINE_PARAMETER_F);
void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F);
void reset(); void reset();
float currentEngineLoad; float currentEngineLoad;
float maxDelta; float maxDelta;

View File

@ -133,7 +133,8 @@ public:
Thermistor iat; Thermistor iat;
Thermistor clt; Thermistor clt;
AccelEnrichmemnt accelEnrichment; AccelEnrichmemnt mapAccelEnrichment;
AccelEnrichmemnt tpsAccelEnrichment;
/** /**
* Fuel injection duration for current engine cycle * Fuel injection duration for current engine cycle

View File

@ -76,7 +76,7 @@ float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
if (engineConfiguration->algorithm == LM_SPEED_DENSITY) { if (engineConfiguration->algorithm == LM_SPEED_DENSITY) {
return getSpeedDensityFuel(rpm PASS_ENGINE_PARAMETER); return getSpeedDensityFuel(rpm PASS_ENGINE_PARAMETER);
} else if (engineConfiguration->algorithm == LM_REAL_MAF) { } else if (engineConfiguration->algorithm == LM_REAL_MAF) {
float maf = getRealMaf(PASS_ENGINE_PARAMETER_F) + engine->accelEnrichment.getEnrichment(PASS_ENGINE_PARAMETER_F); float maf = getRealMaf(PASS_ENGINE_PARAMETER_F) + engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F);
return getRealMafFuel(maf, rpm PASS_ENGINE_PARAMETER); return getRealMafFuel(maf, rpm PASS_ENGINE_PARAMETER);
} else { } else {
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F); float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);

View File

@ -395,7 +395,8 @@ static void setFloat(const char *offsetStr, const char *valueStr) {
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
static void resetAccel(void) { static void resetAccel(void) {
engine->accelEnrichment.reset(); engine->mapAccelEnrichment.reset();
engine->tpsAccelEnrichment.reset();
} }
#endif #endif

View File

@ -85,7 +85,7 @@ float getSpeedDensityFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
float coolantC = engine->engineState.clt; float coolantC = engine->engineState.clt;
float intakeC = engine->engineState.iat; float intakeC = engine->engineState.iat;
float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC)); float tChargeK = convertCelsiusToKelvin(getTCharge(rpm, tps, coolantC, intakeC));
float map = getMap() + engine->accelEnrichment.getEnrichment(PASS_ENGINE_PARAMETER_F); float map = getMap() + engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F);
/** /**
* *0.01 because of https://sourceforge.net/p/rusefi/tickets/153/ * *0.01 because of https://sourceforge.net/p/rusefi/tickets/153/
*/ */

View File

@ -17,6 +17,8 @@
*/ */
static tps_roc_s states[2]; static tps_roc_s states[2];
int tpsFastAdc = 0;
static volatile int tpsRocIndex = 0; static volatile int tpsRocIndex = 0;
/** /**
@ -85,6 +87,10 @@ int getTPS10bitAdc(DECLARE_ENGINE_PARAMETER_F) {
#endif #endif
if(engineConfiguration->tpsAdcChannel==EFI_ADC_NONE) if(engineConfiguration->tpsAdcChannel==EFI_ADC_NONE)
return -1; return -1;
#if EFI_PROD_CODE
if(boardConfiguration->adcHwChannelEnabled[engineConfiguration->tpsAdcChannel]==ADC_FAST)
return tpsFastAdc / 4;
#endif /* EFI_PROD_CODE */
int adc = getAdcValue(engineConfiguration->tpsAdcChannel); int adc = getAdcValue(engineConfiguration->tpsAdcChannel);
return (int) adc / 4; // Only for TunerStudio compatibility. Max TS adc value in 1023 return (int) adc / 4; // Only for TunerStudio compatibility. Max TS adc value in 1023
} }

View File

@ -357,7 +357,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
} }
if (eventIndex == 0) { if (eventIndex == 0) {
engine->accelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F); engine->mapAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F);
engine->m.beforeFuelCalc = GET_TIMESTAMP(); engine->m.beforeFuelCalc = GET_TIMESTAMP();
ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection; ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection;
engine->m.fuelCalcTime = GET_TIMESTAMP() - engine->m.beforeFuelCalc; engine->m.fuelCalcTime = GET_TIMESTAMP() - engine->m.beforeFuelCalc;

View File

@ -140,6 +140,8 @@ static int fastMapSampleIndex;
static int hipSampleIndex; static int hipSampleIndex;
static int tpsSampleIndex; static int tpsSampleIndex;
extern int tpsFastAdc;
/** /**
* This method is not in the adc* lower-level file because it is more business logic then hardware. * This method is not in the adc* lower-level file because it is more business logic then hardware.
*/ */
@ -167,7 +169,7 @@ void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
} }
#endif #endif
if(tpsSampleIndex!=TPS_IS_SLOW) { if(tpsSampleIndex!=TPS_IS_SLOW) {
tpsFastAdc = fastAdc.samples[tpsSampleIndex];
} }
} }
} }