auto-sync
This commit is contained in:
parent
b3c7602e67
commit
3cc4e99473
|
@ -47,8 +47,9 @@ public:
|
|||
|
||||
void initializeIgnitionActions(float advance, float dwellAngle, engine_configuration_s *engineConfiguration,
|
||||
engine_configuration2_s *engineConfiguration2, IgnitionEventList *list);
|
||||
void addFuelEvents(engine_configuration_s const *e, engine_configuration2_s *engineConfiguration2,
|
||||
ActuatorEventList *list, injection_mode_e mode);
|
||||
void addFuelEvents(engine_configuration_s const *e,
|
||||
trigger_shape_s * ts,
|
||||
FuelSchedule *fs, injection_mode_e mode);
|
||||
|
||||
void setDefaultNonPersistentConfiguration(engine_configuration2_s *engineConfiguration2);
|
||||
void printConfiguration(engine_configuration_s *engineConfiguration, engine_configuration2_s *engineConfiguration2);
|
||||
|
|
|
@ -341,7 +341,7 @@ void initEngineContoller(Engine *engine) {
|
|||
}
|
||||
initLogging(&logger, "Engine Controller");
|
||||
|
||||
initSensors();
|
||||
initSensors(engine);
|
||||
|
||||
initPwmGenerator();
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ 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);
|
||||
// I guess this implementation would be faster than 'angle % 720'
|
||||
while (angle < 0)
|
||||
angle += 720;
|
||||
|
@ -181,12 +182,13 @@ static void registerInjectionEvent(engine_configuration_s const *e, trigger_shap
|
|||
registerActuatorEventExt(e, s, list->getNextActuatorEvent(), injectonSignals.add(pin), angle);
|
||||
}
|
||||
|
||||
void addFuelEvents(engine_configuration_s const *e, engine_configuration2_s *engineConfiguration2,
|
||||
ActuatorEventList *list, injection_mode_e mode) {
|
||||
void addFuelEvents(engine_configuration_s const *e, trigger_shape_s *s,
|
||||
FuelSchedule *fs,
|
||||
injection_mode_e mode) {
|
||||
ActuatorEventList *list = &fs->events;
|
||||
;
|
||||
list->resetEventList();
|
||||
|
||||
trigger_shape_s *s = &engineConfiguration2->triggerShape;
|
||||
|
||||
float baseAngle = e->globalTriggerAngleOffset + e->injectionOffset;
|
||||
|
||||
switch (mode) {
|
||||
|
@ -351,10 +353,12 @@ engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;
|
|||
// todo: move this reset into decoder
|
||||
engineConfiguration2->triggerShape.calculateTriggerSynchPoint(engineConfiguration, &engineConfiguration->triggerConfig);
|
||||
|
||||
trigger_shape_s * ts = &engineConfiguration2->triggerShape;
|
||||
|
||||
injectonSignals.clear();
|
||||
addFuelEvents(engineConfiguration, engineConfiguration2, &engineConfiguration2->crankingInjectionEvents.events,
|
||||
addFuelEvents(engineConfiguration, ts, &engineConfiguration2->crankingInjectionEvents,
|
||||
engineConfiguration->crankingInjectionMode);
|
||||
addFuelEvents(engineConfiguration, engineConfiguration2, &engineConfiguration2->injectionEvents.events,
|
||||
addFuelEvents(engineConfiguration, ts, &engineConfiguration2->injectionEvents,
|
||||
engineConfiguration->injectionMode);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include "allsensors.h"
|
||||
|
||||
extern Engine engine;
|
||||
|
||||
void initSensors(void) {
|
||||
initThermistors(&engine);
|
||||
void initSensors(Engine *engine) {
|
||||
initThermistors(engine);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
#include "adc_math.h"
|
||||
#endif
|
||||
|
||||
void initSensors(void);
|
||||
void initSensors(Engine *engine);
|
||||
|
||||
#endif /*SENSORS_H_*/
|
||||
|
|
|
@ -332,8 +332,8 @@ void MainTriggerCallback::init(Engine *engine, engine_configuration2_s *engineCo
|
|||
this->engineConfiguration2 = engineConfiguration2;
|
||||
}
|
||||
|
||||
static void showMainInfo(void) {
|
||||
int rpm = getRpm();
|
||||
static void showMainInfo(Engine *engine) {
|
||||
int rpm = engine->rpmCalculator->rpm();
|
||||
float el = getEngineLoadT(mainTriggerCallbackInstance.engine);
|
||||
#if EFI_PROD_CODE
|
||||
scheduleMsg(&logger, "rpm %d engine_load %f", rpm, el);
|
||||
|
@ -349,7 +349,7 @@ void initMainEventListener(Engine *engine, engine_configuration2_s *engineConfig
|
|||
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
addConsoleAction("performanceinfo", showTriggerHistogram);
|
||||
addConsoleAction("maininfo", showMainInfo);
|
||||
addConsoleActionP("maininfo", (VoidPtr)showMainInfo, engine);
|
||||
|
||||
initLogging(&logger, "main event handler");
|
||||
printMsg(&logger, "initMainLoop: %d", currentTimeMillis());
|
||||
|
|
|
@ -15,11 +15,10 @@ extern int timeNow;
|
|||
|
||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType) {
|
||||
ec = &persistentConfig.engineConfiguration;
|
||||
|
||||
engine.engineConfiguration = ec;
|
||||
engine.engineConfiguration = &persistentConfig.engineConfiguration;
|
||||
ec2.engineConfiguration = &persistentConfig.engineConfiguration;
|
||||
|
||||
engine.engineConfiguration2 = &ec2;
|
||||
ec2.engineConfiguration = ec;
|
||||
|
||||
prepareFuelMap(engine.engineConfiguration);
|
||||
|
||||
|
@ -27,7 +26,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) {
|
|||
initSpeedDensity(ec);
|
||||
|
||||
resetConfigurationExt(NULL, FORD_INLINE_6_1995, &engine);
|
||||
ec->mafAdcChannel = (adc_channel_e)TEST_MAF_CHANNEL;
|
||||
engine.engineConfiguration->mafAdcChannel = (adc_channel_e)TEST_MAF_CHANNEL;
|
||||
}
|
||||
|
||||
void EngineTestHelper::fireTriggerEvents() {
|
||||
|
|
|
@ -391,6 +391,9 @@ static void testRpmCalculator(void) {
|
|||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
|
||||
assertEquals(720, eth.engine.engineConfiguration->engineCycle);
|
||||
assertEquals(720, eth.ec->engineCycle);
|
||||
|
||||
efiAssertVoid(eth.engine.engineConfiguration!=NULL, "null config in engine");
|
||||
|
||||
initThermistors(ð.engine);
|
||||
|
|
Loading…
Reference in New Issue