something is over-complicated here? looks like two classes should become one?
This commit is contained in:
parent
fbbf8995e4
commit
a65c8c9295
|
@ -53,8 +53,6 @@ public:
|
||||||
void setConfig(persistent_config_s *config);
|
void setConfig(persistent_config_s *config);
|
||||||
injection_mode_e getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
injection_mode_e getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
InjectionSignalPair fuelActuators[INJECTION_PIN_COUNT];
|
|
||||||
IgnitionEventList ignitionEvents;
|
|
||||||
LocalVersionHolder versionForConfigurationListeners;
|
LocalVersionHolder versionForConfigurationListeners;
|
||||||
LocalVersionHolder auxParametersVersion;
|
LocalVersionHolder auxParametersVersion;
|
||||||
operation_mode_e getOperationMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
operation_mode_e getOperationMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
@ -93,6 +91,7 @@ public:
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL
|
#if EFI_ENGINE_CONTROL
|
||||||
FuelSchedule injectionEvents;
|
FuelSchedule injectionEvents;
|
||||||
|
IgnitionEventList ignitionEvents;
|
||||||
#endif /* EFI_ENGINE_CONTROL */
|
#endif /* EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
WallFuel wallFuel;
|
WallFuel wallFuel;
|
||||||
|
|
|
@ -13,10 +13,32 @@
|
||||||
#include "trigger_structure.h"
|
#include "trigger_structure.h"
|
||||||
|
|
||||||
#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT
|
#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT
|
||||||
|
#define MAX_WIRES_COUNT 2
|
||||||
|
|
||||||
class Engine;
|
class Engine;
|
||||||
|
|
||||||
|
class InjectionEvent;
|
||||||
|
|
||||||
|
class InjectionSignalPair {
|
||||||
|
public:
|
||||||
|
InjectionSignalPair();
|
||||||
|
scheduling_s signalTimerUp;
|
||||||
|
scheduling_s endOfInjectionEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* we need atomic flag so that we do not schedule a new pair of up/down before previous down was executed.
|
||||||
|
*
|
||||||
|
* That's because we want to be sure that no 'down' side callback would be ignored since we are counting to see
|
||||||
|
* overlaps so we need the end counter to always have zero.
|
||||||
|
* TODO: make watchdog decrement relevant counter
|
||||||
|
*/
|
||||||
|
bool isScheduled;
|
||||||
|
|
||||||
|
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
||||||
|
|
||||||
|
InjectionEvent *event;
|
||||||
|
};
|
||||||
|
|
||||||
class InjectionEvent {
|
class InjectionEvent {
|
||||||
public:
|
public:
|
||||||
InjectionEvent();
|
InjectionEvent();
|
||||||
|
@ -31,8 +53,11 @@ public:
|
||||||
Engine *engine;
|
Engine *engine;
|
||||||
#endif
|
#endif
|
||||||
event_trigger_position_s injectionStart;
|
event_trigger_position_s injectionStart;
|
||||||
|
|
||||||
|
InjectionSignalPair pair;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class knows about when to inject fuel
|
* This class knows about when to inject fuel
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -832,6 +832,6 @@ int getRusEfiVersion(void) {
|
||||||
if (initBootloader() != 0)
|
if (initBootloader() != 0)
|
||||||
return 123;
|
return 123;
|
||||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||||
return 20191006;
|
return 20191007;
|
||||||
}
|
}
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIGNAL_EXECUTOR_H_
|
#pragma once
|
||||||
#define SIGNAL_EXECUTOR_H_
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
|
@ -17,28 +16,4 @@
|
||||||
#include "signal_executor_sleep.h"
|
#include "signal_executor_sleep.h"
|
||||||
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
||||||
|
|
||||||
#define MAX_WIRES_COUNT 2
|
|
||||||
|
|
||||||
class InjectionEvent;
|
|
||||||
|
|
||||||
class InjectionSignalPair {
|
|
||||||
public:
|
|
||||||
InjectionSignalPair();
|
|
||||||
scheduling_s signalTimerUp;
|
|
||||||
scheduling_s endOfInjectionEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* we need atomic flag so that we do not schedule a new pair of up/down before previous down was executed.
|
|
||||||
*
|
|
||||||
* That's because we want to be sure that no 'down' side callback would be ignored since we are counting to see
|
|
||||||
* overlaps so we need the end counter to always have zero.
|
|
||||||
* TODO: make watchdog decrement relevant counter
|
|
||||||
*/
|
|
||||||
bool isScheduled;
|
|
||||||
|
|
||||||
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
|
||||||
|
|
||||||
InjectionEvent *event;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SIGNAL_EXECUTOR_H_ */
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
||||||
getRevolutionCounter());
|
getRevolutionCounter());
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
|
|
||||||
InjectionSignalPair *pair = &ENGINE(fuelActuators[injEventIndex]);
|
InjectionSignalPair *pair = &event->pair;
|
||||||
|
|
||||||
if (event->isSimultanious) {
|
if (event->isSimultanious) {
|
||||||
/**
|
/**
|
||||||
|
@ -582,7 +582,7 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
primeInjEvent.ownIndex = 0;
|
primeInjEvent.ownIndex = 0;
|
||||||
primeInjEvent.isSimultanious = true;
|
primeInjEvent.isSimultanious = true;
|
||||||
|
|
||||||
scheduling_s *sDown = &ENGINE(fuelActuators[0]).endOfInjectionEvent;
|
scheduling_s *sDown = &ENGINE(injectionEvents.elements[0].pair).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).
|
||||||
// If 'primeInjFalloffTemperature' is not specified (by default), we have a prime pulse deactivation at zero celsius degrees, which is okay.
|
// If 'primeInjFalloffTemperature' is not specified (by default), we have a prime pulse deactivation at zero celsius degrees, which is okay.
|
||||||
const float maxPrimeInjAtTemperature = -40.0f; // at this temperature the pulse is maximal.
|
const float maxPrimeInjAtTemperature = -40.0f; // at this temperature the pulse is maximal.
|
||||||
|
|
|
@ -152,12 +152,12 @@ void EngineTestHelper::fireTriggerEvents(int count) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineTestHelper::assertInjectorUpEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex) {
|
void EngineTestHelper::assertInjectorUpEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex) {
|
||||||
InjectionSignalPair *pair = &engine.fuelActuators[injectorIndex];
|
InjectionSignalPair *pair = &engine.injectionEvents.elements[injectorIndex].pair;
|
||||||
assertEvent(msg, eventIndex, (void*)seTurnPinHigh, momentX, (long)pair);
|
assertEvent(msg, eventIndex, (void*)seTurnPinHigh, momentX, (long)pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineTestHelper::assertInjectorDownEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex) {
|
void EngineTestHelper::assertInjectorDownEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex) {
|
||||||
InjectionSignalPair *pair = &engine.fuelActuators[injectorIndex];
|
InjectionSignalPair *pair = &engine.injectionEvents.elements[injectorIndex].pair;
|
||||||
assertEvent(msg, eventIndex, (void*)seTurnPinLow, momentX, (long)pair);
|
assertEvent(msg, eventIndex, (void*)seTurnPinLow, momentX, (long)pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue