mirror of https://github.com/rusefi/rusefi-1.git
Merge remote-tracking branch 'upstream/master' into test-1592
This commit is contained in:
commit
8dba21c702
|
@ -28,7 +28,7 @@ typedef struct __attribute__ ((packed)) {
|
||||||
// unfortunately all these fields are required by TS...
|
// unfortunately all these fields are required by TS...
|
||||||
bool priLevel : 1;
|
bool priLevel : 1;
|
||||||
bool secLevel : 1;
|
bool secLevel : 1;
|
||||||
bool trigger : 1;
|
bool isTDC : 1;
|
||||||
bool sync : 1;
|
bool sync : 1;
|
||||||
bool coil : 1;
|
bool coil : 1;
|
||||||
bool injector : 1;
|
bool injector : 1;
|
||||||
|
@ -61,10 +61,10 @@ int getCompositeRecordCount() {
|
||||||
int copyCompositeEvents(CompositeEvent *events) {
|
int copyCompositeEvents(CompositeEvent *events) {
|
||||||
for (int i = 0;i < NextIdx;i++) {
|
for (int i = 0;i < NextIdx;i++) {
|
||||||
CompositeEvent *event = &events[i];
|
CompositeEvent *event = &events[i];
|
||||||
event->timestamp = buffer[i].timestamp;
|
event->timestamp = SWAP_UINT32(buffer[i].timestamp);
|
||||||
event->primaryTrigger = buffer[i].priLevel;
|
event->primaryTrigger = buffer[i].priLevel;
|
||||||
event->secondaryTrigger = buffer[i].secLevel;
|
event->secondaryTrigger = buffer[i].secLevel;
|
||||||
event->trg = buffer[i].trigger;
|
event->isTDC = buffer[i].isTDC;
|
||||||
event->sync = buffer[i].sync;
|
event->sync = buffer[i].sync;
|
||||||
event->coil = buffer[i].coil;
|
event->coil = buffer[i].coil;
|
||||||
event->injector = buffer[i].injector;
|
event->injector = buffer[i].injector;
|
||||||
|
@ -81,7 +81,7 @@ static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigg
|
||||||
buffer[NextIdx].timestamp = SWAP_UINT32(nowUs);
|
buffer[NextIdx].timestamp = SWAP_UINT32(nowUs);
|
||||||
buffer[NextIdx].priLevel = trigger1;
|
buffer[NextIdx].priLevel = trigger1;
|
||||||
buffer[NextIdx].secLevel = trigger2;
|
buffer[NextIdx].secLevel = trigger2;
|
||||||
buffer[NextIdx].trigger = isTDC;
|
buffer[NextIdx].isTDC = isTDC;
|
||||||
buffer[NextIdx].sync = engine->triggerCentral.triggerState.shaft_is_synchronized;
|
buffer[NextIdx].sync = engine->triggerCentral.triggerState.shaft_is_synchronized;
|
||||||
buffer[NextIdx].coil = coil;
|
buffer[NextIdx].coil = coil;
|
||||||
buffer[NextIdx].injector = injector;
|
buffer[NextIdx].injector = injector;
|
||||||
|
@ -144,6 +144,7 @@ void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetNextCompositeEntry(timestamp, trigger1, trigger2, true PASS_ENGINE_PARAMETER_SUFFIX);
|
SetNextCompositeEntry(timestamp, trigger1, trigger2, true PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
SetNextCompositeEntry(timestamp + 10, trigger1, trigger2, false PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogTriggerCoilState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void LogTriggerCoilState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
|
@ -97,7 +97,9 @@ void InjectorOutputPin::open() {
|
||||||
overlappingCounter++;
|
overlappingCounter++;
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("turnInjectionPinHigh %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
|
if (printFuelDebug) {
|
||||||
|
printf("turnInjectionPinHigh %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
|
||||||
|
}
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
if (overlappingCounter > 1) {
|
if (overlappingCounter > 1) {
|
||||||
|
@ -106,7 +108,9 @@ void InjectorOutputPin::open() {
|
||||||
// * this is another kind of overlap which happens in case of a small duty cycle after a large duty cycle
|
// * this is another kind of overlap which happens in case of a small duty cycle after a large duty cycle
|
||||||
// */
|
// */
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs());
|
if (printFuelDebug) {
|
||||||
|
printf("overlapping, no need to touch pin %s %d\r\n", name, (int)getTimeNowUs());
|
||||||
|
}
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
} else {
|
} else {
|
||||||
setHigh();
|
setHigh();
|
||||||
|
@ -135,13 +139,17 @@ void turnInjectionPinHigh(InjectionEvent *event) {
|
||||||
|
|
||||||
void InjectorOutputPin::close() {
|
void InjectorOutputPin::close() {
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("InjectorOutputPin::close %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
|
if (printFuelDebug) {
|
||||||
|
printf("InjectorOutputPin::close %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
|
||||||
|
}
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
overlappingCounter--;
|
overlappingCounter--;
|
||||||
if (overlappingCounter > 0) {
|
if (overlappingCounter > 0) {
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
|
if (printFuelDebug) {
|
||||||
printf("was overlapping, no need to touch pin %s %d\r\n", name, (int)getTimeNowUs());
|
printf("was overlapping, no need to touch pin %s %d\r\n", name, (int)getTimeNowUs());
|
||||||
|
}
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
} else {
|
} else {
|
||||||
setLow();
|
setLow();
|
||||||
|
@ -315,7 +323,9 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "handleFuel ind=%d %d", trgEventIndex, getRevolutionCounter());
|
if (printFuelDebug) {
|
||||||
|
scheduleMsg(logger, "handleFuel ind=%d %d", trgEventIndex, getRevolutionCounter());
|
||||||
|
}
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
ENGINE(tpsAccelEnrichment.onNewValue(Sensor::get(SensorType::Tps1).value_or(0) PASS_ENGINE_PARAMETER_SUFFIX));
|
ENGINE(tpsAccelEnrichment.onNewValue(Sensor::get(SensorType::Tps1).value_or(0) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||||
|
|
|
@ -25,6 +25,10 @@ EXTERN_ENGINE;
|
||||||
extern bool verboseMode;
|
extern bool verboseMode;
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
#if EFI_PRINTF_FUEL_DETAILS || FUEL_MATH_EXTREME_LOGGING
|
||||||
|
extern bool printFuelDebug;
|
||||||
|
#endif // EFI_PRINTF_FUEL_DETAILS
|
||||||
|
|
||||||
static cyclic_buffer<int> ignitionErrorDetection;
|
static cyclic_buffer<int> ignitionErrorDetection;
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *ou
|
||||||
#if SPARK_EXTREME_LOGGING
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
scheduleMsg(logger, "spark goes low %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);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* SPARK_EXTREME_LOGGING */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* there are two kinds of 'out-of-order'
|
* there are two kinds of 'out-of-order'
|
||||||
|
@ -119,7 +123,9 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
|
||||||
event->dwellPosition.setAngle(dwellStartAngle PASS_ENGINE_PARAMETER_SUFFIX);
|
event->dwellPosition.setAngle(dwellStartAngle PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.triggerEventIndex);
|
if (printFuelDebug) {
|
||||||
|
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.triggerEventIndex);
|
||||||
|
}
|
||||||
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
|
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
}
|
}
|
||||||
|
@ -223,7 +229,7 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
|
||||||
#if SPARK_EXTREME_LOGGING
|
#if SPARK_EXTREME_LOGGING
|
||||||
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);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* SPARK_EXTREME_LOGGING */
|
||||||
|
|
||||||
if (output->outOfOrder) {
|
if (output->outOfOrder) {
|
||||||
output->outOfOrder = false;
|
output->outOfOrder = false;
|
||||||
|
@ -308,7 +314,7 @@ bool scheduleOrQueue(AngleBasedEvent *event,
|
||||||
if (isPending) {
|
if (isPending) {
|
||||||
#if SPARK_EXTREME_LOGGING
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "isPending thus not adding to queue index=%d rev=%d now=%d", trgEventIndex, getRevolutionCounter(), (int)getTimeNowUs());
|
scheduleMsg(logger, "isPending thus not adding to queue index=%d rev=%d now=%d", trgEventIndex, getRevolutionCounter(), (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* SPARK_EXTREME_LOGGING */
|
||||||
} else {
|
} else {
|
||||||
LL_APPEND2(ENGINE(angleBasedEventsHead), event, nextToothEvent);
|
LL_APPEND2(ENGINE(angleBasedEventsHead), event, nextToothEvent);
|
||||||
}
|
}
|
||||||
|
@ -350,7 +356,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
#if SPARK_EXTREME_LOGGING
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)chargeDelayUs,
|
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)chargeDelayUs,
|
||||||
event->sparkId);
|
event->sparkId);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* SPARK_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -382,7 +388,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
} else {
|
} else {
|
||||||
#if SPARK_EXTREME_LOGGING
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s now=%d for id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), event->sparkEvent.position.triggerEventIndex);
|
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s now=%d for id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), event->sparkEvent.position.triggerEventIndex);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* SPARK_EXTREME_LOGGING */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -461,7 +467,7 @@ static void scheduleAllSparkEventsUntilNextTriggerTooth(uint32_t trgEventIndex,
|
||||||
|
|
||||||
#if SPARK_EXTREME_LOGGING
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "time to invoke ind=%d %d %d", trgEventIndex, getRevolutionCounter(), (int)getTimeNowUs());
|
scheduleMsg(logger, "time to invoke ind=%d %d %d", trgEventIndex, getRevolutionCounter(), (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* SPARK_EXTREME_LOGGING */
|
||||||
|
|
||||||
scheduleByAngle(
|
scheduleByAngle(
|
||||||
sDown,
|
sDown,
|
||||||
|
|
|
@ -480,7 +480,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
||||||
|
|
||||||
#if TRIGGER_EXTREME_LOGGING
|
#if TRIGGER_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
|
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* TRIGGER_EXTREME_LOGGING */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Here we invoke all the listeners - the main engine control logic is inside these listeners
|
* Here we invoke all the listeners - the main engine control logic is inside these listeners
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
build/
|
build/
|
||||||
gcov_working_area
|
gcov_working_area
|
||||||
triggers
|
triggers
|
||||||
triggers.txt
|
triggers.txt
|
||||||
|
*.logicdata
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#define EFI_GPIO_HARDWARE TRUE
|
#define EFI_GPIO_HARDWARE TRUE
|
||||||
|
|
||||||
#define FUEL_MATH_EXTREME_LOGGING FALSE
|
#define FUEL_MATH_EXTREME_LOGGING TRUE
|
||||||
|
|
||||||
#define EFI_DEFAILED_LOGGING FALSE
|
#define EFI_DEFAILED_LOGGING FALSE
|
||||||
|
|
||||||
|
|
|
@ -103,12 +103,28 @@ void EngineTestHelper::writeEvents(const char *fileName) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mock a change of time and fire single RISE front event
|
* mock a change of time and fire single RISE front event
|
||||||
|
* DEPRECATED many usages should be migrated to
|
||||||
*/
|
*/
|
||||||
void EngineTestHelper::fireRise(float delayMs) {
|
void EngineTestHelper::fireRise(float delayMs) {
|
||||||
moveTimeForwardUs(MS2US(delayMs));
|
moveTimeForwardUs(MS2US(delayMs));
|
||||||
firePrimaryTriggerRise();
|
firePrimaryTriggerRise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EngineTestHelper::smartFireRise(float delayMs) {
|
||||||
|
smartMoveTimeForwardUs(MS2US(delayMs));
|
||||||
|
firePrimaryTriggerRise();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EngineTestHelper::fireFall(float delayMs) {
|
||||||
|
moveTimeForwardUs(MS2US(delayMs));
|
||||||
|
firePrimaryTriggerFall();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EngineTestHelper::smartFireFall(float delayMs) {
|
||||||
|
smartMoveTimeForwardUs(MS2US(delayMs));
|
||||||
|
firePrimaryTriggerFall();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fire single RISE front event
|
* fire single RISE front event
|
||||||
*/
|
*/
|
||||||
|
@ -120,11 +136,6 @@ void EngineTestHelper::firePrimaryTriggerRise() {
|
||||||
engine->triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING, nowNt, engine, engine->engineConfigurationPtr, &persistentConfig);
|
engine->triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING, nowNt, engine, engine->engineConfigurationPtr, &persistentConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineTestHelper::fireFall(float delayMs) {
|
|
||||||
moveTimeForwardUs(MS2US(delayMs));
|
|
||||||
firePrimaryTriggerFall();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EngineTestHelper::firePrimaryTriggerFall() {
|
void EngineTestHelper::firePrimaryTriggerFall() {
|
||||||
efitick_t nowNt = getTimeNowNt();
|
efitick_t nowNt = getTimeNowNt();
|
||||||
Engine *engine = &this->engine;
|
Engine *engine = &this->engine;
|
||||||
|
@ -149,6 +160,13 @@ void EngineTestHelper::fireTriggerEvents2(int count, float durationMs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EngineTestHelper::smartFireTriggerEvents2(int count, float durationMs) {
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
smartFireRise(durationMs);
|
||||||
|
smartFireFall(durationMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EngineTestHelper::clearQueue() {
|
void EngineTestHelper::clearQueue() {
|
||||||
engine.executor.executeAll(99999999); // this is needed to clear 'isScheduled' flag
|
engine.executor.executeAll(99999999); // this is needed to clear 'isScheduled' flag
|
||||||
ASSERT_EQ( 0, engine.executor.size()) << "Failed to clearQueue";
|
ASSERT_EQ( 0, engine.executor.size()) << "Failed to clearQueue";
|
||||||
|
@ -169,6 +187,33 @@ void EngineTestHelper::moveTimeForwardUs(int deltaTimeUs) {
|
||||||
timeNowUs += deltaTimeUs;
|
timeNowUs += deltaTimeUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method executed all pending events wile
|
||||||
|
*/
|
||||||
|
void EngineTestHelper::smartMoveTimeForwardUs(int deltaTimeUs) {
|
||||||
|
if (printTriggerDebug || printFuelDebug) {
|
||||||
|
printf("smartMoveTimeForwardUs %.1fms\r\n", deltaTimeUs / 1000.0);
|
||||||
|
}
|
||||||
|
int targetTime = timeNowUs + deltaTimeUs;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
scheduling_s* nextScheduledEvent = engine.executor.getHead();
|
||||||
|
if (nextScheduledEvent == nullptr) {
|
||||||
|
// nothing pending - we are done here
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int nextEventTime = nextScheduledEvent->momentX;
|
||||||
|
if (nextEventTime > targetTime) {
|
||||||
|
// next event is too far in the future
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeNowUs = nextEventTime;
|
||||||
|
engine.executor.executeAll(timeNowUs);
|
||||||
|
}
|
||||||
|
|
||||||
|
timeNowUs = targetTime;
|
||||||
|
}
|
||||||
|
|
||||||
efitimeus_t EngineTestHelper::getTimeNowUs(void) {
|
efitimeus_t EngineTestHelper::getTimeNowUs(void) {
|
||||||
return timeNowUs;
|
return timeNowUs;
|
||||||
}
|
}
|
||||||
|
@ -208,9 +253,9 @@ static AngleBasedEvent * getElementAtIndexForUnitText(int index, Engine *engine)
|
||||||
index--;
|
index--;
|
||||||
}
|
}
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "getForUnitText: null");
|
firmwareError(OBD_PCM_Processor_Fault, "getElementAtIndexForUnitText: null");
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
AngleBasedEvent * EngineTestHelper::assertTriggerEvent(const char *msg,
|
AngleBasedEvent * EngineTestHelper::assertTriggerEvent(const char *msg,
|
||||||
|
|
|
@ -36,8 +36,22 @@ public:
|
||||||
|
|
||||||
void applyTriggerWaveform();
|
void applyTriggerWaveform();
|
||||||
void setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
/**
|
||||||
|
* DEPRECATED these methods do not execute events on the queue
|
||||||
|
*/
|
||||||
void fireRise(float delayMs);
|
void fireRise(float delayMs);
|
||||||
void fireFall(float delayMs);
|
void fireFall(float delayMs);
|
||||||
|
void moveTimeForwardUs(int deltaTimeUs);
|
||||||
|
void fireTriggerEvents2(int count, float delayMs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* these methods execute events while moving time forward
|
||||||
|
* todo: better naming convention?
|
||||||
|
*/
|
||||||
|
void smartFireRise(float delayMs);
|
||||||
|
void smartFireFall(float delayMs);
|
||||||
|
void smartMoveTimeForwardUs(int deltaTimeUs);
|
||||||
|
void smartFireTriggerEvents2(int count, float delayMs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See also #fireRise() which would also move time forward
|
* See also #fireRise() which would also move time forward
|
||||||
|
@ -49,7 +63,6 @@ public:
|
||||||
void firePrimaryTriggerFall();
|
void firePrimaryTriggerFall();
|
||||||
void fireTriggerEvents(int count);
|
void fireTriggerEvents(int count);
|
||||||
void fireTriggerEventsWithDuration(float delayMs);
|
void fireTriggerEventsWithDuration(float delayMs);
|
||||||
void fireTriggerEvents2(int count, float delayMs);
|
|
||||||
void clearQueue();
|
void clearQueue();
|
||||||
|
|
||||||
scheduling_s * assertEvent5(const char *msg, int index, void *callback, efitime_t expectedTimestamp);
|
scheduling_s * assertEvent5(const char *msg, int index, void *callback, efitime_t expectedTimestamp);
|
||||||
|
@ -65,7 +78,6 @@ public:
|
||||||
|
|
||||||
int executeActions();
|
int executeActions();
|
||||||
void moveTimeForwardMs(float deltaTimeMs);
|
void moveTimeForwardMs(float deltaTimeMs);
|
||||||
void moveTimeForwardUs(int deltaTimeUs);
|
|
||||||
efitimeus_t getTimeNowUs(void);
|
efitimeus_t getTimeNowUs(void);
|
||||||
|
|
||||||
void writeEvents(const char *fileName);
|
void writeEvents(const char *fileName);
|
||||||
|
|
|
@ -35,6 +35,10 @@ int TestExecutor::size() {
|
||||||
return schedulingQueue.size();
|
return schedulingQueue.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scheduling_s* TestExecutor::getHead() {
|
||||||
|
return schedulingQueue.getHead();
|
||||||
|
}
|
||||||
|
|
||||||
scheduling_s* TestExecutor::getForUnitTest(int index) {
|
scheduling_s* TestExecutor::getForUnitTest(int index) {
|
||||||
return schedulingQueue.getElementAtIndexForUnitText(index);
|
return schedulingQueue.getElementAtIndexForUnitText(index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,8 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
int executeAll(efitime_t now);
|
int executeAll(efitime_t now);
|
||||||
int size();
|
int size();
|
||||||
scheduling_s* getForUnitTest(int index);
|
scheduling_s * getHead();
|
||||||
|
scheduling_s * getForUnitTest(int index);
|
||||||
|
|
||||||
void setMockExecutor(ExecutorInterface* exec);
|
void setMockExecutor(ExecutorInterface* exec);
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define MAX_STRING_SIZE 40
|
#define MAX_STRING_SIZE 40
|
||||||
|
|
||||||
static char channelNames[][MAX_STRING_SIZE] = { "Primary", "Secondary", "Trg",
|
static char channelNames[][MAX_STRING_SIZE] = { "Primary", "Secondary", "TDC",
|
||||||
"Sync", "Coil", "Injector", "Channel 6", "Channel 7" };
|
"Sync", "Coil", "Injector", "Channel 6", "Channel 7" };
|
||||||
|
|
||||||
static int CHANNEL_FLAGS[] = { 0x13458b, 0x0000ff, 0x00a0f9, 0x00ffff, 0x00ff00,
|
static int CHANNEL_FLAGS[] = { 0x13458b, 0x0000ff, 0x00a0f9, 0x00ffff, 0x00ff00,
|
||||||
|
@ -378,7 +378,7 @@ static int getChannelState(int ch, CompositeEvent *event) {
|
||||||
case 1:
|
case 1:
|
||||||
return event->secondaryTrigger;
|
return event->secondaryTrigger;
|
||||||
case 2:
|
case 2:
|
||||||
return event->trg;
|
return event->isTDC;
|
||||||
case 3:
|
case 3:
|
||||||
return event->sync;
|
return event->sync;
|
||||||
case 4:
|
case 4:
|
||||||
|
|
|
@ -11,7 +11,7 @@ struct CompositeEvent {
|
||||||
int timestamp;
|
int timestamp;
|
||||||
bool primaryTrigger;
|
bool primaryTrigger;
|
||||||
bool secondaryTrigger;
|
bool secondaryTrigger;
|
||||||
bool trg;
|
bool isTDC;
|
||||||
bool sync;
|
bool sync;
|
||||||
bool coil;
|
bool coil;
|
||||||
bool injector;
|
bool injector;
|
||||||
|
|
|
@ -8,13 +8,12 @@
|
||||||
|
|
||||||
static CompositeEvent events[100];
|
static CompositeEvent events[100];
|
||||||
|
|
||||||
|
static void setEvent(CompositeEvent *events, int index,
|
||||||
void setEvent(CompositeEvent *events, int index,
|
int timestamp, bool primaryTrigger, bool secondaryTrigger, bool isTDC, bool sync, bool coil, bool injector) {
|
||||||
int timestamp, bool primaryTrigger, bool secondaryTrigger, bool trg, bool sync, bool coil, bool injector) {
|
|
||||||
events[index].timestamp = timestamp;
|
events[index].timestamp = timestamp;
|
||||||
events[index].primaryTrigger = primaryTrigger;
|
events[index].primaryTrigger = primaryTrigger;
|
||||||
events[index].secondaryTrigger = secondaryTrigger;
|
events[index].secondaryTrigger = secondaryTrigger;
|
||||||
events[index].trg = trg;
|
events[index].isTDC = isTDC;
|
||||||
events[index].sync = sync;
|
events[index].sync = sync;
|
||||||
events[index].coil = coil;
|
events[index].coil = coil;
|
||||||
events[index].injector = injector;
|
events[index].injector = injector;
|
||||||
|
@ -23,7 +22,6 @@ void setEvent(CompositeEvent *events, int index,
|
||||||
void runLogicdataSandbox() {
|
void runLogicdataSandbox() {
|
||||||
printf(".logicdata Sandbox 20200719\n");
|
printf(".logicdata Sandbox 20200719\n");
|
||||||
|
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
setEvent(events, index++, 10, false, false, false, false, false, false);
|
setEvent(events, index++, 10, false, false, false, false, false, false);
|
||||||
setEvent(events, index++, 20, true, false, true, false, false, false);
|
setEvent(events, index++, 20, true, false, true, false, false, false);
|
||||||
|
|
|
@ -105,5 +105,8 @@ TEST(fuelControl, transitionIssue1592) {
|
||||||
// !!!!!!!!! BUG !!!!!!!!!!!!!!!
|
// !!!!!!!!! BUG !!!!!!!!!!!!!!!
|
||||||
|
|
||||||
EXPECT_EQ(enginePins.injectors[3].getOverlappingCounter(), 0);
|
EXPECT_EQ(enginePins.injectors[3].getOverlappingCounter(), 0);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
eth.writeEvents("fuel_schedule_transition_issue_1592.logicdata");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue