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