auto-sync

This commit is contained in:
rusEfi 2014-11-25 20:03:18 -06:00
parent 76ef575ad7
commit 786c576476
7 changed files with 28 additions and 10 deletions

View File

@ -24,6 +24,8 @@ void setBmwE34(engine_configuration_s *engineConfiguration) {
engineConfiguration->injectionMode = IM_SIMULTANEOUS;
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
engineConfiguration->ignMathCalculateAtIndex = 15;
setConstantDwell(engineConfiguration, 3); // a bit shorter dwell
engineConfiguration->useConstantDwellDuringCranking = true;
engineConfiguration->ignitionDwellForCrankingMs = 5;

View File

@ -509,7 +509,9 @@ typedef struct {
*/
adc_channel_e acSwitchAdc;
int unused3[91];
int ignMathCalculateAtIndex;
int unused3[90];
} engine_configuration_s;

View File

@ -12,7 +12,7 @@
#include "engine_configuration.h"
#include "engine.h"
#define FLASH_DATA_VERSION 5484
#define FLASH_DATA_VERSION 5590
void readFromFlash(void);
void initFlash(Engine *engine);

View File

@ -35,6 +35,12 @@ EXTERN_ENGINE
extern OutputPin outputs[IO_PIN_COUNT];
/**
* this cache allows us to find a close-enough (with one degree precision) trigger wheel index by
* given angle with fast constant speed
*/
static int triggerIndexByAngle[720];
/*
* default Volumetric Efficiency
*/
@ -110,8 +116,7 @@ void initializeIgnitionActions(float advance, float dwellAngle, IgnitionEventLis
event->io_pin = pin;
event->advance = localAdvance;
findTriggerPosition(&event->dwellPosition, localAdvance - dwellAngle
PASS_ENGINE_PARAMETER);
findTriggerPosition(&event->dwellPosition, localAdvance - dwellAngle PASS_ENGINE_PARAMETER);
}
}
@ -252,7 +257,7 @@ void findTriggerPosition(event_trigger_position_s *position, float angleOffset D
angleOffset += CONFIG(globalTriggerAngleOffset);
fixAngle(angleOffset);
int index = findAngleIndex(angleOffset PASS_ENGINE_PARAMETER);
int index = triggerIndexByAngle[(int)angleOffset];
float eventAngle = TRIGGER_SHAPE(eventAngles[index]);
if (angleOffset < eventAngle) {
firmwareError("angle constraint violation in registerActuatorEventExt(): %f/%f", angleOffset, eventAngle);
@ -328,9 +333,13 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
}
for (int angle = 0; angle < CONFIG(engineCycle); angle++) {
triggerIndexByAngle[angle] = findAngleIndex(angle PASS_ENGINE_PARAMETER);
}
injectonSignals.clear();
engineConfiguration2->crankingInjectionEvents.addFuelEvents(engineConfiguration->crankingInjectionMode
PASS_ENGINE_PARAMETER);
engineConfiguration2->crankingInjectionEvents.addFuelEvents(
engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER);
engineConfiguration2->injectionEvents.addFuelEvents(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER);
}

View File

@ -340,10 +340,15 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
if (eventIndex == 0) {
if (localVersion.isOld())
prepareOutputSignals(PASS_ENGINE_PARAMETER_F);
}
if (eventIndex == engineConfiguration->ignMathCalculateAtIndex) {
engine->beforeIgnitionMath = GET_TIMESTAMP();
doSomeCalc(rpm PASS_ENGINE_PARAMETER);
engine->ignitionMathTime = GET_TIMESTAMP() - engine->beforeIgnitionMath;
}
if (eventIndex == 0) {
engine->beforeIgnitionSch = GET_TIMESTAMP();
/**

View File

@ -256,7 +256,7 @@ void firmwareError(const char *fmt, ...) {
}
}
static char UNUSED_RAM_SIZE[10000];
static char UNUSED_RAM_SIZE[7000];
static char UNUSED_CCM_SIZE[11000] CCM_OPTIONAL;

View File

@ -187,8 +187,8 @@ void testAngleResolver(void) {
printf("*************************************************** testAngleResolver 2\r\n");
ae.resetEventList();
findTriggerPosition(&ae.getNextActuatorEvent()->position, 51 + 180 - 175 PASS_ENGINE_PARAMETER);
assertEquals(3, ae.events[0].position.eventIndex);
assertEquals(2.955, ae.events[0].position.angleOffset);
assertEquals(2, ae.events[0].position.eventIndex);
assertEquals(112.3495, ae.events[0].position.angleOffset);
}
void testPinHelper(void) {