auto-sync
This commit is contained in:
parent
de2917cb97
commit
f0e656f644
|
@ -41,7 +41,7 @@ bool EventQueue::checkIfPending(scheduling_s *scheduling) {
|
||||||
bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) {
|
bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) {
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
efiAssert(callback != NULL, "NULL callback", false);
|
efiAssert(callback != NULL, "NULL callback", false);
|
||||||
|
|
||||||
if (scheduling->isScheduled)
|
if (scheduling->isScheduled)
|
||||||
|
@ -56,7 +56,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t
|
||||||
LL_PREPEND(head, scheduling);
|
LL_PREPEND(head, scheduling);
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
scheduling_s *insertPosition = head;
|
scheduling_s *insertPosition = head;
|
||||||
|
@ -68,7 +68,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t
|
||||||
insertPosition->next = scheduling;
|
insertPosition->next = scheduling;
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif
|
#endif /* EFI_UNIT_TEST */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,15 @@
|
||||||
#include "engine_test_helper.h"
|
#include "engine_test_helper.h"
|
||||||
#include "speed_density.h"
|
#include "speed_density.h"
|
||||||
#include "test_speed_density.h"
|
#include "test_speed_density.h"
|
||||||
|
#include "event_queue.h"
|
||||||
|
|
||||||
|
extern EventQueue schedulingQueue;
|
||||||
|
|
||||||
void testSpeedDensity(void) {
|
void testSpeedDensity(void) {
|
||||||
printf("*************************************************** testSpeedDensity\r\n");
|
printf("*************************************************** testSpeedDensity\r\n");
|
||||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||||
EXPAND_EngineTestHelper;
|
EXPAND_EngineTestHelper;
|
||||||
|
schedulingQueue.clear(); // todo: there must be a better place for this
|
||||||
|
|
||||||
eth.ec->trigger.customTotalToothCount = 8;
|
eth.ec->trigger.customTotalToothCount = 8;
|
||||||
eth.applyTriggerShape();
|
eth.applyTriggerShape();
|
||||||
|
|
|
@ -583,6 +583,9 @@ void testFuelSchedulerBug299(void) {
|
||||||
EngineTestHelper eth(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
EXPAND_EngineTestHelper;
|
EXPAND_EngineTestHelper;
|
||||||
assertEquals(LM_PLAIN_MAF, engineConfiguration->algorithm);
|
assertEquals(LM_PLAIN_MAF, engineConfiguration->algorithm);
|
||||||
|
engineConfiguration->isIgnitionEnabled = false;
|
||||||
|
engineConfiguration->specs.cylindersCount = 4;
|
||||||
|
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
||||||
|
|
||||||
timeNow = 0;
|
timeNow = 0;
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
@ -601,18 +604,42 @@ void testFuelSchedulerBug299(void) {
|
||||||
|
|
||||||
assertEqualsM("RPM=0", 0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
assertEqualsM("RPM=0", 0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||||
|
|
||||||
|
|
||||||
eth.fireTriggerEvents2(2, MS2US(20));
|
eth.fireTriggerEvents2(2, MS2US(20));
|
||||||
|
|
||||||
schedulingQueue.executeAll(99999999); // this is needed to clear 'isScheduled' flag
|
schedulingQueue.executeAll(99999999); // this is needed to clear 'isScheduled' flag
|
||||||
engine->iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
|
engine->iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
|
||||||
|
|
||||||
eth.fireTriggerEvents2(2, MS2US(20));
|
uint32_t start = timeNow;
|
||||||
|
eth.fireTriggerEvents2(1, MS2US(20));
|
||||||
|
|
||||||
assertEqualsM("qs#0", 20, schedulingQueue.size());
|
assertEqualsM("qs#0", 4, schedulingQueue.size());
|
||||||
|
|
||||||
// assertEqualsM("ev 3", st + 13333 - 1515, schedulingQueue.getForUnitText(0)->momentX);
|
{
|
||||||
// assertEqualsM("ev 4", st + 13333 - 1515, schedulingQueue.getForUnitText(1)->momentX);
|
scheduling_s *ev = schedulingQueue.getForUnitText(0);
|
||||||
// assertEqualsM2("ev 5", st + 14277, schedulingQueue.getForUnitText(2)->momentX, 2);
|
|
||||||
|
assertREqualsM("Call@0", (void*)ev->callback, (void*)seTurnPinHigh);
|
||||||
|
assertEqualsM("ev 0", start + MS2US(24), ev->momentX);
|
||||||
|
assertEqualsLM("in 0", (long)&enginePins.injectors[3], (long)ev->param);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
scheduling_s *ev = schedulingQueue.getForUnitText(1);
|
||||||
|
assertREqualsM("Call@1", (void*)ev->callback, (void*)seTurnPinLow);
|
||||||
|
assertEqualsM("ev 1", start + MS2US(27), ev->momentX);
|
||||||
|
assertEqualsLM("in 1", (long)&enginePins.injectors[3], (long)ev->param);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
scheduling_s *ev = schedulingQueue.getForUnitText(2);
|
||||||
|
assertREqualsM("Call@2", (void*)ev->callback, (void*)seTurnPinHigh);
|
||||||
|
assertEqualsM("ev 2", start + MS2US(34), ev->momentX);
|
||||||
|
assertEqualsLM("in 2", (long)&enginePins.injectors[1], (long)ev->param);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
scheduling_s *ev = schedulingQueue.getForUnitText(3);
|
||||||
|
assertREqualsM("Call@3", (void*)ev->callback, (void*)seTurnPinLow);
|
||||||
|
assertEqualsM("ev 3", start + MS2US(37), ev->momentX);
|
||||||
|
assertEqualsLM("in 3", (long)&enginePins.injectors[1], (long)ev->param);
|
||||||
|
}
|
||||||
|
|
||||||
testMafValue = 0;
|
testMafValue = 0;
|
||||||
assertEqualsM("maf", 0, getMaf(PASS_ENGINE_PARAMETER_F));
|
assertEqualsM("maf", 0, getMaf(PASS_ENGINE_PARAMETER_F));
|
||||||
|
|
Loading…
Reference in New Issue