mirror of https://github.com/FOME-Tech/fome-fw.git
fear he who sees dead code: 'overlappingScheduleOffTime' was never assigned so the whole logic around it is dead
This commit is contained in:
parent
78eb92bbbf
commit
8f27c8f8ed
|
@ -137,21 +137,6 @@ static inline void turnInjectionPinLow(InjectorOutputPin *output) {
|
||||||
printf("turnInjectionPinLow %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs());
|
printf("turnInjectionPinLow %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
if (output->cancelNextTurningInjectorOff) {
|
|
||||||
/**
|
|
||||||
* in case of fuel schedule overlap between engine cycles,
|
|
||||||
* and if engine cycle is above say 75% for batch mode on 4 cylinders,
|
|
||||||
* we will get a secondary overlap between the special injection and a normal injection on the same injector.
|
|
||||||
* In such a case want to combine these two injection into one continues injection.
|
|
||||||
* Unneeded turn of injector on is handle while scheduling that second injection, but cancellation
|
|
||||||
* of special injection end has to be taken care of dynamically
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
output->cancelNextTurningInjectorOff = false;
|
|
||||||
#if EFI_SIMULATOR
|
|
||||||
printf("was cancelled %s %d\r\n", output->name, (int)getTimeNowUs());
|
|
||||||
#endif /* EFI_SIMULATOR */
|
|
||||||
} else {
|
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
const char * w = output->currentLogicValue == false ? "err" : "";
|
const char * w = output->currentLogicValue == false ? "err" : "";
|
||||||
|
@ -168,7 +153,7 @@ static inline void turnInjectionPinLow(InjectorOutputPin *output) {
|
||||||
} else {
|
} else {
|
||||||
output->setLow();
|
output->setLow();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnInjectionPinLow(InjectionEvent *event) {
|
void turnInjectionPinLow(InjectionEvent *event) {
|
||||||
|
@ -315,16 +300,8 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
||||||
|
|
||||||
event->isScheduled = true;
|
event->isScheduled = true;
|
||||||
efitimeus_t turnOnTime = nowUs + (int) injectionStartDelayUs;
|
efitimeus_t turnOnTime = nowUs + (int) injectionStartDelayUs;
|
||||||
bool isSecondaryOverlapping = turnOnTime < output->overlappingScheduleOffTime;
|
|
||||||
|
|
||||||
if (isSecondaryOverlapping) {
|
|
||||||
output->cancelNextTurningInjectorOff = true;
|
|
||||||
#if EFI_UNIT_TEST || EFI_SIMULATOR
|
|
||||||
printf("please cancel %s %d %d\r\n", output->name, (int)getTimeNowUs(), output->overlappingCounter);
|
|
||||||
#endif /* EFI_UNIT_TEST || EFI_SIMULATOR */
|
|
||||||
} else {
|
|
||||||
sescheduleByTimestamp(sUp, turnOnTime, { &turnInjectionPinHigh, event } PASS_ENGINE_PARAMETER_SUFFIX);
|
sescheduleByTimestamp(sUp, turnOnTime, { &turnInjectionPinHigh, event } PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
|
||||||
efitimeus_t turnOffTime = nowUs + (int) (injectionStartDelayUs + durationUs);
|
efitimeus_t turnOffTime = nowUs + (int) (injectionStartDelayUs + durationUs);
|
||||||
sescheduleByTimestamp(sDown, turnOffTime, { &turnInjectionPinLow, event } PASS_ENGINE_PARAMETER_SUFFIX);
|
sescheduleByTimestamp(sDown, turnOffTime, { &turnInjectionPinLow, event } PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,8 +273,6 @@ bool NamedOutputPin::stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InjectorOutputPin::reset() {
|
void InjectorOutputPin::reset() {
|
||||||
overlappingScheduleOffTime = 0;
|
|
||||||
cancelNextTurningInjectorOff = false;
|
|
||||||
overlappingCounter = 0;
|
overlappingCounter = 0;
|
||||||
// todo: this could be refactored by calling some super-reset method
|
// todo: this could be refactored by calling some super-reset method
|
||||||
currentLogicValue = INITIAL_PIN_STATE;
|
currentLogicValue = INITIAL_PIN_STATE;
|
||||||
|
|
|
@ -97,10 +97,8 @@ class InjectorOutputPin : public NamedOutputPin {
|
||||||
public:
|
public:
|
||||||
InjectorOutputPin();
|
InjectorOutputPin();
|
||||||
void reset();
|
void reset();
|
||||||
efitimeus_t overlappingScheduleOffTime;
|
|
||||||
// todo: re-implement this injectorIndex via address manipulation to reduce memory usage?
|
// todo: re-implement this injectorIndex via address manipulation to reduce memory usage?
|
||||||
int8_t injectorIndex;
|
int8_t injectorIndex;
|
||||||
bool cancelNextTurningInjectorOff;
|
|
||||||
int8_t overlappingCounter;
|
int8_t overlappingCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue