auto-sync
This commit is contained in:
parent
8faf304c53
commit
4b8e8b7c87
|
@ -34,6 +34,7 @@ void setCustomEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
* Frankenso analog #11 PC5 ADC15
|
||||
* Frankenso analog #12 PC4 ADC14 VBatt
|
||||
*/
|
||||
boardConfiguration->adcHwChannelEnabled[2] = ADC_FAST;
|
||||
engineConfiguration->tpsAdcChannel = EFI_ADC_2;
|
||||
|
||||
boardConfiguration->adcHwChannelEnabled[0] = ADC_FAST;
|
||||
|
|
|
@ -556,9 +556,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->manifold_air_pressure = getMap();
|
||||
tsOutputChannels->engineLoad = engineLoad;
|
||||
tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
|
||||
tsOutputChannels->maxDelta = engine->mapAccelEnrichment.maxDelta;
|
||||
tsOutputChannels->minDelta = engine->mapAccelEnrichment.minDelta;
|
||||
tsOutputChannels->currentMapAccelDelta = engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
|
||||
tsOutputChannels->tpsAccelFuel = engine->tpsAccelEnrichment.getTpsEnrichment(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
tsOutputChannels->checkEngine = hasErrorCodes();
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
|
|
|
@ -37,6 +37,15 @@ void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfig
|
|||
// return diffEnrichment;
|
||||
//}
|
||||
|
||||
float AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F) {
|
||||
float d = cb.maxValue(cb.getSize());
|
||||
if (d > engineConfiguration->tpsAccelEnrichmentThreshold) {
|
||||
return d * engineConfiguration->tpsAccelEnrichmentMultiplier;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
float AccelEnrichmemnt::getMapEnrichment(DECLARE_ENGINE_PARAMETER_F) {
|
||||
float d = cb.maxValue(cb.getSize());
|
||||
if (d > engineConfiguration->mapAccelEnrichmentThreshold) {
|
||||
|
@ -49,42 +58,33 @@ float AccelEnrichmemnt::getMapEnrichment(DECLARE_ENGINE_PARAMETER_F) {
|
|||
}
|
||||
|
||||
void AccelEnrichmemnt::reset() {
|
||||
maxDelta = 0;
|
||||
minDelta = 0;
|
||||
delta = 0;
|
||||
currentEngineLoad = NAN;
|
||||
currentValue = NAN;
|
||||
}
|
||||
|
||||
void AccelEnrichmemnt::onNewValue(float currentValue) {
|
||||
if (!cisnan(this->currentValue)) {
|
||||
delta = currentValue - this->currentValue;
|
||||
FuelSchedule *fs = &engine->engineConfiguration2->injectionEvents;
|
||||
cb.add(delta * fs->eventsCount);
|
||||
}
|
||||
|
||||
this->currentValue = currentValue;
|
||||
}
|
||||
|
||||
void AccelEnrichmemnt::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F) {
|
||||
float tps = getTPS(PASS_ENGINE_PARAMETER_F);
|
||||
cb.add(delta);
|
||||
onNewValue(getTPS(PASS_ENGINE_PARAMETER_F));
|
||||
}
|
||||
|
||||
void AccelEnrichmemnt::onEngineCycle(DECLARE_ENGINE_PARAMETER_F) {
|
||||
float currentEngineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
if (!cisnan(this->currentEngineLoad)) {
|
||||
delta = currentEngineLoad - this->currentEngineLoad;
|
||||
cb.add(delta);
|
||||
maxDelta = maxF(maxDelta, delta);
|
||||
minDelta = minF(minDelta, delta);
|
||||
}
|
||||
|
||||
this->currentEngineLoad = currentEngineLoad;
|
||||
onNewValue(getEngineLoadT(PASS_ENGINE_PARAMETER_F));
|
||||
}
|
||||
|
||||
AccelEnrichmemnt::AccelEnrichmemnt() {
|
||||
reset();
|
||||
cb.setSize(4);
|
||||
// for (int i = 0; i < MAX_ACCEL_ARRAY_SIZE; i++)
|
||||
// array[i] = 0;
|
||||
diffEnrichment = 0;
|
||||
}
|
||||
|
||||
//float getAccelEnrichment(void) {
|
||||
// return instance.getDiffEnrichment();
|
||||
//}
|
||||
|
||||
//#if EFI_PROD_CODE
|
||||
//
|
||||
//static msg_t DiffEnrichmentThread(int param) {
|
||||
|
|
|
@ -27,15 +27,14 @@ public:
|
|||
void onEngineCycle(DECLARE_ENGINE_PARAMETER_F);
|
||||
void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F);
|
||||
void reset();
|
||||
float currentEngineLoad;
|
||||
float maxDelta;
|
||||
float minDelta;
|
||||
float delta;
|
||||
cyclic_buffer<float> cb;
|
||||
|
||||
private:
|
||||
// float array[MAX_ACCEL_ARRAY_SIZE];
|
||||
float diffEnrichment;
|
||||
float currentValue;
|
||||
void onNewValue(float currentValue);
|
||||
};
|
||||
|
||||
void initAccelEnrichment(Logging *sharedLogger);
|
||||
|
|
|
@ -347,8 +347,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
|
||||
engineConfiguration->alternatorControlPFactor = 30;
|
||||
|
||||
engineConfiguration->tpsAdcChannel = EFI_ADC_3;
|
||||
engineConfiguration->vbattAdcChannel = EFI_ADC_5;
|
||||
engineConfiguration->vbattAdcChannel = EFI_ADC_4;
|
||||
engineConfiguration->cltAdcChannel = EFI_ADC_6;
|
||||
engineConfiguration->iatAdcChannel = EFI_ADC_7;
|
||||
engineConfiguration->mafAdcChannel = EFI_ADC_0;
|
||||
|
@ -523,7 +522,10 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
boardConfiguration->adcHwChannelEnabled[0] = ADC_SLOW;
|
||||
boardConfiguration->adcHwChannelEnabled[1] = ADC_SLOW;
|
||||
boardConfiguration->adcHwChannelEnabled[2] = ADC_SLOW;
|
||||
boardConfiguration->adcHwChannelEnabled[3] = ADC_SLOW;
|
||||
|
||||
boardConfiguration->adcHwChannelEnabled[3] = ADC_FAST;
|
||||
engineConfiguration->tpsAdcChannel = EFI_ADC_3;
|
||||
|
||||
boardConfiguration->adcHwChannelEnabled[4] = ADC_FAST;
|
||||
// boardConfiguration->adcHwChannelEnabled[5] = ADC_SLOW; PA5 is also timer input
|
||||
boardConfiguration->adcHwChannelEnabled[6] = ADC_SLOW;
|
||||
|
@ -596,6 +598,10 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
engineConfiguration->mapAccelLength = 6;
|
||||
engineConfiguration->mapAccelEnrichmentThreshold = 5; // kPa
|
||||
engineConfiguration->mapAccelEnrichmentMultiplier = 2;
|
||||
|
||||
engineConfiguration->tpsAccelLength = 12;
|
||||
engineConfiguration->tpsAccelEnrichmentThreshold = 10;
|
||||
engineConfiguration->tpsAccelEnrichmentMultiplier = 0.2;
|
||||
}
|
||||
|
||||
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_S) {
|
||||
|
|
|
@ -161,9 +161,10 @@ static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLARE_ENGINE
|
|||
if (!fs->hasEvents[eventIndex])
|
||||
return;
|
||||
|
||||
// todo: Maxim try this?
|
||||
// engine->accelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F);
|
||||
// ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection;
|
||||
engine->tpsAccelEnrichment.onEngineCycleTps(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
engine->mapAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F);
|
||||
ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection;
|
||||
|
||||
for (int i = 0; i < source->size; i++) {
|
||||
InjectionEvent *event = &source->elements[i];
|
||||
|
@ -357,7 +358,6 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
|||
}
|
||||
|
||||
if (eventIndex == 0) {
|
||||
engine->mapAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F);
|
||||
engine->m.beforeFuelCalc = GET_TIMESTAMP();
|
||||
ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection;
|
||||
engine->m.fuelCalcTime = GET_TIMESTAMP() - engine->m.beforeFuelCalc;
|
||||
|
|
Loading…
Reference in New Issue