consolidate tps accel (#3671)
This commit is contained in:
parent
8b246a8d92
commit
2d05d51cf8
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
static tps_tps_Map3D_t tpsTpsMap;
|
static tps_tps_Map3D_t tpsTpsMap;
|
||||||
|
|
||||||
// todo: eliminate code duplication between these two methods! Some pointer magic would help.
|
|
||||||
floatms_t TpsAccelEnrichment::getTpsEnrichment() {
|
floatms_t TpsAccelEnrichment::getTpsEnrichment() {
|
||||||
ScopePerf perf(PE::GetTpsEnrichment);
|
ScopePerf perf(PE::GetTpsEnrichment);
|
||||||
|
|
||||||
|
@ -120,7 +119,7 @@ void TpsAccelEnrichment::onEngineCycleTps() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int AccelEnrichment::getMaxDeltaIndex() {
|
int TpsAccelEnrichment::getMaxDeltaIndex() {
|
||||||
|
|
||||||
int len = minI(cb.getSize(), cb.getCount());
|
int len = minI(cb.getSize(), cb.getCount());
|
||||||
if (len < 2)
|
if (len < 2)
|
||||||
|
@ -143,18 +142,14 @@ int AccelEnrichment::getMaxDeltaIndex() {
|
||||||
return resultIndex;
|
return resultIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
float AccelEnrichment::getMaxDelta() {
|
float TpsAccelEnrichment::getMaxDelta() {
|
||||||
int index = getMaxDeltaIndex();
|
int index = getMaxDeltaIndex();
|
||||||
|
|
||||||
return (cb.get(index) - (cb.get(index - 1)));
|
return (cb.get(index) - (cb.get(index - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccelEnrichment::resetAE() {
|
|
||||||
cb.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TpsAccelEnrichment::resetAE() {
|
void TpsAccelEnrichment::resetAE() {
|
||||||
AccelEnrichment::resetAE();
|
cb.clear();
|
||||||
resetFractionValues();
|
resetFractionValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,15 +161,15 @@ void TpsAccelEnrichment::resetFractionValues() {
|
||||||
cycleCnt = 0;
|
cycleCnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccelEnrichment::setLength(int length) {
|
void TpsAccelEnrichment::setLength(int length) {
|
||||||
cb.setSize(length);
|
cb.setSize(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccelEnrichment::onNewValue(float currentValue) {
|
void TpsAccelEnrichment::onNewValue(float currentValue) {
|
||||||
cb.add(currentValue);
|
cb.add(currentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
AccelEnrichment::AccelEnrichment() {
|
TpsAccelEnrichment::TpsAccelEnrichment() {
|
||||||
resetAE();
|
resetAE();
|
||||||
cb.setSize(4);
|
cb.setSize(4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,24 +16,18 @@
|
||||||
|
|
||||||
typedef Map3D<TPS_TPS_ACCEL_TABLE, TPS_TPS_ACCEL_TABLE, float, float, float> tps_tps_Map3D_t;
|
typedef Map3D<TPS_TPS_ACCEL_TABLE, TPS_TPS_ACCEL_TABLE, float, float, float> tps_tps_Map3D_t;
|
||||||
|
|
||||||
/**
|
class TpsAccelEnrichment : public tps_accel_state_s {
|
||||||
* this object is used for MAP rate-of-change and TPS rate-of-change corrections
|
|
||||||
*/
|
|
||||||
class AccelEnrichment : public tps_accel_state_s {
|
|
||||||
public:
|
public:
|
||||||
AccelEnrichment();
|
TpsAccelEnrichment();
|
||||||
|
|
||||||
int getMaxDeltaIndex();
|
int getMaxDeltaIndex();
|
||||||
float getMaxDelta();
|
float getMaxDelta();
|
||||||
|
|
||||||
void resetAE();
|
|
||||||
void setLength(int length);
|
void setLength(int length);
|
||||||
cyclic_buffer<float> cb;
|
cyclic_buffer<float> cb;
|
||||||
void onNewValue(float currentValue);
|
void onNewValue(float currentValue);
|
||||||
int onUpdateInvocationCounter = 0;
|
int onUpdateInvocationCounter = 0;
|
||||||
};
|
|
||||||
|
|
||||||
class TpsAccelEnrichment : public AccelEnrichment {
|
|
||||||
public:
|
|
||||||
/**
|
/**
|
||||||
* @return Extra fuel squirt duration for TPS acceleration
|
* @return Extra fuel squirt duration for TPS acceleration
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue