diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.cpp b/firmware/controllers/trigger/decoders/trigger_mazda.cpp index 59c11c66f3b..055c1a2a7e6 100644 --- a/firmware/controllers/trigger/decoders/trigger_mazda.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mazda.cpp @@ -25,12 +25,13 @@ void initializeMazdaMiataNaShape(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CAM_SENSOR); - s->setTriggerSynchronizationGap2(1.4930 * 0.6f, 1.4930 * 1.4f); + s->setTriggerSynchronizationGap2(4 * 0.75f, 4 * 1.4f); s->useRiseEdge = false; s->bothFrontsRequired = true; + s->gapBothDirections = true; - s->tdcPosition = 294; + s->tdcPosition = 436.965; /** * http://rusefi.com/forum/viewtopic.php?f=3&t=729&p=12983#p12983 diff --git a/unit_tests/tests/trigger/test_real_cranking_miata_NA.cpp b/unit_tests/tests/trigger/test_real_cranking_miata_NA.cpp index d90da7cdfb6..9dc0eecc712 100644 --- a/unit_tests/tests/trigger/test_real_cranking_miata_NA.cpp +++ b/unit_tests/tests/trigger/test_real_cranking_miata_NA.cpp @@ -98,14 +98,13 @@ TEST(cranking, realCrankingFromFile) { reader.readLine(ð); } - ASSERT_EQ( 0, GET_RPM())<< reader.lineIndex << " @ 0"; + ASSERT_EQ( 42, GET_RPM())<< reader.lineIndex << " @ 0"; ASSERT_EQ( 0, eth.recentWarnings()->getCount())<< "warningCounter#got synch"; ASSERT_EQ(0, engine->tdcScheduler[1].momentX); reader.readLine(ð); - ASSERT_EQ(3645170, engine->tdcScheduler[1].momentX); // let's assert TDC position and sync point - ASSERT_EQ( 32, GET_RPM())<< reader.lineIndex << " @ 1"; + ASSERT_EQ( 213, GET_RPM())<< reader.lineIndex << " @ 1"; for (int i = 0; i < 30; i++) { reader.readLine(ð); @@ -116,11 +115,11 @@ TEST(cranking, realCrankingFromFile) { for (int i = 0; i < 30; i++) { reader.readLine(ð); } - ASSERT_EQ( 344, GET_RPM())<< reader.lineIndex << " @ 2"; + ASSERT_EQ( 297, GET_RPM())<< reader.lineIndex << " @ 2"; while (reader.haveMore()) { reader.processLine(ð); } ASSERT_EQ( 0, eth.recentWarnings()->getCount())<< "warningCounter#realCranking"; - ASSERT_EQ( 499, GET_RPM())<< reader.lineIndex; + ASSERT_EQ( 560, GET_RPM())<< reader.lineIndex; } diff --git a/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp b/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp index f8b59e47c25..0b67dd5ee23 100644 --- a/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp +++ b/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp @@ -56,28 +56,24 @@ TEST(cranking, hardcodedRealCranking) { ASSERT_EQ( 0, GET_RPM()) << "RPM at the 14"; /* 14 */ EVENT(/* timestamp*/1.194742, T_PRIMARY, /*value*/true); // first synch & fast spinning RPM - ASSERT_EQ( 48, GET_RPM()) << "RPM at the 14"; + ASSERT_EQ( 31, GET_RPM()) << "RPM at the 14"; /* 15 */ EVENT(/* timestamp*/1.20417975, T_SECONDARY, /*value*/false); /* 16 */ EVENT(/* timestamp*/1.25380075, T_SECONDARY, /*value*/true); /* 17 */ EVENT(/* timestamp*/1.30114225, T_PRIMARY, /*value*/true); ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking"; /* 18 */ EVENT(/* timestamp*/1.3341915, T_SECONDARY, /*value*/false); /* 19 */ EVENT(/* timestamp*/1.383534, T_SECONDARY, /*value*/true); - ASSERT_EQ( 107, GET_RPM()) << "RPM at the 19"; - ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking"; + ASSERT_EQ( 67, GET_RPM()) << "RPM at the 19"; // second synch /* 22 */ EVENT(/* timestamp*/1.45352675, T_PRIMARY, /*value*/true); - ASSERT_EQ( 1, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking"; - ASSERT_EQ( 464, GET_RPM()) << "RPM at the 22"; + ASSERT_EQ( 33, GET_RPM()) << "RPM at the 22"; /* 23 */ EVENT(/* timestamp*/1.46291525, T_SECONDARY, /*value*/false); /* 25 */ EVENT(/* timestamp*/1.49939025, T_PRIMARY, /*value*/false); /* 27 */ EVENT(/* timestamp*/1.511785, T_SECONDARY, /*value*/true); /* 28 */ EVENT(/* timestamp*/1.5908545, T_SECONDARY, /*value*/false); /* 31 */ EVENT(/* timestamp*/1.6399845, T_SECONDARY, /*value*/true); - ASSERT_EQ( 1, eth.getWarningCounter()) << "warningCounter#realCranking"; /* 32 */ EVENT(/* timestamp*/1.70975875, T_PRIMARY, /*value*/true); - ASSERT_EQ( 2, eth.getWarningCounter()) << "warningCounter#realCranking"; /* 33 */ EVENT(/* timestamp*/1.7194455, T_SECONDARY, /*value*/false); /* 36 */ EVENT(/* timestamp*/1.7697125, T_SECONDARY, /*value*/true); /* 37 */ EVENT(/* timestamp*/1.817179, T_PRIMARY, /*value*/true); @@ -85,9 +81,9 @@ TEST(cranking, hardcodedRealCranking) { /* 41 */ EVENT(/* timestamp*/1.9011835, T_SECONDARY, /*value*/true); /* 42 */ EVENT(/* timestamp*/1.97691675, T_PRIMARY, /*value*/true); /* 43 */ EVENT(/* timestamp*/1.9822455, T_SECONDARY, /*value*/false); - ASSERT_EQ( 449, GET_RPM()) << "RPM at the 17"; + ASSERT_EQ( 233, GET_RPM()) << "RPM at the 17"; /* 44 */ EVENT(/* timestamp*/2.001249, T_PRIMARY, /*value*/false); - ASSERT_EQ( 449, GET_RPM()) << "RPM at the 17"; + ASSERT_EQ( 233, GET_RPM()) << "RPM at the 17"; /* 45 */ EVENT(/* timestamp*/2.0070235, T_SECONDARY, /*value*/true); @@ -109,7 +105,6 @@ TEST(cranking, hardcodedRealCranking) { /* 67 */ EVENT(/* timestamp*/2.308357, T_SECONDARY, /*value*/false); /* 68 */ EVENT(/* timestamp*/2.33551175, T_SECONDARY, /*value*/true); /* 69 */ EVENT(/* timestamp*/2.3601205, T_PRIMARY, /*value*/true); - ASSERT_EQ( 1, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking"; /* 70 */ EVENT(/* timestamp*/2.382952, T_SECONDARY, /*value*/false); /* 71 */ EVENT(/* timestamp*/2.41535525, T_SECONDARY, /*value*/true); /* 74 */ EVENT(/* timestamp*/2.45321725, T_PRIMARY, /*value*/true); @@ -120,7 +115,6 @@ TEST(cranking, hardcodedRealCranking) { /* 81 */ EVENT(/* timestamp*/2.533664, T_SECONDARY, /*value*/true); /* 84 */ EVENT(/* timestamp*/2.56564675, T_PRIMARY, /*value*/true); /* 85 */ EVENT(/* timestamp*/2.57087425, T_SECONDARY, /*value*/false); - ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking"; /* 86 */ EVENT(/* timestamp*/2.59612075, T_SECONDARY, /*value*/true); /* 89 */ EVENT(/* timestamp*/2.61853375, T_PRIMARY, /*value*/true); /* 90 */ EVENT(/* timestamp*/2.6365195, T_SECONDARY, /*value*/false); @@ -154,8 +148,7 @@ TEST(cranking, hardcodedRealCranking) { /* 134 */ EVENT(/* timestamp*/3.031735, T_PRIMARY, /*value*/true); - ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking"; - ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0)) << "@0"; + ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking"; - ASSERT_EQ( 1231, GET_RPM()) << "RPM at the end"; + ASSERT_EQ( 719, GET_RPM()) << "RPM at the end"; } diff --git a/unit_tests/tests/trigger/test_trigger_decoder.cpp b/unit_tests/tests/trigger/test_trigger_decoder.cpp index 3b4f5b197fe..ca8ab42e12c 100644 --- a/unit_tests/tests/trigger/test_trigger_decoder.cpp +++ b/unit_tests/tests/trigger/test_trigger_decoder.cpp @@ -519,7 +519,7 @@ TEST(misc, testTriggerDecoder) { applyNonPersistentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); } - testTriggerDecoder2("miata 1990", MIATA_1990, 11, 0.2985, 0.3890); + testTriggerDecoder2("miata 1990", MIATA_1990, 8, 0.7015, 0.3890); testTriggerDecoder3("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0, 2.9994); testTriggerDecoder2("CAMARO_4", CAMARO_4, 40, 0.5, 0);