auto-sync

This commit is contained in:
rusEfi 2016-12-25 22:02:40 -05:00
parent 201dbbbe58
commit bd0a79c3d2
2 changed files with 11 additions and 8 deletions

View File

@ -44,7 +44,7 @@ public:
* this method schedules all fuel events for an engine cycle * this method schedules all fuel events for an engine cycle
*/ */
void addFuelEvents(DECLARE_ENGINE_PARAMETER_F); void addFuelEvents(DECLARE_ENGINE_PARAMETER_F);
void addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S); bool addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S);
InjectionEvent elements[MAX_INJECTION_OUTPUT_COUNT]; InjectionEvent elements[MAX_INJECTION_OUTPUT_COUNT];
bool isReady; bool isReady;

View File

@ -101,13 +101,13 @@ void FuelSchedule::clear() {
isReady = false; isReady = false;
} }
void FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S) { bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S) {
efiAssertVoid(engine!=NULL, "engine is NULL"); efiAssert(engine!=NULL, "engine is NULL", false);
if (cisnan(engine->rpmCalculator.oneDegreeUs)) { if (cisnan(engine->rpmCalculator.oneDegreeUs)) {
// in order to have fuel schedule we need to have current RPM // in order to have fuel schedule we need to have current RPM
// wonder if this line slows engine startup? // wonder if this line slows engine startup?
return; return false;
} }
/** /**
@ -142,9 +142,9 @@ void FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S) {
int cylindersCount = CONFIG(specs.cylindersCount); int cylindersCount = CONFIG(specs.cylindersCount);
if (cylindersCount < 1) { if (cylindersCount < 1) {
firmwareError(OBD_PCM_Processor_Fault, "temp cylindersCount %d", cylindersCount); warning(CUSTOM_OBD_ZERO_CYLINDER_COUNT, "temp cylindersCount %d", cylindersCount);
return false;
} }
efiAssertVoid(cylindersCount > 0, "cylindersCount");
float angle = baseAngle float angle = baseAngle
+ i * ENGINE(engineCycle) / cylindersCount; + i * ENGINE(engineCycle) / cylindersCount;
@ -179,12 +179,13 @@ void FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S) {
ev->isSimultanious = isSimultanious; ev->isSimultanious = isSimultanious;
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape"); efiAssert(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape", false);
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER)); TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER));
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
printf("registerInjectionEvent angle=%f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, index); printf("registerInjectionEvent angle=%f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, index);
#endif #endif
return true;
} }
void FuelSchedule::addFuelEvents(DECLARE_ENGINE_PARAMETER_F) { void FuelSchedule::addFuelEvents(DECLARE_ENGINE_PARAMETER_F) {
@ -193,7 +194,9 @@ void FuelSchedule::addFuelEvents(DECLARE_ENGINE_PARAMETER_F) {
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) { for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
InjectionEvent *ev = &elements[i]; InjectionEvent *ev = &elements[i];
ev->ownIndex = i; ev->ownIndex = i;
addFuelEventsForCylinder(i PASS_ENGINE_PARAMETER); bool result = addFuelEventsForCylinder(i PASS_ENGINE_PARAMETER);
if (!result)
return;
} }
isReady = true; isReady = true;
} }