auto-sync

This commit is contained in:
rusEfi 2016-08-18 00:02:22 -04:00
parent 9b189fa2f8
commit c3d7b956d2
3 changed files with 16 additions and 15 deletions

View File

@ -229,13 +229,13 @@ static void printSensors(Logging *log, bool fileFormat) {
// debugFloat(&logger, "tch", getTCharge1(tps), 2);
// todo: implement a proper loop
if (engineConfiguration->fsioAdc[0] != EFI_ADC_NONE) {
strcpy(buf, "adcX");
reportSensorF(log, fileFormat, "adc0", "", getVoltage("fsio", engineConfiguration->fsioAdc[0]), 2);
for (int i = 0;i<FSIO_ADC_COUNT;i++) {
if (engineConfiguration->fsioAdc[i] != EFI_ADC_NONE) {
strcpy(buf, "adcX");
buf[3] = '0' + i;
reportSensorF(log, fileFormat, buf, "", getVoltage("fsio", engineConfiguration->fsioAdc[i]), 2);
}
}
}

View File

@ -43,14 +43,12 @@ TriggerShape::TriggerShape() :
isSynchronizationNeeded = false;
// todo: reuse 'clear' method?
invertOnAdd = false;
tdcPosition = 0;
// skippedToothCount = totalToothCount = 0;
syncRatioFrom = syncRatioTo = 0;
secondSyncRatioFrom = 0.000001;
secondSyncRatioTo = 100000;
thirdSyncRatioFrom = 0.000001;
thirdSyncRatioTo = 100000;
memset(eventAngles, 0, sizeof(eventAngles));
memset(frontOnlyIndexes, 0, sizeof(frontOnlyIndexes));
memset(isFrontEvent, 0, sizeof(isFrontEvent));
memset(triggerIndexByAngle, 0, sizeof(triggerIndexByAngle));
@ -109,6 +107,12 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
}
void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTriggerInput) {
isSynchronizationNeeded = true; // that's default value
this->needSecondTriggerInput = needSecondTriggerInput;
memset(dutyCycle, 0, sizeof(dutyCycle));
memset(eventAngles, 0, sizeof(eventAngles));
// memset(triggerIndexByAngle, 0, sizeof(triggerIndexByAngle));
tdcPosition = 0;
setTriggerSynchronizationGap(2);
// todo: true here, false in constructor() what a mess!
@ -119,7 +123,6 @@ void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTri
this->operationMode = operationMode;
size = 0;
this->needSecondTriggerInput = needSecondTriggerInput;
triggerShapeSynchPointIndex = 0;
memset(initialState, 0, sizeof(initialState));
memset(switchTimesBuffer, 0, sizeof(switchTimesBuffer));
@ -370,12 +373,10 @@ void setVwConfiguration(TriggerShape *s) {
s->useRiseEdge = true;
initializeSkippedToothTriggerShapeExt(s, 60, 2,
operationMode);
s->initialize(operationMode, false);
s->isSynchronizationNeeded = true;
s->initialize(operationMode, false);
int totalTeethCount = 60;
int skippedCount = 2;

View File

@ -188,19 +188,19 @@ void testAngleResolver(void) {
printf("*************************************************** testAngleResolver 0\r\n");
findTriggerPosition(&ae.add()->injectionStart, -122 PASS_ENGINE_PARAMETER);
assertEqualsM("size", 1, ae.size);
assertEquals(2, ae.elements[0].injectionStart.eventIndex);
assertEqualsM("eventIndex@0", 2, ae.elements[0].injectionStart.eventIndex);
assertEquals(0.24, ae.elements[0].injectionStart.angleOffset);
printf("*************************************************** testAngleResolver 0.1\r\n");
ae.reset();
findTriggerPosition(&ae.add()->injectionStart, -80 PASS_ENGINE_PARAMETER);
assertEquals(2, ae.elements[0].injectionStart.eventIndex);
assertEqualsM("eventIndex@0", 2, ae.elements[0].injectionStart.eventIndex);
assertEquals(42.24, ae.elements[0].injectionStart.angleOffset);
printf("*************************************************** testAngleResolver 0.2\r\n");
ae.reset();
findTriggerPosition(&ae.add()->injectionStart, -54 PASS_ENGINE_PARAMETER);
assertEquals(2, ae.elements[0].injectionStart.eventIndex);
assertEqualsM("eventIndex@0", 2, ae.elements[0].injectionStart.eventIndex);
assertEquals(68.2400, ae.elements[0].injectionStart.angleOffset);
printf("*************************************************** testAngleResolver 0.3\r\n");