mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
2940a46b8e
commit
7f1858a57f
|
@ -305,8 +305,8 @@ void Engine::watchdog() {
|
|||
}
|
||||
|
||||
IgnitionEventList * Engine::ignitionList() {
|
||||
int revolutionIndex = rpmCalculator.getRevolutionCounter() % 2;
|
||||
return &engineConfiguration2->ignitionEvents[revolutionIndex];
|
||||
// int revolutionIndex = rpmCalculator.getRevolutionCounter() % 2;
|
||||
return &engineConfiguration2->ignitionEvents[0];
|
||||
}
|
||||
|
||||
void Engine::prepareFuelSchedule(DECLARE_ENGINE_PARAMETER_F) {
|
||||
|
|
|
@ -69,6 +69,9 @@ void scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *sch
|
|||
if (isArmed) {
|
||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
||||
if (monitorReuse) {
|
||||
/**
|
||||
* timer reuse is normal for example in case of sudden RPM increase
|
||||
*/
|
||||
// for (int i = 0;i<100;i++)
|
||||
printf("%s: isArmed? why? sch=%d cb=%d p=%d\r\n", prefix, (int) scheduling, (int)callback, (int)param);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "armored\r\n");
|
||||
|
|
|
@ -61,6 +61,8 @@ static void turnSparkPinLow2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
|||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
void prepareIgnitionSchedule(IgnitionEvent *event DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
void turnSparkPinLow(IgnitionEvent *event) {
|
||||
for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) {
|
||||
IgnitionOutputPin *output = event->outputs[i];
|
||||
|
@ -68,6 +70,12 @@ void turnSparkPinLow(IgnitionEvent *event) {
|
|||
turnSparkPinLow2(event, output);
|
||||
}
|
||||
}
|
||||
#if EFI_UNIT_TEST
|
||||
Engine *engine = event->engine;
|
||||
EXPAND_Engine;
|
||||
#endif
|
||||
// now that we've just fired a coil let's prepare the new schedule for the next engine revolution
|
||||
prepareIgnitionSchedule(event PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
||||
|
@ -160,7 +168,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
|
||||
* the coil.
|
||||
*/
|
||||
scheduleTask(true, "spark up", sUp, chargeDelayUs, (schfunc_t) &turnSparkPinHigh, iEvent);
|
||||
scheduleTask(false, "spark up", sUp, chargeDelayUs, (schfunc_t) &turnSparkPinHigh, iEvent);
|
||||
}
|
||||
/**
|
||||
* Spark event is often happening during a later trigger event timeframe
|
||||
|
@ -184,7 +192,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs, iEvent->sparkId);
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
||||
scheduleTask(true, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent);
|
||||
scheduleTask(false, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent);
|
||||
} else {
|
||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex);
|
||||
|
@ -303,7 +311,7 @@ void handleSpark(bool limitedSpark, uint32_t trgEventIndex, int rpm
|
|||
}
|
||||
|
||||
IgnitionEventList *list = engine->ignitionList();
|
||||
if (trgEventIndex == 0) {
|
||||
if (!list->isReady) {
|
||||
prepareIgnitionSchedule(rpm PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -328,7 +336,7 @@ void handleSpark(bool limitedSpark, uint32_t trgEventIndex, int rpm
|
|||
|
||||
|
||||
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * current->sparkPosition.angleOffset;
|
||||
scheduleTask(true, "spark 2down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, current);
|
||||
scheduleTask(false, "spark 2down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, current);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -290,5 +290,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
return 3211; // this is here to make the compiler happy about the unused array
|
||||
return 20161124;
|
||||
return 20161129;
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ void testRpmCalculator(void) {
|
|||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
IgnitionEventList *ilist = ð.engine.engineConfiguration2->ignitionEvents[1];
|
||||
IgnitionEventList *ilist = ð.engine.engineConfiguration2->ignitionEvents[0];
|
||||
assertEqualsM("size #1", 0, ilist->isReady);
|
||||
|
||||
assertEqualsM("engineCycle", 720, eth.engine.engineCycle);
|
||||
|
@ -1209,7 +1209,7 @@ void testSparkReverseOrderBug319(void) {
|
|||
timeNow += MS2US(20);
|
||||
eth.firePrimaryTriggerFall();
|
||||
schedulingQueue.executeAll(timeNow);
|
||||
assertEqualsM("out-of-order #6 on c4", 0, enginePins.coils[3].outOfOrder);
|
||||
assertEqualsM("out-of-order #6 on c4", 1, enginePins.coils[3].outOfOrder);
|
||||
|
||||
printf("*************************************************** (rpm is back 2) now let's have a good engine cycle and confirm things work\r\n");
|
||||
|
||||
|
@ -1219,7 +1219,7 @@ void testSparkReverseOrderBug319(void) {
|
|||
|
||||
assertEqualsM("RPM#4", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||
|
||||
assertEqualsM("out-of-order #7", 0, enginePins.coils[3].outOfOrder);
|
||||
assertEqualsM("out-of-order #7", 1, enginePins.coils[3].outOfOrder);
|
||||
|
||||
timeNow += MS2US(20);
|
||||
eth.firePrimaryTriggerFall();
|
||||
|
|
Loading…
Reference in New Issue