auto-sync

This commit is contained in:
rusEfi 2014-11-02 13:04:37 -06:00
parent ff9af5294f
commit b6bacbf8bb
4 changed files with 22 additions and 4 deletions

View File

@ -69,5 +69,5 @@ void configureMiniCooperTriggerShape(trigger_shape_s *s) {
/**
* With just one tooth on camshaft synchronization is not needed
*/
s->isSynchronizationNeeded = FALSE;
s->isSynchronizationNeeded = false;
}

View File

@ -190,15 +190,20 @@ static void triggerShapeInfo(Engine *engine) {
static void triggerInfo(Engine *engine) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
trigger_shape_s *ts = &engineConfiguration2->triggerShape;
scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration->engineType),
engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType);
scheduleMsg(&logger, "sn=%d", ts->isSynchronizationNeeded);
scheduleMsg(&logger, "trigger event counters %d/%d/%d/%d", triggerCentral.getHwEventCounter(0),
triggerCentral.getHwEventCounter(1), triggerCentral.getHwEventCounter(2),
triggerCentral.getHwEventCounter(3));
scheduleMsg(&logger, "expected cycle events %d/%d/%d", engineConfiguration2->triggerShape.expectedEventCount[0],
engineConfiguration2->triggerShape.expectedEventCount[1],
engineConfiguration2->triggerShape.expectedEventCount[2]);
ts->expectedEventCount[2]);
scheduleMsg(&logger, "trigger type=%d/need2ndChannel=%s", engineConfiguration->triggerConfig.triggerType,
boolToString(engineConfiguration->needSecondTriggerInput));
@ -245,5 +250,4 @@ void initTriggerCentral(Engine *engine) {
#if EFI_HISTOGRAMS
initHistogram(&triggerCallback, "all callbacks");
#endif /* EFI_HISTOGRAMS */
initTriggerDecoder();
}

View File

@ -39,6 +39,9 @@ static cyclic_buffer errorDetection;
bool printGapRatio = false;
#else
Logging logger;
#endif /* ! EFI_PROD_CODE */
/**
@ -60,6 +63,9 @@ static inline bool isSynchronizationGap(TriggerState const *shaftPositionState,
float gap = 1.0 * currentDuration / shaftPositionState->toothed_previous_duration;
print("current gap %f\r\n", gap);
}
#else
// float gap = 1.0 * currentDuration / shaftPositionState->toothed_previous_duration;
// scheduleMsg(&logger, "gap=%f", gap);
#endif /* ! EFI_PROD_CODE */
@ -390,7 +396,7 @@ uint32_t findTriggerZeroEventIndex(trigger_shape_s * shape, trigger_config_s con
void initTriggerDecoder(void) {
#if EFI_PROD_CODE || EFI_SIMULATOR
// initLogging(&logger, "trigger decoder");
initLogging(&logger, "trigger decoder");
#endif
}

View File

@ -158,6 +158,14 @@ void initHardware(Logging *logger, Engine *engine) {
initHistogramsModule();
#endif /* EFI_HISTOGRAMS */
/**
* This is so early because we want to init logger
* which would be used while finding trigger synch index
* while config read
*/
initTriggerDecoder();
/**
* We need the LED_ERROR pin even before we read configuration
*/