let's try again
This commit is contained in:
parent
d16326dffe
commit
bdffec4ce5
|
@ -985,9 +985,9 @@ static void calculateTriggerSynchPoint(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerCentral::updateWaveform() {
|
TriggerDecoderBase initState("init");
|
||||||
static TriggerDecoderBase initState("init");
|
|
||||||
|
|
||||||
|
void TriggerCentral::updateWaveform() {
|
||||||
// Re-read config in case it's changed
|
// Re-read config in case it's changed
|
||||||
primaryTriggerConfiguration.update();
|
primaryTriggerConfiguration.update();
|
||||||
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
|
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ using ::testing::_;
|
||||||
|
|
||||||
extern WarningCodeState unitTestWarningCodeState;
|
extern WarningCodeState unitTestWarningCodeState;
|
||||||
extern bool printTriggerDebug;
|
extern bool printTriggerDebug;
|
||||||
|
extern float actualSynchGap;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void sendOutConfirmation(char *value, int i);
|
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) {
|
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);
|
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());
|
assertEqualsM("synchPointIndex", synchPointIndex, t->getTriggerWaveformSynchPointIndex());
|
||||||
if (!cisnan(expectedGapRatio)) {
|
if (!cisnan(expectedGapRatio)) {
|
||||||
assertEqualsM2("actual gap ratio", expectedGapRatio, engine->triggerCentral.triggerState.triggerSyncGapRatio, 0.001);
|
assertEqualsM2("actual gap ratio", expectedGapRatio, initState.triggerSyncGapRatio, 0.001);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ static void simulateTrigger(TriggerAdcDetector &trigAdcState, CsvReader &reader,
|
||||||
double value = 0;
|
double value = 0;
|
||||||
double stamp = reader.readTimestampAndValues(&value);
|
double stamp = reader.readTimestampAndValues(&value);
|
||||||
efitick_t stampUs = (efitick_t)(stamp * 1'000'000);
|
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
|
// convert into mcu-adc voltage
|
||||||
value = minF(maxF(value / voltageDiv, 0), adcMaxVoltage);
|
value = minF(maxF(value / voltageDiv, 0), adcMaxVoltage);
|
||||||
if (trigAdcState.curAdcMode == TRIGGER_ADC_EXTI) {
|
if (trigAdcState.curAdcMode == TRIGGER_ADC_EXTI) {
|
||||||
|
@ -53,7 +53,7 @@ static void simulateTrigger(TriggerAdcDetector &trigAdcState, CsvReader &reader,
|
||||||
logicValue = value > Vih;
|
logicValue = value > Vih;
|
||||||
// we need at least two values to detect an edge
|
// we need at least two values to detect an edge
|
||||||
if (prevLogicValue != -1) {
|
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);
|
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) {
|
} else if (trigAdcState.curAdcMode == TRIGGER_ADC_ADC) {
|
||||||
triggerAdcSample_t sampleValue = value * ADC_MAX_VALUE / adcMaxVoltage;
|
triggerAdcSample_t sampleValue = value * ADC_MAX_VALUE / adcMaxVoltage;
|
||||||
|
|
||||||
printf("--> ANALOG %d\r\n", sampleValue);
|
// printf("--> ANALOG %d\r\n", sampleValue);
|
||||||
|
|
||||||
trigAdcState.analogCallback(stampUs, sampleValue);
|
trigAdcState.analogCallback(stampUs, sampleValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue