auto-sync
This commit is contained in:
parent
0bcca6b6b8
commit
26ed81bc58
|
@ -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;
|
||||
|
|
|
@ -623,7 +623,8 @@ fileVersion = { 20150406 }
|
|||
veValue = scalar, F32, 112, "ratio", 1, 0
|
||||
maxDelta = scalar, F32, 116, "ratio", 1, 0
|
||||
minDelta = scalar, F32, 120, "ratio", 1, 0
|
||||
currentAccelDelta = scalar,F32, 124, "%", 1, 0
|
||||
currentMapAccelDelta = scalar,F32, 124, "%", 1, 0
|
||||
currentTpsAccel = scalar, F32, 128, "ms", 1, 0
|
||||
egoCorrection = { 0 }
|
||||
time = { timeNow }
|
||||
; engineLoad = { algorithm == 0 ? MAF : TPS }
|
||||
|
@ -799,7 +800,8 @@ fileVersion = { 20150406 }
|
|||
veValueGauge = veValue, "%", "", 0, 120, 10, 10, 100, 100, 1, 1
|
||||
maxDeltaGauge = maxDelta, "%", "", 0, 120, 10, 10, 100, 100, 1, 1
|
||||
minDeltaGauge = minDelta, "%", "", 0, 120, 10, 10, 100, 100, 1, 1
|
||||
currentAccelDeltaGauge = currentAccelDelta, "%", "", 0, 120, 10, 10, 100, 100, 1, 1
|
||||
currentMapAccelDeltaGauge = currentMapAccelDelta,"MAP enrich", "%", 0, 120, 10, 10, 100, 100, 1, 1
|
||||
currentTpsAccelGauge = currentTpsAccel,"TPS enrich", "ms", 0, 120, 10, 10, 100, 100, 1, 1
|
||||
|
||||
[FrontPage]
|
||||
; Gauges are numbered left to right, top to bottom.
|
||||
|
@ -867,7 +869,8 @@ fileVersion = { 20150406 }
|
|||
entry = veValue, "ratio", float, "%.3f"
|
||||
; entry = maxDelta, "maxDelta", float, "%.3f"
|
||||
; entry = minDelta, "minDelta", float, "%.3f"
|
||||
entry = currentAccelDelta, "%", float, "%.3f"
|
||||
entry = currentMapAccelDelta, "%", float, "%.3f"
|
||||
entry = currentTpsAccel, "ms", float, "%.3f"
|
||||
|
||||
|
||||
; tpsADC = U16, "ADC",
|
||||
|
@ -949,10 +952,10 @@ fileVersion = { 20150406 }
|
|||
field = "Global fuel correction", globalFuelCorrection
|
||||
field = "MAP accel length", mapAccelLength
|
||||
field = "MAP Accel threshold", mapAccelEnrichmentThreshold
|
||||
field = "MAP Accel Mult", mapAaccelEnrichmentMultiplier
|
||||
field = "MAP Accel Mult", mapAccelEnrichmentMultiplier
|
||||
field = "TPS accel length", tpsAccelLength
|
||||
field = "TPS Accel threshold", tpsAccelEnrichmentThreshold
|
||||
field = "TPS Accel Mult", tpsAaccelEnrichmentMultiplier
|
||||
field = "TPS Accel Mult", tpsAccelEnrichmentMultiplier
|
||||
|
||||
; Engine->Trigger configuration
|
||||
dialog = triggerConfiguration, "Trigger configuration"
|
||||
|
|
Loading…
Reference in New Issue