BUG: phase sensor validation attending - detect missing CAM signal #659
preparation
This commit is contained in:
parent
1c9a9d35a6
commit
ff1d10dd2e
|
@ -366,7 +366,7 @@ typedef enum {
|
||||||
//P0332 Knock Sensor 2 Circuit Low Input (Bank 2)
|
//P0332 Knock Sensor 2 Circuit Low Input (Bank 2)
|
||||||
//P0333 Knock Sensor 2 Circuit High Input (Bank 2)
|
//P0333 Knock Sensor 2 Circuit High Input (Bank 2)
|
||||||
//P0334 Knock Sensor 2 Circuit Intermittent (Bank 2)
|
//P0334 Knock Sensor 2 Circuit Intermittent (Bank 2)
|
||||||
//P0335 Crankshaft Position Sensor A Circuit Malfunction
|
OBD_Crankshaft_Position_Sensor_A_Circuit_Malfunction = 335,
|
||||||
//P0336 Crankshaft Position Sensor A Circuit Range/Performance
|
//P0336 Crankshaft Position Sensor A Circuit Range/Performance
|
||||||
//P0337 Crankshaft Position Sensor A Circuit Low Input
|
//P0337 Crankshaft Position Sensor A Circuit Low Input
|
||||||
//P0338 Crankshaft Position Sensor A Circuit High Input
|
//P0338 Crankshaft Position Sensor A Circuit High Input
|
||||||
|
|
|
@ -472,7 +472,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rpm == NOISY_RPM) {
|
if (rpm == NOISY_RPM) {
|
||||||
warning(OBD_Camshaft_Position_Sensor_Circuit_Range_Performance, "noisy trigger");
|
warning(OBD_Crankshaft_Position_Sensor_A_Circuit_Malfunction, "noisy trigger");
|
||||||
// TODO: add 'pin shutdown' invocation somewhere - coils might be still open here!
|
// TODO: add 'pin shutdown' invocation somewhere - coils might be still open here!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,16 +84,7 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E
|
||||||
engine->triggerCentral.addEventListener(listener, name, engine);
|
engine->triggerCentral.addEventListener(listener, name, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
||||||
int triggerReentraint = 0;
|
|
||||||
int maxTriggerReentraint = 0;
|
|
||||||
uint32_t triggerDuration;
|
|
||||||
uint32_t triggerMaxDuration = 0;
|
|
||||||
|
|
||||||
static bool isInsideTriggerHandler = false;
|
|
||||||
|
|
||||||
void hwHandleVvtCamSignal(trigger_value_e front) {
|
|
||||||
addEngineSnifferEvent(VVT_NAME, front == TV_RISE ? WC_UP : WC_DOWN);
|
addEngineSnifferEvent(VVT_NAME, front == TV_RISE ? WC_UP : WC_DOWN);
|
||||||
|
|
||||||
if (CONFIGB(vvtCamSensorUseRise) ^ (front != TV_FALL)) {
|
if (CONFIGB(vvtCamSensorUseRise) ^ (front != TV_FALL)) {
|
||||||
|
@ -184,6 +175,16 @@ void hwHandleVvtCamSignal(trigger_value_e front) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
|
||||||
|
int triggerReentraint = 0;
|
||||||
|
int maxTriggerReentraint = 0;
|
||||||
|
uint32_t triggerDuration;
|
||||||
|
uint32_t triggerMaxDuration = 0;
|
||||||
|
|
||||||
|
static bool isInsideTriggerHandler = false;
|
||||||
|
|
||||||
|
|
||||||
void hwHandleShaftSignal(trigger_event_e signal) {
|
void hwHandleShaftSignal(trigger_event_e signal) {
|
||||||
// for effective noise filtering, we need both signal edges,
|
// for effective noise filtering, we need both signal edges,
|
||||||
// so we pass them to handleShaftSignal() and defer this test
|
// so we pass them to handleShaftSignal() and defer this test
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
void triggerInfo(void);
|
void triggerInfo(void);
|
||||||
efitime_t getCrankEventCounter(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
efitime_t getCrankEventCounter(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void hwHandleShaftSignal(trigger_event_e signal);
|
void hwHandleShaftSignal(trigger_event_e signal);
|
||||||
void hwHandleVvtCamSignal(trigger_value_e front);
|
void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
void initTriggerCentral(Logging *sharedLogger);
|
void initTriggerCentral(Logging *sharedLogger);
|
||||||
void printAllCallbacksHistogram(void);
|
void printAllCallbacksHistogram(void);
|
||||||
|
|
|
@ -72,7 +72,7 @@ TEST(sensors, testNoisyInput) {
|
||||||
|
|
||||||
ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testNoisyInput";
|
ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testNoisyInput";
|
||||||
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0)) << "@0";
|
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0)) << "@0";
|
||||||
ASSERT_EQ(OBD_Camshaft_Position_Sensor_Circuit_Range_Performance, unitTestWarningCodeState.recentWarnings.get(1)) << "@0";
|
ASSERT_EQ(OBD_Crankshaft_Position_Sensor_A_Circuit_Malfunction, unitTestWarningCodeState.recentWarnings.get(1)) << "@0";
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(sensors, testCamInput) {
|
TEST(sensors, testCamInput) {
|
||||||
|
@ -82,9 +82,9 @@ TEST(sensors, testCamInput) {
|
||||||
// and now changing to ONE trigger on CRANK with CAM/VVT
|
// and now changing to ONE trigger on CRANK with CAM/VVT
|
||||||
|
|
||||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||||
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||||
engineConfiguration->camInput = GPIOA_10;
|
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
engineConfiguration->camInput = GPIOA_10; // we just need to indicate that we have CAM
|
||||||
|
|
||||||
ASSERT_EQ( 0, GET_RPM()) << "testCamInput RPM";
|
ASSERT_EQ( 0, GET_RPM()) << "testCamInput RPM";
|
||||||
|
|
||||||
|
@ -93,10 +93,20 @@ TEST(sensors, testCamInput) {
|
||||||
eth.fireRise(50);
|
eth.fireRise(50);
|
||||||
eth.fireRise(50);
|
eth.fireRise(50);
|
||||||
eth.fireRise(50);
|
eth.fireRise(50);
|
||||||
|
|
||||||
ASSERT_EQ(1200, GET_RPM()) << "testCamInput RPM";
|
ASSERT_EQ(1200, GET_RPM()) << "testCamInput RPM";
|
||||||
ASSERT_EQ(1, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput";
|
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput";
|
||||||
|
|
||||||
for (int i = 0; i < 100;i++)
|
for (int i = 0; i < 50;i++) {
|
||||||
eth.fireRise(50);
|
eth.fireRise(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #2";
|
||||||
|
|
||||||
|
for (int i = 0; i < 50;i++) {
|
||||||
|
eth.fireRise(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue