mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
dd0a831964
commit
e63bc431c3
|
@ -289,10 +289,11 @@ void triggerInfo(void) {
|
||||||
|
|
||||||
TriggerShape *ts = &engine->triggerShape;
|
TriggerShape *ts = &engine->triggerShape;
|
||||||
|
|
||||||
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s onlyFront=%s",
|
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s onlyFront=%s gapBothDirections=%s",
|
||||||
getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType,
|
getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType,
|
||||||
getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type,
|
getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type,
|
||||||
boolToString(TRIGGER_SHAPE(useRiseEdge)), boolToString(engineConfiguration->useOnlyFrontForTrigger));
|
boolToString(TRIGGER_SHAPE(useRiseEdge)), boolToString(engineConfiguration->useOnlyFrontForTrigger),
|
||||||
|
boolToString(TRIGGER_SHAPE(gapBothDirections)));
|
||||||
|
|
||||||
if (engineConfiguration->trigger.type == TT_TOOTHED_WHEEL) {
|
if (engineConfiguration->trigger.type == TT_TOOTHED_WHEEL) {
|
||||||
scheduleMsg(logger, "total %d/skipped %d", engineConfiguration->trigger.customTotalToothCount,
|
scheduleMsg(logger, "total %d/skipped %d", engineConfiguration->trigger.customTotalToothCount,
|
||||||
|
|
|
@ -35,8 +35,8 @@ void configureNeon2003TriggerShape(TriggerShape *s) {
|
||||||
s->tdcPosition = 496;
|
s->tdcPosition = 496;
|
||||||
|
|
||||||
// are these non-default values really needed here now that the gap is finally precise?
|
// are these non-default values really needed here now that the gap is finally precise?
|
||||||
s->setTriggerSynchronizationGap(1);
|
s->setTriggerSynchronizationGap2(0.75, 1.40);
|
||||||
s->setSecondTriggerSynchronizationGap(1);
|
s->setSecondTriggerSynchronizationGap2(0.7, 1.25);
|
||||||
|
|
||||||
float EPS_ANGLE = 0.3;
|
float EPS_ANGLE = 0.3;
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ float actualSynchGap;
|
||||||
static Logging * logger;
|
static Logging * logger;
|
||||||
|
|
||||||
efitick_t lastDecodingErrorTime = US2NT(-10000000LL);
|
efitick_t lastDecodingErrorTime = US2NT(-10000000LL);
|
||||||
|
// the boolean flag is a performance optimization so that complex comparison is avoided if no error
|
||||||
|
bool_t someSortOfTriggerError = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TRUE is something is wrong with trigger decoding
|
* @return TRUE is something is wrong with trigger decoding
|
||||||
|
@ -201,16 +203,16 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
;
|
;
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
if (engineConfiguration->isPrintTriggerSynchDetails) {
|
if (engineConfiguration->isPrintTriggerSynchDetails || someSortOfTriggerError) {
|
||||||
#else
|
#else
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
float gap = 1.0 * currentDuration / toothed_previous_duration;
|
float gap = 1.0 * currentDuration / toothed_previous_duration;
|
||||||
|
float prevGap = 1.0 * toothed_previous_duration / durationBeforePrevious;
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
scheduleMsg(logger, "gap=%f @ %d", gap, currentCycle.current_index);
|
scheduleMsg(logger, "gap=%f/%f @ %d while expected %f/%f and %f/%f", gap, prevGap, currentCycle.current_index, TRIGGER_SHAPE(syncRatioFrom), TRIGGER_SHAPE(syncRatioTo), TRIGGER_SHAPE(secondSyncRatioFrom), TRIGGER_SHAPE(secondSyncRatioTo));
|
||||||
#else
|
#else
|
||||||
actualSynchGap = gap;
|
actualSynchGap = gap;
|
||||||
float prevGap = 1.0 * toothed_previous_duration / durationBeforePrevious;
|
|
||||||
print("current gap %f/%f c=%d prev=%d\r\n", gap, prevGap, currentDuration, toothed_previous_duration);
|
print("current gap %f/%f c=%d prev=%d\r\n", gap, prevGap, currentDuration, toothed_previous_duration);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
@ -245,8 +247,10 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
triggerDecoderErrorPin.setValue(isDecodingError);
|
triggerDecoderErrorPin.setValue(isDecodingError);
|
||||||
if (isDecodingError) {
|
if (isDecodingError) {
|
||||||
lastDecodingErrorTime = getTimeNowNt();
|
lastDecodingErrorTime = getTimeNowNt();
|
||||||
|
someSortOfTriggerError = true;
|
||||||
|
|
||||||
totalTriggerErrorCounter++;
|
totalTriggerErrorCounter++;
|
||||||
if (engineConfiguration->isPrintTriggerSynchDetails) {
|
if (engineConfiguration->isPrintTriggerSynchDetails || someSortOfTriggerError) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
|
scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
|
||||||
currentCycle.current_index, TRIGGER_SHAPE(expectedEventCount[0]),
|
currentCycle.current_index, TRIGGER_SHAPE(expectedEventCount[0]),
|
||||||
|
@ -282,6 +286,13 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
}
|
}
|
||||||
if (!isValidIndex(PASS_ENGINE_PARAMETER_F)) {
|
if (!isValidIndex(PASS_ENGINE_PARAMETER_F)) {
|
||||||
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d while size %d", currentCycle.current_index, TRIGGER_SHAPE(size));
|
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d while size %d", currentCycle.current_index, TRIGGER_SHAPE(size));
|
||||||
|
lastDecodingErrorTime = getTimeNowNt();
|
||||||
|
someSortOfTriggerError = true;
|
||||||
|
}
|
||||||
|
if (someSortOfTriggerError) {
|
||||||
|
if (getTimeNowNt() - lastDecodingErrorTime > US2NT(US_PER_SECOND_LL)) {
|
||||||
|
someSortOfTriggerError = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boardConfiguration->sensorChartMode == SC_RPM_ACCEL || boardConfiguration->sensorChartMode == SC_DETAILED_RPM) {
|
if (boardConfiguration->sensorChartMode == SC_RPM_ACCEL || boardConfiguration->sensorChartMode == SC_DETAILED_RPM) {
|
||||||
|
|
|
@ -40,8 +40,6 @@ static void shaft_icu_width_callback(ICUDriver *icup) {
|
||||||
// todo: add support for 3rd channel
|
// todo: add support for 3rd channel
|
||||||
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_UP : SHAFT_SECONDARY_UP;
|
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_UP : SHAFT_SECONDARY_UP;
|
||||||
|
|
||||||
if (isLessImportant(signal) && CONFIG(useOnlyFrontForTrigger))
|
|
||||||
return;
|
|
||||||
hwHandleShaftSignal(signal);
|
hwHandleShaftSignal(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +53,7 @@ static void shaft_icu_period_callback(ICUDriver *icup) {
|
||||||
// icucnt_t last_period = icuGetPeriod(icup); so far we are fine with system time
|
// icucnt_t last_period = icuGetPeriod(icup); so far we are fine with system time
|
||||||
trigger_event_e signal =
|
trigger_event_e signal =
|
||||||
isPrimary ? SHAFT_PRIMARY_DOWN : SHAFT_SECONDARY_DOWN;
|
isPrimary ? SHAFT_PRIMARY_DOWN : SHAFT_SECONDARY_DOWN;
|
||||||
if (isLessImportant(signal) && CONFIG(useOnlyFrontForTrigger))
|
if (CONFIG(useOnlyFrontForTrigger))
|
||||||
return;
|
return;
|
||||||
hwHandleShaftSignal(signal);
|
hwHandleShaftSignal(signal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,5 +275,5 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
return 20150923;
|
return 20150924;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue