sorry more manual merge of #602

This commit is contained in:
rusefi 2018-08-08 20:42:55 -04:00
parent bb20f749ed
commit 2f3995378e
2 changed files with 16 additions and 5 deletions

View File

@ -361,9 +361,13 @@ static bool cjIsWorkingState(void) {
}
static void cjInitPid(void) {
// todo: these values are valid only for LSU 4.2
if(engineConfiguration->cj125isLsu49) {
heaterPidConfig.pFactor = CJ125_PID_LSU49_P;
heaterPidConfig.iFactor = CJ125_PID_LSU49_I;
} else {
heaterPidConfig.pFactor = CJ125_PID_LSU42_P;
heaterPidConfig.iFactor = CJ125_PID_LSU42_I;
}
heaterPidConfig.dFactor = 0.0f;
heaterPidConfig.minValue = 0;
heaterPidConfig.maxValue = 1;
@ -550,8 +554,12 @@ static void cjSetInit2(int v) {
#endif /* CJ125_DEBUG */
float cjGetAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// todo: make configurable sensor LSU type
cj125_sensor_type_e sensorType = CJ125_LSU_42;
cj125_sensor_type_e sensorType;
if (engineConfiguration->cj125isLsu49) {
sensorType = CJ125_LSU_49;
} else {
sensorType = CJ125_LSU_42;
}
// See CJ125 datasheet, page 6
float pumpCurrent = (vUa - vUaCal) * amplCoeff * (CJ125_PUMP_CURRENT_FACTOR / CJ125_PUMP_SHUNT_RESISTOR);

View File

@ -133,6 +133,9 @@
#define CJ125_PID_LSU42_P (80.0f / 16.0f * 5.0f / 1024.0f)
#define CJ125_PID_LSU42_I (25.0f / 16.0f * 5.0f / 1024.0f)
#define CJ125_PID_LSU49_P (8.0f)
#define CJ125_PID_LSU49_I (0.003f)
// Returned if there's no valid measurement
#define CJ125_AFR_NAN 0.0f