diff --git a/firmware/hw_layer/readme.md b/firmware/hw_layer/readme.md new file mode 100644 index 0000000000..dc96791811 --- /dev/null +++ b/firmware/hw_layer/readme.md @@ -0,0 +1 @@ +https://github.com/rusefi/rusefi/wiki/ASIC diff --git a/unit_tests/tests/trigger/test_quad_cam.cpp b/unit_tests/tests/trigger/test_quad_cam.cpp index d7f0175a09..1a7f2a09d0 100644 --- a/unit_tests/tests/trigger/test_quad_cam.cpp +++ b/unit_tests/tests/trigger/test_quad_cam.cpp @@ -64,4 +64,29 @@ TEST(trigger, testQuadCam) { // actually position based on VVT! ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter()); + + int secondCamSecondBank = 3; + int secondBank = 1; + + // this would be ignored since we only consume the other kind of fronts here + hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX); + eth.moveTimeForwardUs(MS2US(20 / d)); + // this would be be first VVT signal - gap duration would be calculated against 'DEEP_IN_THE_PAST_SECONDS' initial value + hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX); + + eth.moveTimeForwardUs(MS2US(20 / d)); + // this second important front would give us first real VVT gap duration + hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX); + + ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition()); + ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter()); + + eth.moveTimeForwardUs(MS2US(130 / d)); + // this third important front would give us first comparison between two real gaps + hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), secondCamSecondBank PASS_ENGINE_PARAMETER_SUFFIX); + + ASSERT_NEAR(-2571.4, engine->triggerCentral.vvtPosition[secondBank][secondCam], EPS3D); + // actually position based on VVT! + ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter()); + }