auto-sync
This commit is contained in:
parent
001a1ffb4c
commit
bf901810a1
|
@ -43,7 +43,7 @@ float getBaseAdvance(int rpm, float engineLoad) {
|
|||
engineConfiguration->ignitionRpmBins);
|
||||
}
|
||||
|
||||
float getAdvance(int rpm, float engineLoad DECLATE_ENGINE_PARAMETER) {
|
||||
float getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) {
|
||||
float angle;
|
||||
if (isCrankingR(rpm)) {
|
||||
angle = -engineConfiguration->crankingTimingAngle;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "engine.h"
|
||||
|
||||
float getAdvance(int rpm, float engineLoad DECLATE_ENGINE_PARAMETER);
|
||||
float getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S);
|
||||
void prepareTimingMap(void);
|
||||
|
||||
#endif /* ADVANCE_H_ */
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#ifndef EC2_H_
|
||||
#define EC2_H_
|
||||
|
||||
#include "global.h"
|
||||
#include "engine_configuration.h"
|
||||
#include "event_registry.h"
|
||||
#include "trigger_structure.h"
|
||||
|
@ -23,9 +24,9 @@ public:
|
|||
ActuatorEventList events;
|
||||
|
||||
void addFuelEvents(trigger_shape_s *s,
|
||||
injection_mode_e mode DECLATE_ENGINE_PARAMETER);
|
||||
injection_mode_e mode DECLARE_ENGINE_PARAMETER_S);
|
||||
void registerInjectionEvent(trigger_shape_s *s,
|
||||
io_pin_e pin, float angle, bool_t isSimultanious DECLATE_ENGINE_PARAMETER);
|
||||
io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
uint8_t hasEvents[PWM_PHASE_MAX_COUNT];
|
||||
|
||||
|
@ -56,7 +57,7 @@ public:
|
|||
};
|
||||
|
||||
void initializeIgnitionActions(float advance, float dwellAngle,
|
||||
engine_configuration2_s *engineConfiguration2, IgnitionEventList *list DECLATE_ENGINE_PARAMETER);
|
||||
engine_configuration2_s *engineConfiguration2, IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
void setDefaultNonPersistentConfiguration(engine_configuration2_s *engineConfiguration2);
|
||||
void printConfiguration(engine_configuration_s *engineConfiguration, engine_configuration2_s *engineConfiguration2);
|
||||
|
|
|
@ -73,7 +73,7 @@ static int getNumberOfInjections(engine_configuration_s const *engineConfigurati
|
|||
/**
|
||||
* @returns Length of fuel injection, in milliseconds
|
||||
*/
|
||||
float getFuelMs(int rpm DECLATE_ENGINE_PARAMETER) {
|
||||
float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
float theoreticalInjectionLength;
|
||||
if (isCrankingR(rpm)) {
|
||||
theoreticalInjectionLength = getCrankingFuel(engine) / getNumberOfInjections(engineConfiguration, engineConfiguration->crankingInjectionMode);
|
||||
|
@ -86,7 +86,7 @@ float getFuelMs(int rpm DECLATE_ENGINE_PARAMETER) {
|
|||
return theoreticalInjectionLength + injectorLag;
|
||||
}
|
||||
|
||||
float getRunningFuel(float baseFuelMs, int rpm DECLATE_ENGINE_PARAMETER) {
|
||||
float getRunningFuel(float baseFuelMs, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
float iatCorrection = getIatCorrection(getIntakeAirTemperature(engine) PASS_ENGINE_PARAMETER);
|
||||
float cltCorrection = getCltCorrection(getCoolantTemperature(engine) PASS_ENGINE_PARAMETER);
|
||||
|
||||
|
@ -105,7 +105,7 @@ static Map3D1616 fuelMap;
|
|||
* @param vBatt Battery voltage.
|
||||
* @return Time in ms for injection opening time based on current battery voltage
|
||||
*/
|
||||
float getInjectorLag(float vBatt DECLATE_ENGINE_PARAMETER) {
|
||||
float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (cisnan(vBatt)) {
|
||||
warning(OBD_System_Voltage_Malfunction, "vBatt=%f", vBatt);
|
||||
return engineConfiguration->injectorLag;
|
||||
|
@ -127,13 +127,13 @@ void prepareFuelMap(engine_configuration_s *engineConfiguration) {
|
|||
/**
|
||||
* @brief Engine warm-up fuel correction.
|
||||
*/
|
||||
float getCltCorrection(float clt DECLATE_ENGINE_PARAMETER) {
|
||||
float getCltCorrection(float clt DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (cisnan(clt))
|
||||
return 1; // this error should be already reported somewhere else, let's just handle it
|
||||
return interpolate2d(clt, engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE);
|
||||
}
|
||||
|
||||
float getIatCorrection(float iat DECLATE_ENGINE_PARAMETER) {
|
||||
float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (cisnan(iat))
|
||||
return 1; // this error should be already reported somewhere else, let's just handle it
|
||||
return interpolate2d(iat, engineConfiguration->iatFuelCorrBins, engineConfiguration->iatFuelCorr, IAT_CURVE_SIZE);
|
||||
|
|
|
@ -14,12 +14,12 @@ void prepareFuelMap(engine_configuration_s *engineConfiguration);
|
|||
|
||||
float getBaseFuel(Engine *engine, int rpm);
|
||||
float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
|
||||
float getIatCorrection(float iat DECLATE_ENGINE_PARAMETER);
|
||||
float getInjectorLag(float vBatt DECLATE_ENGINE_PARAMETER);
|
||||
float getCltCorrection(float clt DECLATE_ENGINE_PARAMETER);
|
||||
float getRunningFuel(float baseFuel, int rpm DECLATE_ENGINE_PARAMETER);
|
||||
float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S);
|
||||
float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S);
|
||||
float getCltCorrection(float clt DECLARE_ENGINE_PARAMETER_S);
|
||||
float getRunningFuel(float baseFuel, int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
float getCrankingFuel(Engine *engine);
|
||||
float getCrankingFuel3(engine_configuration_s *engineConfiguration, float coolantTemperature, uint32_t revolutionCounterSinceStart);
|
||||
float getFuelMs(int rpm DECLATE_ENGINE_PARAMETER);
|
||||
float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
#endif /* FUEL_MAP_H_ */
|
||||
|
|
|
@ -53,12 +53,12 @@ float getCrankshaftRevolutionTimeMs(int rpm) {
|
|||
* TODO: should be 'crankAngleRange' range?
|
||||
*/
|
||||
float fixAngle(engine_configuration_s const *engineConfiguration, float angle) {
|
||||
// todo efiAssert(engineConfiguration->engineCycle!=0, "engine cycle", NAN);
|
||||
efiAssert(engineConfiguration->engineCycle!=0, "engine cycle", NAN);
|
||||
// I guess this implementation would be faster than 'angle % 720'
|
||||
while (angle < 0)
|
||||
angle += 720;
|
||||
while (angle >= 720)
|
||||
angle -= 720;
|
||||
angle += engineConfiguration->engineCycle;
|
||||
while (angle >= engineConfiguration->engineCycle)
|
||||
angle -= engineConfiguration->engineCycle;
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ OutputSignalList injectonSignals CCM_OPTIONAL
|
|||
;
|
||||
|
||||
static void registerSparkEvent(trigger_shape_s * s,
|
||||
IgnitionEventList *list, io_pin_e pin, float localAdvance, float dwell DECLATE_ENGINE_PARAMETER) {
|
||||
IgnitionEventList *list, io_pin_e pin, float localAdvance, float dwell DECLARE_ENGINE_PARAMETER_S) {
|
||||
|
||||
IgnitionEvent *event = list->getNextActuatorEvent();
|
||||
if (event == NULL)
|
||||
|
@ -127,7 +127,7 @@ static void registerSparkEvent(trigger_shape_s * s,
|
|||
}
|
||||
|
||||
void initializeIgnitionActions(float advance, float dwellAngle,
|
||||
engine_configuration2_s *engineConfiguration2, IgnitionEventList *list DECLATE_ENGINE_PARAMETER) {
|
||||
engine_configuration2_s *engineConfiguration2, IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
|
||||
|
||||
efiAssertVoid(engineConfiguration->cylindersCount > 0, "cylindersCount");
|
||||
|
||||
|
@ -174,7 +174,7 @@ void initializeIgnitionActions(float advance, float dwellAngle,
|
|||
}
|
||||
|
||||
void FuelSchedule::registerInjectionEvent(trigger_shape_s *s,
|
||||
io_pin_e pin, float angle, bool_t isSimultanious DECLATE_ENGINE_PARAMETER) {
|
||||
io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S) {
|
||||
ActuatorEventList *list = &events;
|
||||
|
||||
if (!isPinAssigned(pin)) {
|
||||
|
@ -208,7 +208,7 @@ void FuelSchedule::clear() {
|
|||
}
|
||||
|
||||
void FuelSchedule::addFuelEvents(trigger_shape_s *s,
|
||||
injection_mode_e mode DECLATE_ENGINE_PARAMETER) {
|
||||
injection_mode_e mode DECLARE_ENGINE_PARAMETER_S) {
|
||||
ActuatorEventList *list = &events;
|
||||
;
|
||||
list->resetEventList();
|
||||
|
@ -256,7 +256,7 @@ void FuelSchedule::addFuelEvents(trigger_shape_s *s,
|
|||
/**
|
||||
* @return Spark dwell time, in milliseconds.
|
||||
*/
|
||||
float getSparkDwellMsT(int rpm DECLATE_ENGINE_PARAMETER) {
|
||||
float getSparkDwellMsT(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (isCrankingR(rpm)) {
|
||||
if(engineConfiguration->useConstantDwellDuringCranking) {
|
||||
return engineConfiguration->ignitionDwellForCrankingMs;
|
||||
|
@ -284,7 +284,7 @@ int getEngineCycleEventCount(engine_configuration_s const *engineConfiguration,
|
|||
}
|
||||
|
||||
void findTriggerPosition(trigger_shape_s * s,
|
||||
event_trigger_position_s *position, float angleOffset DECLATE_ENGINE_PARAMETER) {
|
||||
event_trigger_position_s *position, float angleOffset DECLARE_ENGINE_PARAMETER_S) {
|
||||
|
||||
angleOffset = fixAngle(engineConfiguration, angleOffset + engineConfiguration->globalTriggerAngleOffset);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#define INJECTOR_PIN_BY_INDEX(index) (io_pin_e) ((int) INJECTOR_1_OUTPUT + (index))
|
||||
|
||||
void findTriggerPosition(trigger_shape_s * s,
|
||||
event_trigger_position_s *position, float angleOffset DECLATE_ENGINE_PARAMETER);
|
||||
event_trigger_position_s *position, float angleOffset DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
int isInjectionEnabled(engine_configuration_s *engineConfiguration);
|
||||
|
||||
|
@ -59,7 +59,7 @@ int isCrankingRT(engine_configuration_s *engineConfiguration, int rpm);
|
|||
float getEngineLoadT(Engine *engine);
|
||||
#define getEngineLoad() getEngineLoadT(engine)
|
||||
|
||||
float getSparkDwellMsT(int rpm DECLATE_ENGINE_PARAMETER);
|
||||
float getSparkDwellMsT(int rpm DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
int getCylinderId(firing_order_e firingOrder, int index);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ static void endSimultaniousInjection(Engine *engine) {
|
|||
}
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void handleFuelInjectionEvent(InjectionEvent *event, int rpm DECLATE_ENGINE_PARAMETER) {
|
||||
static ALWAYS_INLINE void handleFuelInjectionEvent(InjectionEvent *event, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
/**
|
||||
* todo: we do not really need to calculate fuel for each individual cylinder
|
||||
*/
|
||||
|
@ -140,7 +140,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(InjectionEvent *event, int rp
|
|||
}
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLATE_ENGINE_PARAMETER) {
|
||||
static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (!isInjectionEnabled(engine->engineConfiguration))
|
||||
return;
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3");
|
||||
|
@ -172,7 +172,7 @@ static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLATE_ENGINE
|
|||
}
|
||||
|
||||
static ALWAYS_INLINE void handleSparkEvent(uint32_t eventIndex, IgnitionEvent *iEvent,
|
||||
int rpm DECLATE_ENGINE_PARAMETER) {
|
||||
int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;
|
||||
|
||||
float dwellMs = getSparkDwellMsT(rpm PASS_ENGINE_PARAMETER);
|
||||
|
@ -235,7 +235,7 @@ static ALWAYS_INLINE void handleSparkEvent(uint32_t eventIndex, IgnitionEvent *i
|
|||
}
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void handleSpark(uint32_t eventIndex, int rpm, IgnitionEventList *list DECLATE_ENGINE_PARAMETER) {
|
||||
static ALWAYS_INLINE void handleSpark(uint32_t eventIndex, int rpm, IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
|
||||
if (!isValidRpm(rpm) || !engineConfiguration->isIgnitionEnabled)
|
||||
return; // this might happen for instance in case of a single trigger event after a pause
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ typedef Thread thread_t;
|
|||
|
||||
#define DECLARE_ENGINE_PARAMETER_F void
|
||||
#define DECLARE_ENGINE_PARAMETER_S
|
||||
#define DECLATE_ENGINE_PARAMETER
|
||||
#define PASS_ENGINE_PARAMETER
|
||||
|
||||
#endif /* GLOBAL_H_ */
|
||||
|
|
|
@ -41,8 +41,7 @@ class Engine;
|
|||
#endif
|
||||
|
||||
#define DECLARE_ENGINE_PARAMETER_F Engine *engine, engine_configuration_s *engineConfiguration
|
||||
#define DECLARE_ENGINE_PARAMETER_S Engine *engine, engine_configuration_s *engineConfiguration
|
||||
#define DECLATE_ENGINE_PARAMETER , Engine *engine, engine_configuration_s *engineConfiguration
|
||||
#define DECLARE_ENGINE_PARAMETER_S , Engine *engine, engine_configuration_s *engineConfiguration
|
||||
#define PASS_ENGINE_PARAMETER , engine, engineConfiguration
|
||||
|
||||
#endif /* GLOBAL_H_ */
|
||||
|
|
Loading…
Reference in New Issue