global static not good, there shall be only one god object /s
This commit is contained in:
parent
74c5a80cac
commit
a57d7c48fb
|
@ -87,6 +87,10 @@ public:
|
||||||
bool isPwmEnabled = true;
|
bool isPwmEnabled = true;
|
||||||
int triggerActivitySecond = 0;
|
int triggerActivitySecond = 0;
|
||||||
|
|
||||||
|
const char *prevOutputName = nullptr;
|
||||||
|
|
||||||
|
InjectionEvent primeInjEvent;
|
||||||
|
|
||||||
IEtbController *etbControllers[ETB_COUNT] = {nullptr};
|
IEtbController *etbControllers[ETB_COUNT] = {nullptr};
|
||||||
IFuelComputer *fuelComputer = nullptr;
|
IFuelComputer *fuelComputer = nullptr;
|
||||||
IInjectorModel *injectorModel = nullptr;
|
IInjectorModel *injectorModel = nullptr;
|
||||||
|
|
|
@ -61,10 +61,6 @@
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
static const char *prevOutputName = nullptr;
|
|
||||||
|
|
||||||
static InjectionEvent primeInjEvent;
|
|
||||||
|
|
||||||
// todo: figure out if this even helps?
|
// todo: figure out if this even helps?
|
||||||
//#if defined __GNUC__
|
//#if defined __GNUC__
|
||||||
//#define RAM_METHOD_PREFIX __attribute__((section(".ram")))
|
//#define RAM_METHOD_PREFIX __attribute__((section(".ram")))
|
||||||
|
@ -259,12 +255,12 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now
|
||||||
// we are ignoring low RPM in order not to handle "engine was stopped to engine now running" transition
|
// we are ignoring low RPM in order not to handle "engine was stopped to engine now running" transition
|
||||||
if (rpm > 2 * engineConfiguration->cranking.rpm) {
|
if (rpm > 2 * engineConfiguration->cranking.rpm) {
|
||||||
const char *outputName = outputs[0]->name;
|
const char *outputName = outputs[0]->name;
|
||||||
if (prevOutputName == outputName
|
if (engine->prevOutputName == outputName
|
||||||
&& engineConfiguration->injectionMode != IM_SIMULTANEOUS
|
&& engineConfiguration->injectionMode != IM_SIMULTANEOUS
|
||||||
&& engineConfiguration->injectionMode != IM_SINGLE_POINT) {
|
&& engineConfiguration->injectionMode != IM_SINGLE_POINT) {
|
||||||
warning(CUSTOM_OBD_SKIPPED_FUEL, "looks like skipped fuel event revCounter=%d %s", getRevolutionCounter(), outputName);
|
warning(CUSTOM_OBD_SKIPPED_FUEL, "looks like skipped fuel event revCounter=%d %s", getRevolutionCounter(), outputName);
|
||||||
}
|
}
|
||||||
prevOutputName = outputName;
|
engine->prevOutputName = outputName;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PRINTF_FUEL_DETAILS
|
#if EFI_PRINTF_FUEL_DETAILS
|
||||||
|
@ -481,7 +477,7 @@ static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
* See testStartOfCrankingPrimingPulse()
|
* See testStartOfCrankingPrimingPulse()
|
||||||
*/
|
*/
|
||||||
void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
INJECT_ENGINE_REFERENCE(&primeInjEvent);
|
INJECT_ENGINE_REFERENCE(&engine->primeInjEvent);
|
||||||
|
|
||||||
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.
|
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.
|
||||||
// So we check and update the ignition switch counter in non-volatile backup-RAM
|
// So we check and update the ignition switch counter in non-volatile backup-RAM
|
||||||
|
@ -500,8 +496,8 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
ignSwitchCounter = -1;
|
ignSwitchCounter = -1;
|
||||||
// start prime injection if this is a 'fresh start'
|
// start prime injection if this is a 'fresh start'
|
||||||
if (ignSwitchCounter == 0) {
|
if (ignSwitchCounter == 0) {
|
||||||
primeInjEvent.ownIndex = 0;
|
engine->primeInjEvent.ownIndex = 0;
|
||||||
primeInjEvent.isSimultanious = true;
|
engine->primeInjEvent.isSimultanious = true;
|
||||||
|
|
||||||
scheduling_s *sDown = &ENGINE(injectionEvents.elements[0]).endOfInjectionEvent;
|
scheduling_s *sDown = &ENGINE(injectionEvents.elements[0]).endOfInjectionEvent;
|
||||||
// When the engine is hot, basically we don't need prime inj.pulse, so we use an interpolation over temperature (falloff).
|
// When the engine is hot, basically we don't need prime inj.pulse, so we use an interpolation over temperature (falloff).
|
||||||
|
|
|
@ -54,7 +54,7 @@ TEST(cranking, realCrankingFromFile) {
|
||||||
}
|
}
|
||||||
trigger_event_e event = (newState[index] ? riseEvents : fallEvents)[index];
|
trigger_event_e event = (newState[index] ? riseEvents : fallEvents)[index];
|
||||||
efitick_t nowNt = getTimeNowNt();
|
efitick_t nowNt = getTimeNowNt();
|
||||||
// engine->triggerCentral.handleShaftSignal(event, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
engine->triggerCentral.handleShaftSignal(event, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
currentState[index] = newState[index];
|
currentState[index] = newState[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, int channe
|
||||||
|
|
||||||
Engine *engine = ð->engine;
|
Engine *engine = ð->engine;
|
||||||
EXPAND_Engine;
|
EXPAND_Engine;
|
||||||
timeNowUs = 1000000 * timestampS;
|
timeNowUs = 1'000'000 * timestampS;
|
||||||
printf("MIATANA: posting time=%d event=%d\r\n", timeNowUs, event);
|
printf("MIATANA: posting time=%d event=%d\n", timeNowUs, event);
|
||||||
engine->triggerCentral.handleShaftSignal(event, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
engine->triggerCentral.handleShaftSignal(event, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue