auto-sync
This commit is contained in:
parent
9aee4e7057
commit
adb2b8104a
|
@ -58,6 +58,18 @@ void turnSparkPinLow(IgnitionEvent *event) {
|
||||||
|
|
||||||
void turnSparkPinHigh(IgnitionEvent *event) {
|
void turnSparkPinHigh(IgnitionEvent *event) {
|
||||||
IgnitionOutputPin *output = event->output;
|
IgnitionOutputPin *output = event->output;
|
||||||
|
|
||||||
|
#if ! EFI_UNIT_TEST
|
||||||
|
if (engine->rpmCalculator.rpmValue > 2 * engineConfiguration->cranking.rpm) {
|
||||||
|
const char *outputName = output->name;
|
||||||
|
if (prevSparkName == outputName) {
|
||||||
|
warning(CUSTOM_OBD_SKIPPED_SPARK, "looks like skipped spark event %d %s", getRevolutionCounter(), outputName);
|
||||||
|
}
|
||||||
|
prevSparkName = outputName;
|
||||||
|
}
|
||||||
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||||
scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
||||||
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
||||||
|
@ -120,15 +132,6 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
|
||||||
if (rpm > 2 * engineConfiguration->cranking.rpm) {
|
|
||||||
const char *outputName = iEvent->output->name;
|
|
||||||
if (prevSparkName == outputName) {
|
|
||||||
warning(CUSTOM_OBD_SKIPPED_SPARK, "looks like skipped spark event %d %s", getRevolutionCounter(), outputName);
|
|
||||||
}
|
|
||||||
prevSparkName = outputName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note how we do not check if spark is limited or not while scheduling 'spark down'
|
* Note how we do not check if spark is limited or not while scheduling 'spark down'
|
||||||
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
|
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
|
||||||
|
|
|
@ -13,13 +13,18 @@
|
||||||
#include "accel_enrichment.h"
|
#include "accel_enrichment.h"
|
||||||
#include "thermistors.h"
|
#include "thermistors.h"
|
||||||
#include "advance_map.h"
|
#include "advance_map.h"
|
||||||
|
#include "event_queue.h"
|
||||||
|
|
||||||
extern int timeNow;
|
extern int timeNow;
|
||||||
extern EnginePins enginePins;
|
extern EnginePins enginePins;
|
||||||
|
extern EventQueue schedulingQueue;
|
||||||
|
extern int warningCounter;
|
||||||
|
|
||||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
|
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
|
||||||
ec = &persistentConfig.engineConfiguration;
|
ec = &persistentConfig.engineConfiguration;
|
||||||
|
warningCounter = 0;
|
||||||
|
|
||||||
|
schedulingQueue.clear();
|
||||||
enginePins.reset();
|
enginePins.reset();
|
||||||
|
|
||||||
engineConfiguration = ec;
|
engineConfiguration = ec;
|
||||||
|
|
|
@ -124,6 +124,7 @@ int getRevolutionCounter(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
testMissedSpark299();
|
||||||
testSparkReverseOrderBug319();
|
testSparkReverseOrderBug319();
|
||||||
testFuelSchedulerBug299smallAndLarge();
|
testFuelSchedulerBug299smallAndLarge();
|
||||||
testFuelSchedulerBug299smallAndMedium();
|
testFuelSchedulerBug299smallAndMedium();
|
||||||
|
@ -178,7 +179,10 @@ int main(void) {
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int warningCounter = 0;
|
||||||
|
|
||||||
bool warning(obd_code_e code, const char *format, ...) {
|
bool warning(obd_code_e code, const char *format, ...) {
|
||||||
|
warningCounter++;
|
||||||
printf("Warning: ");
|
printf("Warning: ");
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
extern int timeNow;
|
extern int timeNow;
|
||||||
extern float unitTestValue;
|
extern float unitTestValue;
|
||||||
extern float testMafValue;
|
extern float testMafValue;
|
||||||
|
extern int warningCounter;
|
||||||
extern bool printTriggerDebug;
|
extern bool printTriggerDebug;
|
||||||
extern float actualSynchGap;
|
extern float actualSynchGap;
|
||||||
|
|
||||||
|
@ -1224,3 +1224,53 @@ void testSparkReverseOrderBug319(void) {
|
||||||
schedulingQueue.executeAll(timeNow);
|
schedulingQueue.executeAll(timeNow);
|
||||||
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
|
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testMissedSpark299(void) {
|
||||||
|
printf("*************************************************** testMissedSpark299\r\n");
|
||||||
|
|
||||||
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
EXPAND_EngineTestHelper
|
||||||
|
setTestBug299(ð);
|
||||||
|
engineConfiguration->isIgnitionEnabled = true;
|
||||||
|
engineConfiguration->isInjectionEnabled = false;
|
||||||
|
|
||||||
|
assertEqualsM("warningCounter#0", 13, warningCounter);
|
||||||
|
|
||||||
|
printf("*************************************************** testMissedSpark299 start\r\n");
|
||||||
|
|
||||||
|
setWholeTimingTable(0 PASS_ENGINE_PARAMETER);
|
||||||
|
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
|
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerRise();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerFall();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerRise();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerFall();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
|
||||||
|
|
||||||
|
setWholeTimingTable(40 PASS_ENGINE_PARAMETER);
|
||||||
|
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerRise();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerFall();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerRise();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
timeNow += MS2US(20);
|
||||||
|
eth.firePrimaryTriggerFall();
|
||||||
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ void testTriggerDecoder(void);
|
||||||
void testFuelSchedulerBug299smallAndMedium(void);
|
void testFuelSchedulerBug299smallAndMedium(void);
|
||||||
void testFuelSchedulerBug299smallAndLarge(void);
|
void testFuelSchedulerBug299smallAndLarge(void);
|
||||||
void testSparkReverseOrderBug319(void);
|
void testSparkReverseOrderBug319(void);
|
||||||
|
void testMissedSpark299(void);
|
||||||
void testRpmCalculator(void);
|
void testRpmCalculator(void);
|
||||||
void testStartupFuelPumping(void);
|
void testStartupFuelPumping(void);
|
||||||
void test1995FordInline6TriggerDecoder(void);
|
void test1995FordInline6TriggerDecoder(void);
|
||||||
|
|
Loading…
Reference in New Issue