diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 0667dd6eed..ab7194629a 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -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;ifsioAdc[i] != EFI_ADC_NONE) { + strcpy(buf, "adcX"); + buf[3] = '0' + i; + reportSensorF(log, fileFormat, buf, "", getVoltage("fsio", engineConfiguration->fsioAdc[i]), 2); + } } - - } diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index d32f6ff0ca..62b9560411 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -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; diff --git a/unit_tests/test_fuel_map.cpp b/unit_tests/test_fuel_map.cpp index 34ef096dd5..99c5a11b60 100644 --- a/unit_tests/test_fuel_map.cpp +++ b/unit_tests/test_fuel_map.cpp @@ -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");