refctoring trigger sync layer

This commit is contained in:
rusefi 2018-10-21 11:17:47 -04:00
parent c2be975f62
commit e19fe6bbba
4 changed files with 8 additions and 9 deletions

View File

@ -422,7 +422,7 @@ static void triggerShapeInfo(void) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
TriggerShape *s = &engine->triggerCentral.triggerShape;
scheduleMsg(logger, "useRise=%s", boolToString(TRIGGER_SHAPE(useRiseEdge)));
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncRatioFrom), TRIGGER_SHAPE(syncRatioTo));
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]));
for (int i = 0; i < s->getSize(); i++) {
scheduleMsg(logger, "event %d %.2f", i, s->eventAngles[i]);
@ -562,7 +562,7 @@ void triggerInfo(void) {
boolToString(engineConfiguration->directSelfStimulation));
if (TRIGGER_SHAPE(isSynchronizationNeeded)) {
scheduleMsg(logger, "gap from %.2f to %.2f", ts->syncRatioFrom, ts->syncRatioTo);
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]));
}
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */

View File

@ -260,8 +260,8 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
#endif /* EFI_UNIT_TEST */
}
bool primaryGap = currentDuration > toothed_previous_duration * TRIGGER_SHAPE(syncRatioFrom)
&& currentDuration < toothed_previous_duration * TRIGGER_SHAPE(syncRatioTo);
bool primaryGap = currentDuration > toothed_previous_duration * TRIGGER_SHAPE(syncronizationRatioFrom[0])
&& currentDuration < toothed_previous_duration * TRIGGER_SHAPE(syncronizationRatioTo[0]);
bool secondaryGap = cisnan(TRIGGER_SHAPE(syncronizationRatioFrom[1])) || (toothed_previous_duration > durationBeforePrevious * TRIGGER_SHAPE(syncronizationRatioFrom[1])
&& toothed_previous_duration < durationBeforePrevious * TRIGGER_SHAPE(syncronizationRatioTo[1]));
@ -289,7 +289,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
getTimeNowSeconds(),
gap, prevGap, gap3,
currentCycle.current_index,
TRIGGER_SHAPE(syncRatioFrom), TRIGGER_SHAPE(syncRatioTo),
TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]),
TRIGGER_SHAPE(syncronizationRatioFrom[1]), TRIGGER_SHAPE(syncronizationRatioTo[1]),
TRIGGER_SHAPE(syncronizationRatioFrom[2]), TRIGGER_SHAPE(syncronizationRatioTo[2]),
someSortOfTriggerError);

View File

@ -441,8 +441,8 @@ void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
void TriggerShape::setTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
isSynchronizationNeeded = true;
this->syncRatioFrom = syncRatioFrom;
this->syncRatioTo = syncRatioTo;
this->syncronizationRatioFrom[0] = syncRatioFrom;
this->syncronizationRatioTo[0] = syncRatioTo;
this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f);
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
if (printTriggerDebug) {

View File

@ -102,8 +102,7 @@ public:
float syncronizationRatioFrom[GAP_TRACKING_LENGHT];
float syncronizationRatioTo[GAP_TRACKING_LENGHT];
float syncRatioFrom;
float syncRatioTo;
/**
* used by NoiselessTriggerDecoder (See TriggerCentral::handleShaftSignal())
*/