mirror of https://github.com/rusefi/wideband.git
detect sensor overheat
This commit is contained in:
parent
1110cc81ff
commit
c711252791
|
@ -6,6 +6,7 @@ enum class Fault
|
||||||
|
|
||||||
// First fault code at 3 so it's easier to see
|
// First fault code at 3 so it's easier to see
|
||||||
SensorDidntHeat = 3,
|
SensorDidntHeat = 3,
|
||||||
|
SensorOverheat = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
void setFault(Fault fault);
|
void setFault(Fault fault);
|
||||||
|
|
|
@ -20,7 +20,7 @@ enum class HeaterState
|
||||||
Stopped,
|
Stopped,
|
||||||
};
|
};
|
||||||
|
|
||||||
int timeCounter = 5000 / 50;
|
int timeCounter = HEATER_PREHEAT_TIME / HEATER_CONTROL_PERIOD;
|
||||||
float rampDuty = 0.5f;
|
float rampDuty = 0.5f;
|
||||||
|
|
||||||
static HeaterState GetNextState(HeaterState state, float sensorEsr)
|
static HeaterState GetNextState(HeaterState state, float sensorEsr)
|
||||||
|
@ -37,7 +37,7 @@ static HeaterState GetNextState(HeaterState state, float sensorEsr)
|
||||||
rampDuty = 0.5f;
|
rampDuty = 0.5f;
|
||||||
|
|
||||||
// Next phase times out at 15 seconds
|
// Next phase times out at 15 seconds
|
||||||
timeCounter = 15000 / 50;
|
timeCounter = HEATER_WARMUP_TIMEOUT / HEATER_CONTROL_PERIOD;
|
||||||
|
|
||||||
return HeaterState::WarmupRamp;
|
return HeaterState::WarmupRamp;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ static HeaterState GetNextState(HeaterState state, float sensorEsr)
|
||||||
// Stay in preheat - wait for time to elapse
|
// Stay in preheat - wait for time to elapse
|
||||||
break;
|
break;
|
||||||
case HeaterState::WarmupRamp:
|
case HeaterState::WarmupRamp:
|
||||||
if (sensorEsr < 1000)
|
if (sensorEsr < HEATER_CLOSED_LOOP_THRESHOLD_ESR)
|
||||||
{
|
{
|
||||||
return HeaterState::ClosedLoop;
|
return HeaterState::ClosedLoop;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,11 @@ static HeaterState GetNextState(HeaterState state, float sensorEsr)
|
||||||
break;
|
break;
|
||||||
case HeaterState::ClosedLoop:
|
case HeaterState::ClosedLoop:
|
||||||
// TODO: handle departure from closed loop
|
// TODO: handle departure from closed loop
|
||||||
|
if (sensorEsr < HEATER_FAULT_ESR)
|
||||||
|
{
|
||||||
|
setFault(Fault::SensorOverheat);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case HeaterState::Stopped: break;
|
case HeaterState::Stopped: break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,4 +32,10 @@
|
||||||
// Heater controller config
|
// Heater controller config
|
||||||
// *******************************
|
// *******************************
|
||||||
#define HEATER_CONTROL_PERIOD 50
|
#define HEATER_CONTROL_PERIOD 50
|
||||||
|
|
||||||
|
#define HEATER_PREHEAT_TIME 5000
|
||||||
|
#define HEATER_WARMUP_TIMEOUT 15000
|
||||||
|
|
||||||
|
#define HEATER_CLOSED_LOOP_THRESHOLD_ESR 1000
|
||||||
#define HEATER_TARGET_ESR 300
|
#define HEATER_TARGET_ESR 300
|
||||||
|
#define HEATER_FAULT_ESR 200
|
||||||
|
|
Loading…
Reference in New Issue