auto-sync

This commit is contained in:
rusEfi 2016-11-25 14:03:06 -05:00
parent 8e74c61cca
commit b8bf58aa58
3 changed files with 47 additions and 50 deletions

View File

@ -93,53 +93,6 @@ void setSingleCoilDwell(engine_configuration_s *engineConfiguration) {
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
static void addIgnitionEvent(angle_t localAdvance, angle_t dwellAngle, IgnitionEventList *list, IgnitionOutputPin *output DECLARE_ENGINE_PARAMETER_S) {
IgnitionEvent *event = list->add();
if (!isPinAssigned(output)) {
// todo: extact method for this index math
warning(CUSTOM_OBD_PIN_NOT_ASSIGNED, "no_pin_cl #%s", output->name);
}
event->output = output;
event->advance = localAdvance;
findTriggerPosition(&event->dwellPosition, localAdvance - dwellAngle PASS_ENGINE_PARAMETER);
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex);
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
#endif /* FUEL_MATH_EXTREME_LOGGING */
}
void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
efiAssertVoid(engineConfiguration->specs.cylindersCount > 0, "cylindersCount");
list->reset();
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
// todo: clean up this implementation? does not look too nice as is.
// change of sign here from 'before TDC' to 'after TDC'
angle_t localAdvance = -advance + ENGINE(angleExtra[i]);
int index = ENGINE(ignitionPin[i]);
int cylinderIndex = ID2INDEX(getCylinderId(CONFIG(specs.firingOrder), index));
IgnitionOutputPin *output = &enginePins.coils[cylinderIndex];
addIgnitionEvent(localAdvance, dwellAngle, list, output PASS_ENGINE_PARAMETER);
if (CONFIG(ignitionMode) == IM_WASTED_SPARK && CONFIG(twoWireBatchIgnition)) {
index += CONFIG(specs.cylindersCount) / 2;
cylinderIndex = ID2INDEX(getCylinderId(CONFIG(specs.firingOrder), index));
output = &enginePins.coils[cylinderIndex];
addIgnitionEvent(localAdvance, dwellAngle, list, output PASS_ENGINE_PARAMETER);
}
}
}
void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle, angle_t injectionDuration,
bool isSimultanious DECLARE_ENGINE_PARAMETER_S) {

View File

@ -19,9 +19,6 @@ void setAlgorithm(engine_load_mode_e algo DECLARE_ENGINE_PARAMETER_S);
void findTriggerPosition(
event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_S);
void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S);
#if EFI_ENABLE_ASSERTS
#define assertAngleRange(angle) if(angle > 10000000 || angle < -10000000) { firmwareError(OBD_PCM_Processor_Fault, "angle range");angle = 0;}
#else

View File

@ -182,6 +182,53 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
}
}
static void addIgnitionEvent(angle_t localAdvance, angle_t dwellAngle, IgnitionEventList *list, IgnitionOutputPin *output DECLARE_ENGINE_PARAMETER_S) {
IgnitionEvent *event = list->add();
if (!isPinAssigned(output)) {
// todo: extract method for this index math
warning(CUSTOM_OBD_PIN_NOT_ASSIGNED, "no_pin_cl #%s", output->name);
}
event->output = output;
event->advance = localAdvance;
findTriggerPosition(&event->dwellPosition, localAdvance - dwellAngle PASS_ENGINE_PARAMETER);
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex);
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
#endif /* FUEL_MATH_EXTREME_LOGGING */
}
static void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
efiAssertVoid(engineConfiguration->specs.cylindersCount > 0, "cylindersCount");
list->reset();
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
// todo: clean up this implementation? does not look too nice as is.
// change of sign here from 'before TDC' to 'after TDC'
angle_t localAdvance = -advance + ENGINE(angleExtra[i]);
int index = ENGINE(ignitionPin[i]);
int cylinderIndex = ID2INDEX(getCylinderId(CONFIG(specs.firingOrder), index));
IgnitionOutputPin *output = &enginePins.coils[cylinderIndex];
addIgnitionEvent(localAdvance, dwellAngle, list, output PASS_ENGINE_PARAMETER);
if (CONFIG(ignitionMode) == IM_WASTED_SPARK && CONFIG(twoWireBatchIgnition)) {
index += CONFIG(specs.cylindersCount) / 2;
cylinderIndex = ID2INDEX(getCylinderId(CONFIG(specs.firingOrder), index));
output = &enginePins.coils[cylinderIndex];
addIgnitionEvent(localAdvance, dwellAngle, list, output PASS_ENGINE_PARAMETER);
}
}
}
static ALWAYS_INLINE void prepareIgnitionSchedule(int rpm, int revolutionIndex DECLARE_ENGINE_PARAMETER_S) {
engine->m.beforeIgnitionSch = GET_TIMESTAMP();