#571 I am not getting it

This commit is contained in:
rusefi 2018-03-04 23:53:48 -05:00
parent a0725457f4
commit 06f64484fb
3 changed files with 17 additions and 5 deletions

View File

@ -530,11 +530,15 @@ static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
* 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() * See testStartOfCrankingPrimingPulse()
*/ */
static void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#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.
// So we check and update the ignition switch counter in non-volatile backup-RAM // So we check and update the ignition switch counter in non-volatile backup-RAM
#if EFI_PROD_CODE || defined(__DOXYGEN__)
uint32_t ignSwitchCounter = backupRamLoad(BACKUP_IGNITION_SWITCH_COUNTER); uint32_t ignSwitchCounter = backupRamLoad(BACKUP_IGNITION_SWITCH_COUNTER);
#else /* EFI_PROD_CODE */
uint32_t ignSwitchCounter = 0;
#endif /* EFI_PROD_CODE */
// if we're just toying with the ignition switch, give it another chance eventually... // if we're just toying with the ignition switch, give it another chance eventually...
if (ignSwitchCounter > 10) if (ignSwitchCounter > 10)
ignSwitchCounter = 0; ignSwitchCounter = 0;
@ -547,7 +551,7 @@ static void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// fill-in the prime event struct // fill-in the prime event struct
#if EFI_UNIT_TEST || defined(__DOXYGEN__) #if EFI_UNIT_TEST || defined(__DOXYGEN__)
primeInjEvent.engine = engine; primeInjEvent.engine = engine;
#endif #endif /* EFI_UNIT_TEST */
primeInjEvent.ownIndex = 0; primeInjEvent.ownIndex = 0;
primeInjEvent.isSimultanious = true; primeInjEvent.isSimultanious = true;
@ -563,6 +567,7 @@ static void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
scheduleForLater(sDown, turnOffDelayUs, (schfunc_t) &endSimultaniousInjectionOnlyTogglePins, engine); scheduleForLater(sDown, turnOffDelayUs, (schfunc_t) &endSimultaniousInjectionOnlyTogglePins, engine);
} }
} }
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// we'll reset it later when the engine starts // we'll reset it later when the engine starts
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, ignSwitchCounter + 1); backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, ignSwitchCounter + 1);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */

View File

@ -19,6 +19,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX
void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECLARE_ENGINE_PARAMETER_SUFFIX); void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECLARE_ENGINE_PARAMETER_SUFFIX);
int isIgnitionTimingError(void); int isIgnitionTimingError(void);
void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void showMainHistogram(void); void showMainHistogram(void);

View File

@ -34,8 +34,8 @@ void testPlainCrankingWithoutAdvancedFeatures() {
// two simultaneous injections // two simultaneous injections
assertEqualsM("plain#2", 4, schedulingQueue.size()); assertEqualsM("plain#2", 4, schedulingQueue.size());
// assertEvent("sim start", 0, (void*)startSimultaniousInjection, timeNowUs, 97975, engine); assertEvent5("sim start", 0, (void*)startSimultaniousInjection, timeNowUs, 97975);
// assertEvent("sim end", 1, (void*)endSimultaniousInjection, timeNowUs, 100000, 3); assertEvent5("sim end", 1, (void*)endSimultaniousInjection, timeNowUs, 100000);
} }
@ -49,5 +49,11 @@ void testStartOfCrankingPrimingPulse() {
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth); setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
// prod code invokes this on ECU start, here we have to mimic this behavior
startPrimeInjectionPulse(PASS_ENGINE_PARAMETER_SIGNATURE);
assertEqualsM("prime fuel", 0, schedulingQueue.size());
} }