auto-sync

This commit is contained in:
rusEfi 2016-11-07 23:01:47 -05:00
parent 7c97baedb5
commit ae77525beb
3 changed files with 37 additions and 21 deletions

View File

@ -1684,7 +1684,7 @@ typedef enum {
CUSTOM_OBD_16 = 6016,
CUSTOM_OBD_17 = 6017,
CUSTOM_OBD_18 = 6018,
CUSTOM_OBD_19 = 6019,
CUSTOM_OBD_PIN_NOT_ASSIGNED = 6019,
CUSTOM_OBD_20 = 6020,
CUSTOM_OBD_21 = 6021,

View File

@ -98,7 +98,7 @@ static void addIgnitionEvent(angle_t localAdvance, angle_t dwellAngle, IgnitionE
if (!isPinAssigned(output)) {
// todo: extact method for this index math
warning(CUSTOM_OBD_19, "no_pin_cl #%s", output->name);
warning(CUSTOM_OBD_PIN_NOT_ASSIGNED, "no_pin_cl #%s", output->name);
}
event->output = output;
event->advance = localAdvance;
@ -418,7 +418,8 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
ENGINE(engineCycle) = getEngineCycle(CONFIG(operationMode));
#if EFI_UNIT_TEST
printf("prepareOutputSignals %d onlyEdge=%s\r\n", engineConfiguration->trigger.type, boolToString(engineConfiguration->useOnlyRisingEdgeForTrigger));
printf("prepareOutputSignals %d onlyEdge=%s %s\r\n", engineConfiguration->trigger.type, boolToString(engineConfiguration->useOnlyRisingEdgeForTrigger),
getIgnition_mode_e(engineConfiguration->ignitionMode));
#endif
engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;

View File

@ -606,10 +606,12 @@ static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int inject
assertTrueM("is overlapping", isOverlapping == ev->isOverlapping);
}
static void setTestBug299(EngineTestHelper *eth) {
static void setTestBug299small(EngineTestHelper *eth) {
Engine *engine = &eth->engine;
EXPAND_Engine
engine->iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
assertEquals(LM_PLAIN_MAF, engineConfiguration->fuelAlgorithm);
engineConfiguration->isIgnitionEnabled = false;
engineConfiguration->specs.cylindersCount = 4;
@ -630,6 +632,14 @@ static void setTestBug299(EngineTestHelper *eth) {
eth->applyTriggerShape();
}
static void setTestBug299(EngineTestHelper *eth) {
setTestBug299small(eth);
Engine *engine = &eth->engine;
EXPAND_Engine
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
eth->fireTriggerEvents2(1, MS2US(20));
// still no RPM since need to cycles measure cycle duration
@ -1230,47 +1240,52 @@ void testMissedSpark299(void) {
EngineTestHelper eth(TEST_ENGINE);
EXPAND_EngineTestHelper
setTestBug299(&eth);
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
setTestBug299small(&eth);
engineConfiguration->isIgnitionEnabled = true;
engineConfiguration->isInjectionEnabled = false;
assertEqualsM("warningCounter#0", 13, warningCounter);
assertEqualsM("warningCounter#0", 7, warningCounter);
timeNow += MS2US(20);
eth.firePrimaryTriggerRise();
schedulingQueue.executeAll(timeNow);
timeNow += MS2US(20);
eth.firePrimaryTriggerRise();
schedulingQueue.executeAll(timeNow);
timeNow += MS2US(20);
eth.firePrimaryTriggerRise();
schedulingQueue.executeAll(timeNow);
printf("*************************************************** testMissedSpark299 start\r\n");
setWholeTimingTable(0 PASS_ENGINE_PARAMETER);
assertEquals(6000, eth.engine.rpmCalculator.rpmValue);
setWholeTimingTable(3 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);
setWholeTimingTable(-5 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);
assertEqualsM("warningCounter#1", 8, warningCounter);
}