From 5513e0174b6c9bb875e4acecf7f994fc6760ec84 Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 15 Oct 2019 05:30:38 -0400 Subject: [PATCH] Coil duty cycle ignores dwell #977 --- unit_tests/tests/test_trigger_decoder.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/unit_tests/tests/test_trigger_decoder.cpp b/unit_tests/tests/test_trigger_decoder.cpp index 9e825f14fa..214478e4f9 100644 --- a/unit_tests/tests/test_trigger_decoder.cpp +++ b/unit_tests/tests/test_trigger_decoder.cpp @@ -186,6 +186,16 @@ TEST(misc, test1995FordInline6TriggerDecoder) { ASSERT_FLOAT_EQ(0.5, getSparkDwell(2000 PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell"; } +TEST(misc, testGetCoilDutyCycleIssue977) { + WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996); + + int rpm = 2000; + engine->rpmCalculator.setRpmValue(rpm PASS_ENGINE_PARAMETER_SUFFIX); + ASSERT_EQ( 4, getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell"; + + ASSERT_NEAR( 26.66666, getCoilDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX), 0.0001); +} + TEST(misc, testFordAspire) { printf("*************************************************** testFordAspire\r\n"); @@ -208,9 +218,6 @@ TEST(misc, testFordAspire) { engine->rpmCalculator.setRpmValue(rpm PASS_ENGINE_PARAMETER_SUFFIX); ASSERT_EQ( 4, getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell"; - ASSERT_NEAR( 6.666666666, getCoilDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX), 0.0001); - - engine->rpmCalculator.setRpmValue(6000 PASS_ENGINE_PARAMETER_SUFFIX); assertEqualsM("higher rpm dwell", 3.25, getSparkDwell(6000 PASS_ENGINE_PARAMETER_SUFFIX));