auto-sync
This commit is contained in:
parent
60669b2b14
commit
7b11219a15
|
@ -491,6 +491,10 @@ void setMiata1994_s(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
|
|
||||||
boardConfiguration->malfunctionIndicatorPin = GPIOE_5;
|
boardConfiguration->malfunctionIndicatorPin = GPIOE_5;
|
||||||
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
|
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
|
||||||
|
|
||||||
|
engineConfiguration->algorithm = LM_REAL_MAF;
|
||||||
|
setMazdaMiataNAMaf(engineConfiguration);
|
||||||
|
engineConfiguration->injector.flow = 230;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,53 +24,6 @@ EXTERN_ENGINE
|
||||||
static AccelEnrichmemnt instance;
|
static AccelEnrichmemnt instance;
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
|
||||||
|
|
||||||
static void accelInfo() {
|
|
||||||
scheduleMsg(logger, "accel length=%d", instance.cb.getSize());
|
|
||||||
scheduleMsg(logger, "accel th=%f/mult=%f", engineConfiguration->accelEnrichmentThreshold, engineConfiguration->accelEnrichmentMultiplier);
|
|
||||||
scheduleMsg(logger, "decel th=%f/mult=%f", engineConfiguration->decelEnrichmentThreshold, engineConfiguration->decelEnrichmentMultiplier);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setAccelThr(float value) {
|
|
||||||
engineConfiguration->accelEnrichmentThreshold = value;
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setAccelMult(float value) {
|
|
||||||
engineConfiguration->accelEnrichmentMultiplier = value;
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setDecelThr(float value) {
|
|
||||||
engineConfiguration->decelEnrichmentThreshold = value;
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setDecelMult(float value) {
|
|
||||||
engineConfiguration->decelEnrichmentMultiplier = value;
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setAccelLen(int len) {
|
|
||||||
instance.cb.setSize(len);
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void initAccelEnrichment(Logging *sharedLogger) {
|
|
||||||
logger = sharedLogger;
|
|
||||||
addConsoleActionF("set_accel_th", setAccelThr);
|
|
||||||
addConsoleActionF("set_accel_mult", setAccelMult);
|
|
||||||
addConsoleActionF("set_decel_th", setDecelThr);
|
|
||||||
addConsoleActionF("set_decel_mult", setDecelMult);
|
|
||||||
addConsoleActionI("set_accel_len", setAccelLen);
|
|
||||||
addConsoleAction("accelinfo", accelInfo);
|
|
||||||
|
|
||||||
setAccelLen(engineConfiguration->accelLength);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif /* ! EFI_UNIT_TEST */
|
|
||||||
|
|
||||||
void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfiguration, float engineLoad) {
|
void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfiguration, float engineLoad) {
|
||||||
// for (int i = 3; i == 1; i--)
|
// for (int i = 3; i == 1; i--)
|
||||||
// array[i] = array[i - 1];
|
// array[i] = array[i - 1];
|
||||||
|
@ -147,3 +100,49 @@ AccelEnrichmemnt::AccelEnrichmemnt() {
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
|
|
||||||
|
static void accelInfo() {
|
||||||
|
scheduleMsg(logger, "accel length=%d", instance.cb.getSize());
|
||||||
|
scheduleMsg(logger, "accel th=%f/mult=%f", engineConfiguration->accelEnrichmentThreshold, engineConfiguration->accelEnrichmentMultiplier);
|
||||||
|
scheduleMsg(logger, "decel th=%f/mult=%f", engineConfiguration->decelEnrichmentThreshold, engineConfiguration->decelEnrichmentMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setAccelThr(float value) {
|
||||||
|
engineConfiguration->accelEnrichmentThreshold = value;
|
||||||
|
accelInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setAccelMult(float value) {
|
||||||
|
engineConfiguration->accelEnrichmentMultiplier = value;
|
||||||
|
accelInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setDecelThr(float value) {
|
||||||
|
engineConfiguration->decelEnrichmentThreshold = value;
|
||||||
|
accelInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setDecelMult(float value) {
|
||||||
|
engineConfiguration->decelEnrichmentMultiplier = value;
|
||||||
|
accelInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setAccelLen(int len) {
|
||||||
|
instance.cb.setSize(len);
|
||||||
|
accelInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void initAccelEnrichment(Logging *sharedLogger) {
|
||||||
|
logger = sharedLogger;
|
||||||
|
addConsoleActionF("set_accel_threshold", setAccelThr);
|
||||||
|
addConsoleActionF("set_accel_multiplier", setAccelMult);
|
||||||
|
addConsoleActionF("set_decel_threshold", setDecelThr);
|
||||||
|
addConsoleActionF("set_decel_multiplier", setDecelMult);
|
||||||
|
addConsoleActionI("set_accel_len", setAccelLen);
|
||||||
|
addConsoleAction("accelinfo", accelInfo);
|
||||||
|
|
||||||
|
setAccelLen(engineConfiguration->accelLength);
|
||||||
|
}
|
||||||
|
#endif /* ! EFI_UNIT_TEST */
|
||||||
|
|
|
@ -359,7 +359,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
engineConfiguration->isDigitalChartEnabled = true;
|
engineConfiguration->isDigitalChartEnabled = true;
|
||||||
|
|
||||||
boardConfiguration->idleSolenoidFrequency = 200;
|
boardConfiguration->idleSolenoidFrequency = 200;
|
||||||
// set_idle_pwm 50
|
// set_idle_position 50
|
||||||
boardConfiguration->idleSolenoidPwm = 0.5;
|
boardConfiguration->idleSolenoidPwm = 0.5;
|
||||||
engineConfiguration->targetIdleRpm = 1200;
|
engineConfiguration->targetIdleRpm = 1200;
|
||||||
// engineConfiguration->idleMode = IM_AUTO;
|
// engineConfiguration->idleMode = IM_AUTO;
|
||||||
|
|
|
@ -76,7 +76,8 @@ 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) {
|
||||||
return getRealMafFuel(getRealMaf(PASS_ENGINE_PARAMETER_F), rpm PASS_ENGINE_PARAMETER);
|
float maf = getRealMaf(PASS_ENGINE_PARAMETER_F) + engine->accelEnrichment.getEnrichment(PASS_ENGINE_PARAMETER_F);
|
||||||
|
return getRealMafFuel(maf, rpm PASS_ENGINE_PARAMETER);
|
||||||
} else {
|
} else {
|
||||||
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
|
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
|
||||||
return getBaseTableFuel(engineConfiguration, rpm, engineLoad);
|
return getBaseTableFuel(engineConfiguration, rpm, engineLoad);
|
||||||
|
|
|
@ -32,12 +32,12 @@ IdleValveState::IdleValveState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdleValveState::init(DECLARE_ENGINE_PARAMETER_F) {
|
void IdleValveState::init(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
setIdleRpm(this, engineConfiguration->targetIdleRpm);
|
setTargetRpm(engineConfiguration->targetIdleRpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIdleRpm(IdleValveState *idle, int targetRpm) {
|
void IdleValveState::setTargetRpm(int targetRpm) {
|
||||||
idle->targetRpmRangeLeft = (int) (targetRpm * 0.93);
|
targetRpmRangeLeft = (int) (targetRpm * 0.93);
|
||||||
idle->targetRpmRangeRight = (int) (targetRpm * 1.07);
|
targetRpmRangeRight = (int) (targetRpm * 1.07);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,18 +27,18 @@ class IdleValveState {
|
||||||
public:
|
public:
|
||||||
IdleValveState();
|
IdleValveState();
|
||||||
void init(DECLARE_ENGINE_PARAMETER_F);
|
void init(DECLARE_ENGINE_PARAMETER_F);
|
||||||
|
void setTargetRpm(int targetRpm);
|
||||||
percent_t getIdle(int currentRpm, efitimems_t now DECLARE_ENGINE_PARAMETER_S);
|
percent_t getIdle(int currentRpm, efitimems_t now DECLARE_ENGINE_PARAMETER_S);
|
||||||
|
|
||||||
int time;
|
int time;
|
||||||
|
|
||||||
int targetRpmRangeLeft, targetRpmRangeRight;
|
|
||||||
|
|
||||||
percent_t value;
|
percent_t value;
|
||||||
efitimems_t timeOfLastIdleChange;
|
efitimems_t timeOfLastIdleChange;
|
||||||
|
private:
|
||||||
|
int targetRpmRangeLeft;
|
||||||
|
int targetRpmRangeRight;
|
||||||
};
|
};
|
||||||
|
|
||||||
void setIdleRpm(IdleValveState *idle, int targetRpm);
|
|
||||||
|
|
||||||
void idleDebug(const char *msg, percent_t value);
|
void idleDebug(const char *msg, percent_t value);
|
||||||
|
|
||||||
#endif /* IDLE_CONTROLLER_H_ */
|
#endif /* IDLE_CONTROLLER_H_ */
|
||||||
|
|
|
@ -49,7 +49,7 @@ static StepperMotor iacMotor;
|
||||||
/**
|
/**
|
||||||
* Idle level calculation algorithm lives in idle_controller.c
|
* Idle level calculation algorithm lives in idle_controller.c
|
||||||
*/
|
*/
|
||||||
static IdleValveState idle;
|
static IdleValveState idleMath;
|
||||||
|
|
||||||
void idleDebug(const char *msg, percent_t value) {
|
void idleDebug(const char *msg, percent_t value) {
|
||||||
scheduleMsg(logger, "%s%f", msg, value);
|
scheduleMsg(logger, "%s%f", msg, value);
|
||||||
|
@ -67,10 +67,6 @@ static void setIdleControlEnabled(int value) {
|
||||||
showIdleInfo();
|
showIdleInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setIdleValvePosition(int position) {
|
|
||||||
iacMotor.targetPosition = position;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setIdleValvePwm(percent_t value) {
|
static void setIdleValvePwm(percent_t value) {
|
||||||
if (value < 0.01 || value > 99.9)
|
if (value < 0.01 || value > 99.9)
|
||||||
return;
|
return;
|
||||||
|
@ -85,6 +81,14 @@ static void setIdleValvePwm(percent_t value) {
|
||||||
idleValvePwm.setSimplePwmDutyCycle(f);
|
idleValvePwm.setSimplePwmDutyCycle(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setIdleValvePosition(int position) {
|
||||||
|
if(boardConfiguration->useStepperIdle) {
|
||||||
|
iacMotor.targetPosition = position;
|
||||||
|
} else {
|
||||||
|
setIdleValvePwm(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static msg_t ivThread(int param) {
|
static msg_t ivThread(int param) {
|
||||||
(void) param;
|
(void) param;
|
||||||
chRegSetThreadName("IdleValve");
|
chRegSetThreadName("IdleValve");
|
||||||
|
@ -108,7 +112,7 @@ static msg_t ivThread(int param) {
|
||||||
|
|
||||||
efitimems_t now = currentTimeMillis();
|
efitimems_t now = currentTimeMillis();
|
||||||
|
|
||||||
percent_t newValue = idle.getIdle(getRpm(), now PASS_ENGINE_PARAMETER);
|
percent_t newValue = idleMath.getIdle(getRpm(), now PASS_ENGINE_PARAMETER);
|
||||||
|
|
||||||
if (currentIdleValve != newValue) {
|
if (currentIdleValve != newValue) {
|
||||||
currentIdleValve = newValue;
|
currentIdleValve = newValue;
|
||||||
|
@ -122,7 +126,7 @@ static msg_t ivThread(int param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setIdleRpmAction(int value) {
|
static void setIdleRpmAction(int value) {
|
||||||
setIdleRpm(&idle, value);
|
idleMath.setTargetRpm(value);
|
||||||
scheduleMsg(logger, "target idle RPM %d", value);
|
scheduleMsg(logger, "target idle RPM %d", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,19 +142,19 @@ static void applyIdleSolenoidPinState(PwmConfig *state, int stateIndex) {
|
||||||
void startIdleThread(Logging*sharedLogger, Engine *engine) {
|
void startIdleThread(Logging*sharedLogger, Engine *engine) {
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
|
|
||||||
if (boardConfiguration->idleStepperDirection != GPIO_UNASSIGNED) {
|
if (boardConfiguration->useStepperIdle) {
|
||||||
iacMotor.initialize(boardConfiguration->idleStepperStep, boardConfiguration->idleStepperDirection);
|
iacMotor.initialize(boardConfiguration->idleStepperStep, boardConfiguration->idleStepperDirection);
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* Start PWM for idleValvePin
|
||||||
|
*/
|
||||||
|
startSimplePwmExt(&idleValvePwm, "Idle Valve", boardConfiguration->idleValvePin, &idlePin,
|
||||||
|
boardConfiguration->idleSolenoidFrequency, boardConfiguration->idleSolenoidPwm, applyIdleSolenoidPinState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
idleMath.init();
|
||||||
* Start PWM for IDLE_VALVE logical / idleValvePin physical
|
scheduleMsg(logger, "initial idle %d", idleMath.value);
|
||||||
*/
|
|
||||||
startSimplePwmExt(&idleValvePwm, "Idle Valve", boardConfiguration->idleValvePin, &idlePin,
|
|
||||||
boardConfiguration->idleSolenoidFrequency, boardConfiguration->idleSolenoidPwm, applyIdleSolenoidPinState);
|
|
||||||
|
|
||||||
idle.init();
|
|
||||||
scheduleMsg(logger, "initial idle %d", idle.value);
|
|
||||||
|
|
||||||
chThdCreateStatic(ivThreadStack, sizeof(ivThreadStack), NORMALPRIO, (tfunc_t) ivThread, NULL);
|
chThdCreateStatic(ivThreadStack, sizeof(ivThreadStack), NORMALPRIO, (tfunc_t) ivThread, NULL);
|
||||||
|
|
||||||
|
@ -165,7 +169,6 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
|
||||||
|
|
||||||
addConsoleAction("idleinfo", showIdleInfo);
|
addConsoleAction("idleinfo", showIdleInfo);
|
||||||
addConsoleActionI("set_idle_rpm", setIdleRpmAction);
|
addConsoleActionI("set_idle_rpm", setIdleRpmAction);
|
||||||
addConsoleActionF("set_idle_pwm", setIdleValvePwm);
|
|
||||||
|
|
||||||
addConsoleActionI("set_idle_position", setIdleValvePosition);
|
addConsoleActionI("set_idle_position", setIdleValvePosition);
|
||||||
|
|
||||||
|
|
|
@ -86,3 +86,60 @@ void setDensoTODO(engine_configuration_s *e) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setMazdaMiataNAMaf(engine_configuration_s *e) {
|
||||||
|
int i = 0;
|
||||||
|
i= addMafPoint(e, i, 0.000000, 0.000000);
|
||||||
|
i= addMafPoint(e, i, 0.000028, 0.100000);
|
||||||
|
i= addMafPoint(e, i, 0.000387, 0.200000);
|
||||||
|
i= addMafPoint(e, i, 0.001809, 0.300000);
|
||||||
|
i= addMafPoint(e, i, 0.005409, 0.400000);
|
||||||
|
i= addMafPoint(e, i, 0.012648, 0.500000);
|
||||||
|
i= addMafPoint(e, i, 0.025320, 0.600000);
|
||||||
|
i= addMafPoint(e, i, 0.045532, 0.700000);
|
||||||
|
i= addMafPoint(e, i, 0.075698, 0.800000);
|
||||||
|
i= addMafPoint(e, i, 0.118525, 0.900000);
|
||||||
|
i= addMafPoint(e, i, 0.177011, 1.000000);
|
||||||
|
i= addMafPoint(e, i, 0.254434, 1.100000);
|
||||||
|
i= addMafPoint(e, i, 0.354347, 1.200000);
|
||||||
|
i= addMafPoint(e, i, 0.480576, 1.300000);
|
||||||
|
i= addMafPoint(e, i, 0.637210, 1.400000);
|
||||||
|
i= addMafPoint(e, i, 0.828604, 1.500000);
|
||||||
|
i= addMafPoint(e, i, 1.059369, 1.600000);
|
||||||
|
i= addMafPoint(e, i, 1.334371, 1.700000);
|
||||||
|
i= addMafPoint(e, i, 1.658728, 1.800000);
|
||||||
|
i= addMafPoint(e, i, 2.037809, 1.900000);
|
||||||
|
i= addMafPoint(e, i, 2.477225, 2.000000);
|
||||||
|
i= addMafPoint(e, i, 2.982835, 2.100000);
|
||||||
|
i= addMafPoint(e, i, 3.560736, 2.200000);
|
||||||
|
i= addMafPoint(e, i, 4.217265, 2.300000);
|
||||||
|
i= addMafPoint(e, i, 4.958995, 2.400000);
|
||||||
|
i= addMafPoint(e, i, 5.792737, 2.500000);
|
||||||
|
i= addMafPoint(e, i, 6.725531, 2.600000);
|
||||||
|
i= addMafPoint(e, i, 7.764648, 2.700000);
|
||||||
|
i= addMafPoint(e, i, 8.917592, 2.800000);
|
||||||
|
i= addMafPoint(e, i, 10.192092, 2.900000);
|
||||||
|
i= addMafPoint(e, i, 11.596102, 3.000000);
|
||||||
|
i= addMafPoint(e, i, 13.137802, 3.100000);
|
||||||
|
i= addMafPoint(e, i, 14.825595, 3.200000);
|
||||||
|
i= addMafPoint(e, i, 16.668105, 3.300000);
|
||||||
|
i= addMafPoint(e, i, 18.674177, 3.400000);
|
||||||
|
i= addMafPoint(e, i, 20.852874, 3.500000);
|
||||||
|
i= addMafPoint(e, i, 23.213478, 3.600000);
|
||||||
|
i= addMafPoint(e, i, 25.765485, 3.700000);
|
||||||
|
i= addMafPoint(e, i, 28.518610, 3.800000);
|
||||||
|
i= addMafPoint(e, i, 31.482778, 3.900000);
|
||||||
|
i= addMafPoint(e, i, 34.668130, 4.000000);
|
||||||
|
i= addMafPoint(e, i, 38.085019, 4.100000);
|
||||||
|
i= addMafPoint(e, i, 41.744006, 4.200000);
|
||||||
|
i= addMafPoint(e, i, 45.655865, 4.300000);
|
||||||
|
i= addMafPoint(e, i, 49.831577, 4.400000);
|
||||||
|
i= addMafPoint(e, i, 54.282334, 4.500000);
|
||||||
|
i= addMafPoint(e, i, 59.019531, 4.600000);
|
||||||
|
i= addMafPoint(e, i, 64.054771, 4.700000);
|
||||||
|
i= addMafPoint(e, i, 69.399864, 4.800000);
|
||||||
|
i= addMafPoint(e, i, 75.066822, 4.900000);
|
||||||
|
i= addMafPoint(e, i, 81.067862, 5.000000);
|
||||||
|
|
||||||
|
fillTheRest(e, i);
|
||||||
|
}
|
||||||
|
|
|
@ -22,5 +22,6 @@ void setBosch0280218037(engine_configuration_s *engineConfiguration);
|
||||||
void setBosch0280218004(engine_configuration_s *engineConfiguration);
|
void setBosch0280218004(engine_configuration_s *engineConfiguration);
|
||||||
|
|
||||||
void setDensoTODO(engine_configuration_s *engineConfiguration);
|
void setDensoTODO(engine_configuration_s *engineConfiguration);
|
||||||
|
void setMazdaMiataNAMaf(engine_configuration_s *e);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue