let's try again

This commit is contained in:
Andrey 2023-01-03 08:38:23 -05:00
parent 0620164d14
commit d0f6fa8ea3
3 changed files with 9 additions and 6 deletions

View File

@ -985,9 +985,9 @@ static void calculateTriggerSynchPoint(
}
}
void TriggerCentral::updateWaveform() {
static TriggerDecoderBase initState("init");
TriggerDecoderBase initState("init");
void TriggerCentral::updateWaveform() {
// Re-read config in case it's changed
primaryTriggerConfiguration.update();
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {

View File

@ -24,6 +24,7 @@ using ::testing::_;
extern WarningCodeState unitTestWarningCodeState;
extern bool printTriggerDebug;
extern float actualSynchGap;
extern "C" {
void sendOutConfirmation(char *value, int i);
@ -155,6 +156,8 @@ TEST(misc, testFordAspire) {
}
extern TriggerDecoderBase initState;
static void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPointIndex, float channel1duty, float channel2duty, float expectedGapRatio = NAN) {
printf("====================================================================================== testTriggerDecoder2 msg=%s\r\n", msg);
@ -168,7 +171,7 @@ static void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPo
assertEqualsM("synchPointIndex", synchPointIndex, t->getTriggerWaveformSynchPointIndex());
if (!cisnan(expectedGapRatio)) {
assertEqualsM2("actual gap ratio", expectedGapRatio, engine->triggerCentral.triggerState.triggerSyncGapRatio, 0.001);
assertEqualsM2("actual gap ratio", expectedGapRatio, initState.triggerSyncGapRatio, 0.001);
}
}

View File

@ -43,7 +43,7 @@ static void simulateTrigger(TriggerAdcDetector &trigAdcState, CsvReader &reader,
double value = 0;
double stamp = reader.readTimestampAndValues(&value);
efitick_t stampUs = (efitick_t)(stamp * 1'000'000);
printf("-- %lld %f\r\n", stamp, (float)value);
// printf("--simulateTrigger %lld %f\r\n", stamp, (float)value);
// convert into mcu-adc voltage
value = minF(maxF(value / voltageDiv, 0), adcMaxVoltage);
if (trigAdcState.curAdcMode == TRIGGER_ADC_EXTI) {
@ -53,7 +53,7 @@ static void simulateTrigger(TriggerAdcDetector &trigAdcState, CsvReader &reader,
logicValue = value > Vih;
// we need at least two values to detect an edge
if (prevLogicValue != -1) {
printf("--> DIGITAL %d %d\r\n", logicValue, prevLogicValue);
// printf("--> DIGITAL %d %d\r\n", logicValue, prevLogicValue);
trigAdcState.digitalCallback(stampUs, true, logicValue > prevLogicValue ? true : false);
}
@ -62,7 +62,7 @@ static void simulateTrigger(TriggerAdcDetector &trigAdcState, CsvReader &reader,
} else if (trigAdcState.curAdcMode == TRIGGER_ADC_ADC) {
triggerAdcSample_t sampleValue = value * ADC_MAX_VALUE / adcMaxVoltage;
printf("--> ANALOG %d\r\n", sampleValue);
// printf("--> ANALOG %d\r\n", sampleValue);
trigAdcState.analogCallback(stampUs, sampleValue);
}