This commit is contained in:
rusefi 2018-03-04 16:13:23 -05:00
parent 22405647ed
commit b72e7952cd
7 changed files with 58 additions and 6 deletions

View File

@ -526,7 +526,10 @@ static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return CONFIG(isCylinderCleanupEnabled) && (getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CLEANUP_MODE_TPS); return CONFIG(isCylinderCleanupEnabled) && (getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CLEANUP_MODE_TPS);
} }
// Prime injection pulse, mainly needed for mono-injectors or long intake manifolds. /**
* Prime injection pulse, mainly needed for mono-injectors or long intake manifolds.
* See testStartOfCrankingPrimingPulse()
*/
static void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses. // First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.

View File

@ -28,12 +28,14 @@
#include "afm2mapConverter.h" #include "afm2mapConverter.h"
#include "test_signal_executor.h" #include "test_signal_executor.h"
#include "trigger_central.h" #include "trigger_central.h"
#include "test_startOfCrankingPrimingPulse.h"
#include "test_util.h" #include "test_util.h"
#include "map_resize.h" #include "map_resize.h"
#include "engine_math.h" #include "engine_math.h"
#include "test_engine_math.h" #include "test_engine_math.h"
#include "test_trigger_decoder.h" #include "test_trigger_decoder.h"
typedef int32_t msg_t; typedef int32_t msg_t;
#include "hal_streams.h" #include "hal_streams.h"
@ -72,6 +74,8 @@ int main(void) {
testOverflow64Counter(); testOverflow64Counter();
testInterpolate3d(); testInterpolate3d();
testFindIndex(); testFindIndex();
testPlainCrankingWithoutAdvancedFeatures();
testStartOfCrankingPrimingPulse();
testInterpolate2d(); testInterpolate2d();
testGpsParser(); testGpsParser();
testMisc(); testMisc();

View File

@ -4,6 +4,7 @@ TEST_SRC_CPP = test_util.cpp \
test_basic_math/test_find_index.cpp \ test_basic_math/test_find_index.cpp \
test_basic_math/test_interpolation_3d.cpp \ test_basic_math/test_interpolation_3d.cpp \
test_data_structures/test_engine_math.cpp \ test_data_structures/test_engine_math.cpp \
test_startOfCrankingPrimingPulse.cpp \
test_idle_controller.cpp \ test_idle_controller.cpp \
test_trigger_decoder.cpp \ test_trigger_decoder.cpp \
test_fuel_map.cpp \ test_fuel_map.cpp \

View File

@ -0,0 +1,27 @@
/*
* test_startOfCrankingPrimingPulse.cpp
*
* Created on: Mar 4, 2018
* @author Andrey Belomutskiy, (c) 2012-2018
*/
#include "test_startOfCrankingPrimingPulse.h"
#include "test_trigger_decoder.h"
void testPlainCrankingWithoutAdvancedFeatures() {
// this is just a reference unit test implementation
printf("*************************************************** testPlainCrankingWithoutAdvancedFeatures\r\n");
EngineTestHelper eth(TEST_ENGINE);
EXPAND_EngineTestHelper
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
}
void testStartOfCrankingPrimingPulse() {
}

View File

@ -0,0 +1,16 @@
/*
* test_startOfCrankingPrimingPulse.h
*
* Created on: Mar 4, 2018
* @author Andrey Belomutskiy, (c) 2012-2018
*/
#ifndef TEST_STARTOFCRANKINGPRIMINGPULSE_H_
#define TEST_STARTOFCRANKINGPRIMINGPULSE_H_
#include "main.h"
void testPlainCrankingWithoutAdvancedFeatures();
void testStartOfCrankingPrimingPulse();
#endif /* TEST_STARTOFCRANKINGPRIMINGPULSE_H_ */

View File

@ -26,7 +26,6 @@
#include "main_trigger_callback.h" #include "main_trigger_callback.h"
#include "engine.h" #include "engine.h"
#include "advance_map.h" #include "advance_map.h"
#include "engine_test_helper.h"
#include "speed_density.h" #include "speed_density.h"
#include "fuel_math.h" #include "fuel_math.h"
#include "spark_logic.h" #include "spark_logic.h"
@ -615,7 +614,7 @@ static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int inject
assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffset); assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffset);
} }
static void setTestBug299small(EngineTestHelper *eth) { void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth) {
Engine *engine = &eth->engine; Engine *engine = &eth->engine;
EXPAND_Engine EXPAND_Engine
@ -644,7 +643,7 @@ static void setTestBug299small(EngineTestHelper *eth) {
} }
static void setTestBug299(EngineTestHelper *eth) { static void setTestBug299(EngineTestHelper *eth) {
setTestBug299small(eth); setupSimpleTestEngineWithMafAndTT_ONE_trigger(eth);
Engine *engine = &eth->engine; Engine *engine = &eth->engine;
EXPAND_Engine EXPAND_Engine
@ -1277,7 +1276,7 @@ void testMissedSpark299(void) {
EXPAND_EngineTestHelper EXPAND_EngineTestHelper
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
engineConfiguration->useOnlyRisingEdgeForTrigger = false; engineConfiguration->useOnlyRisingEdgeForTrigger = false;
setTestBug299small(&eth); setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
engineConfiguration->isIgnitionEnabled = true; engineConfiguration->isIgnitionEnabled = true;
engineConfiguration->isInjectionEnabled = false; engineConfiguration->isInjectionEnabled = false;

View File

@ -8,6 +8,8 @@
#ifndef TEST_TRIGGER_DECODER_H_ #ifndef TEST_TRIGGER_DECODER_H_
#define TEST_TRIGGER_DECODER_H_ #define TEST_TRIGGER_DECODER_H_
#include "engine_test_helper.h"
void testTriggerDecoder(void); void testTriggerDecoder(void);
void testFuelSchedulerBug299smallAndMedium(void); void testFuelSchedulerBug299smallAndMedium(void);
void testFuelSchedulerBug299smallAndLarge(void); void testFuelSchedulerBug299smallAndLarge(void);
@ -18,6 +20,6 @@ void testRpmCalculator(void);
void testStartupFuelPumping(void); void testStartupFuelPumping(void);
void test1995FordInline6TriggerDecoder(void); void test1995FordInline6TriggerDecoder(void);
void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPointIndex, float channel1duty, float channel2duty); void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPointIndex, float channel1duty, float channel2duty);
void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth);
#endif /* TEST_TRIGGER_DECODER_H_ */ #endif /* TEST_TRIGGER_DECODER_H_ */