only: refactoring: InjectionEvent knows it's index
This commit is contained in:
parent
c16581c316
commit
0a301a08d5
|
@ -127,15 +127,6 @@ bool InjectionEvent::updateInjectionAngle() {
|
|||
/**
|
||||
* @returns false in case of error, true if success
|
||||
*/
|
||||
bool FuelSchedule::addFuelEventsForCylinder(int i) {
|
||||
InjectionEvent *ev = &elements[i];
|
||||
#if EFU_UNIT_TEST
|
||||
if (ev->ownIndex != i)
|
||||
throw std::logic_error("index issue");
|
||||
#endif
|
||||
return ev->update();
|
||||
}
|
||||
|
||||
bool InjectionEvent::update() {
|
||||
bool updatedAngle = updateInjectionAngle();
|
||||
|
||||
|
@ -192,7 +183,7 @@ bool InjectionEvent::update() {
|
|||
|
||||
void FuelSchedule::addFuelEvents() {
|
||||
for (size_t cylinderIndex = 0; cylinderIndex < engineConfiguration->cylindersCount; cylinderIndex++) {
|
||||
bool result = addFuelEventsForCylinder(cylinderIndex);
|
||||
bool result = elements[cylinderIndex].update();
|
||||
|
||||
if (!result) {
|
||||
invalidate();
|
||||
|
|
|
@ -85,7 +85,6 @@ public:
|
|||
* Calculate injector opening angle, pins, and mode for all injectors
|
||||
*/
|
||||
void addFuelEvents();
|
||||
bool addFuelEventsForCylinder(int cylinderIndex);
|
||||
|
||||
void resetOverlapping();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
void endSimultaneousInjection(InjectionEvent *event) {
|
||||
event->isScheduled = false;
|
||||
endSimultaneousInjectionOnlyTogglePins();
|
||||
getFuelSchedule()->addFuelEventsForCylinder(event->ownIndex);
|
||||
event->update();
|
||||
}
|
||||
|
||||
void turnInjectionPinLow(InjectionEvent *event) {
|
||||
|
@ -63,7 +63,7 @@ void turnInjectionPinLow(InjectionEvent *event) {
|
|||
output->close(nowNt);
|
||||
}
|
||||
}
|
||||
getFuelSchedule()->addFuelEventsForCylinder(event->ownIndex);
|
||||
event->update();
|
||||
}
|
||||
|
||||
void InjectionEvent::onTriggerTooth(int rpm, efitick_t nowNt, float currentPhase, float nextPhase) {
|
||||
|
@ -183,7 +183,7 @@ void InjectionEvent::onTriggerTooth(int rpm, efitick_t nowNt, float currentPhase
|
|||
|
||||
static void handleFuel(int rpm, efitick_t nowNt, float currentPhase, float nextPhase) {
|
||||
ScopePerf perf(PE::HandleFuel);
|
||||
|
||||
|
||||
efiAssertVoid(ObdCode::CUSTOM_STACK_6627, hasLotsOfRemainingStack(), "lowstck#3");
|
||||
|
||||
LimpState limitedFuelState = getLimpManager()->allowInjection();
|
||||
|
@ -244,7 +244,7 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (trgEventIndex == 0) {
|
||||
|
||||
if (getTriggerCentral()->checkIfTriggerConfigChanged()) {
|
||||
|
|
Loading…
Reference in New Issue