refactoring: better field name
This commit is contained in:
parent
ad9950a8d8
commit
46e1ff671a
|
@ -212,7 +212,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
|
|||
assertAngleRange(angle, "findAngle#a33", CUSTOM_ERR_6544);
|
||||
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
||||
#if EFI_UNIT_TEST
|
||||
printf("registerInjectionEvent angle=%.2f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, injectorIndex);
|
||||
printf("registerInjectionEvent angle=%.2f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.triggerEventIndex, injectorIndex);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ void TriggerShape::findTriggerPosition(event_trigger_position_s *position,
|
|||
return;
|
||||
}
|
||||
|
||||
position->eventIndex = triggerEventIndex;
|
||||
position->triggerEventIndex = triggerEventIndex;
|
||||
position->eventAngle = triggerEventAngle;
|
||||
position->angleOffset = angle - triggerEventAngle;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
/**
|
||||
* That's trigger event index
|
||||
*/
|
||||
uint32_t eventIndex = 0;
|
||||
uint32_t triggerEventIndex = 0;
|
||||
angle_t eventAngle = 0;
|
||||
/**
|
||||
* Angle offset from the trigger event
|
||||
|
|
|
@ -406,7 +406,7 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
|
|||
|
||||
for (int injEventIndex = 0; injEventIndex < CONFIG(specs.cylindersCount); injEventIndex++) {
|
||||
InjectionEvent *event = &fs->elements[injEventIndex];
|
||||
uint32_t eventIndex = event->injectionStart.eventIndex;
|
||||
uint32_t eventIndex = event->injectionStart.triggerEventIndex;
|
||||
// right after trigger change we are still using old & invalid fuel schedule. good news is we do not change trigger on the fly in real life
|
||||
// efiAssertVoid(CUSTOM_ERR_ASSERT_VOID, eventIndex < ENGINE(triggerShape.getLength()), "handleFuel/event sch index");
|
||||
if (eventIndex != trgEventIndex) {
|
||||
|
|
|
@ -115,7 +115,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngle, floatms_t sparkD
|
|||
TRIGGER_SHAPE(findTriggerPosition(&event->dwellPosition, a PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
||||
|
||||
#if FUEL_MATH_EXTREME_LOGGING
|
||||
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex);
|
||||
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.triggerEventIndex);
|
||||
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
}
|
||||
|
@ -273,8 +273,8 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
|
||||
#if EFI_UNIT_TEST
|
||||
if (verboseMode) {
|
||||
printf("spark dwell@ %d/%d spark@ %d/%d id=%d\r\n", iEvent->dwellPosition.eventIndex, (int)iEvent->dwellPosition.angleOffset,
|
||||
iEvent->sparkPosition.eventIndex, (int)iEvent->sparkPosition.angleOffset,
|
||||
printf("spark dwell@ %d/%d spark@ %d/%d id=%d\r\n", iEvent->dwellPosition.triggerEventIndex, (int)iEvent->dwellPosition.angleOffset,
|
||||
iEvent->sparkPosition.triggerEventIndex, (int)iEvent->sparkPosition.angleOffset,
|
||||
iEvent->sparkId);
|
||||
}
|
||||
#endif
|
||||
|
@ -292,7 +292,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
* time-based schedule. This case we would be firing events with best possible angle precision.
|
||||
*
|
||||
*/
|
||||
if (iEvent->sparkPosition.eventIndex == trgEventIndex) {
|
||||
if (iEvent->sparkPosition.triggerEventIndex == trgEventIndex) {
|
||||
/**
|
||||
* Spark should be fired before the next trigger event - time-based delay is best precision possible
|
||||
*/
|
||||
|
@ -305,7 +305,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &fireSparkAndPrepareNextSchedule, iEvent);
|
||||
} else {
|
||||
#if SPARK_EXTREME_LOGGING
|
||||
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex);
|
||||
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.triggerEventIndex);
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
/**
|
||||
* Spark should be scheduled in relation to some future trigger event, this way we get better firing precision
|
||||
|
@ -381,7 +381,7 @@ static void scheduleAllSparkEventsUntilNextTriggerTooth(uint32_t trgEventIndex D
|
|||
|
||||
LL_FOREACH_SAFE(ENGINE(iHead), current, tmp)
|
||||
{
|
||||
if (current->sparkPosition.eventIndex == trgEventIndex) {
|
||||
if (current->sparkPosition.triggerEventIndex == trgEventIndex) {
|
||||
// time to fire a spark which was scheduled previously
|
||||
LL_DELETE(ENGINE(iHead), current);
|
||||
|
||||
|
@ -422,7 +422,7 @@ void onTriggerEventSparkLogic(bool limitedSpark, uint32_t trgEventIndex, int rpm
|
|||
if (ENGINE(ignitionEvents.isReady)) {
|
||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||
IgnitionEvent *event = &ENGINE(ignitionEvents.elements[i]);
|
||||
if (event->dwellPosition.eventIndex != trgEventIndex)
|
||||
if (event->dwellPosition.triggerEventIndex != trgEventIndex)
|
||||
continue;
|
||||
handleSparkEvent(limitedSpark, trgEventIndex, event, rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
|
|
@ -182,32 +182,32 @@ TEST(misc, testAngleResolver) {
|
|||
|
||||
printf("*************************************************** testAngleResolver 0\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -122, engineConfiguration->globalTriggerAngleOffset));
|
||||
ASSERT_EQ( 2, injectionStart.eventIndex) << "eventIndex@0";
|
||||
ASSERT_EQ( 2, injectionStart.triggerEventIndex) << "eventIndex@0";
|
||||
ASSERT_NEAR(0.24, injectionStart.angleOffset, EPS5D);
|
||||
|
||||
printf("*************************************************** testAngleResolver 0.1\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -80, engineConfiguration->globalTriggerAngleOffset));
|
||||
ASSERT_EQ( 2, injectionStart.eventIndex) << "eventIndex@0";
|
||||
ASSERT_EQ( 2, injectionStart.triggerEventIndex) << "eventIndex@0";
|
||||
ASSERT_FLOAT_EQ(42.24, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 0.2\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -54, engineConfiguration->globalTriggerAngleOffset));
|
||||
ASSERT_EQ( 2, injectionStart.eventIndex) << "eventIndex@0";
|
||||
ASSERT_EQ( 2, injectionStart.triggerEventIndex) << "eventIndex@0";
|
||||
ASSERT_FLOAT_EQ(68.2400, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 0.3\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -53, engineConfiguration->globalTriggerAngleOffset));
|
||||
ASSERT_EQ(2, injectionStart.eventIndex);
|
||||
ASSERT_EQ(2, injectionStart.triggerEventIndex);
|
||||
ASSERT_FLOAT_EQ(69.24, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 1\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, 0, engineConfiguration->globalTriggerAngleOffset));
|
||||
ASSERT_EQ(2, injectionStart.eventIndex);
|
||||
ASSERT_EQ(2, injectionStart.triggerEventIndex);
|
||||
ASSERT_FLOAT_EQ(122.24, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 2\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, 56, engineConfiguration->globalTriggerAngleOffset));
|
||||
ASSERT_EQ(2, injectionStart.eventIndex);
|
||||
ASSERT_EQ(2, injectionStart.triggerEventIndex);
|
||||
ASSERT_FLOAT_EQ(178.24, injectionStart.angleOffset);
|
||||
|
||||
TriggerShape t;
|
||||
|
|
|
@ -103,7 +103,7 @@ static void testDodgeNeonDecoder(void) {
|
|||
}
|
||||
|
||||
static void assertTriggerPosition(event_trigger_position_s *position, int eventIndex, float angleOffset) {
|
||||
assertEqualsM("eventIndex", eventIndex, position->eventIndex);
|
||||
assertEqualsM("eventIndex", eventIndex, position->triggerEventIndex);
|
||||
assertEqualsM("angleOffset", angleOffset, position->angleOffset);
|
||||
}
|
||||
|
||||
|
@ -176,10 +176,10 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
|
|||
|
||||
IgnitionEventList *ecl = &engine->ignitionEvents;
|
||||
ASSERT_EQ( 1, ecl->isReady) << "ford inline ignition events size";
|
||||
ASSERT_EQ( 0, ecl->elements[0].dwellPosition.eventIndex) << "event index";
|
||||
ASSERT_EQ( 0, ecl->elements[0].dwellPosition.triggerEventIndex) << "event index";
|
||||
ASSERT_NEAR(7.8621, ecl->elements[0].dwellPosition.angleOffset, EPS4D) << "angle offset#1";
|
||||
|
||||
ASSERT_EQ( 10, ecl->elements[5].dwellPosition.eventIndex) << "event index";
|
||||
ASSERT_EQ( 10, ecl->elements[5].dwellPosition.triggerEventIndex) << "event index";
|
||||
ASSERT_NEAR(7.8621, ecl->elements[5].dwellPosition.angleOffset, EPS4D) << "angle offset#2";
|
||||
|
||||
|
||||
|
@ -554,7 +554,7 @@ extern fuel_Map3D_t fuelMap;
|
|||
|
||||
static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset, bool isOverlapping) {
|
||||
assertEqualsM4(msg, "inj index", injectorIndex, ev->outputs[0]->injectorIndex);
|
||||
assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.eventIndex);
|
||||
assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.triggerEventIndex);
|
||||
assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffset);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue