lovely tiny bug which mostly affects NB2 with an impossible one tooth crank trigger wheel
This commit is contained in:
parent
cf087218c9
commit
b6fe6555e0
|
@ -357,7 +357,9 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
|||
// That's easy - trigger cycle matches engine cycle
|
||||
triggerIndexForListeners = triggerState.getCurrentIndex();
|
||||
} else {
|
||||
int crankDivider = operationMode == FOUR_STROKE_CRANK_SENSOR ? 2 : 4;
|
||||
// todo: should this logic reuse getCycleDuration?
|
||||
bool isCrankDriven = operationMode == FOUR_STROKE_CRANK_SENSOR || operationMode == FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR;
|
||||
int crankDivider = isCrankDriven ? 2 : 4;
|
||||
|
||||
int crankInternalIndex = triggerState.getTotalRevolutionCounter() % crankDivider;
|
||||
|
||||
|
|
|
@ -110,3 +110,21 @@ TEST(sensors, testCamInput) {
|
|||
|
||||
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3";
|
||||
}
|
||||
|
||||
TEST(sensors, testNB2CamInput) {
|
||||
WITH_ENGINE_TEST_HELPER(MAZDA_MIATA_2003);
|
||||
|
||||
// this crank trigger would be easier to test, crank shape is less important for this test
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testNB2CamInput RPM";
|
||||
for (int i = 0; i < 5;i++) {
|
||||
eth.fireRise(50);
|
||||
}
|
||||
ASSERT_EQ(1200, GET_RPM()) << "testNB2CamInput RPM";
|
||||
|
||||
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue