refactoring - explicit read method

This commit is contained in:
Andrey 2021-06-26 22:07:26 -04:00
parent cd055a687d
commit a5eeb19c4d
4 changed files with 14 additions and 7 deletions

View File

@ -391,9 +391,9 @@ void Engine::OnTriggerStateDecodingError() {
triggerCentral.triggerState.currentCycle.eventCount[0],
triggerCentral.triggerState.currentCycle.eventCount[1],
triggerCentral.triggerState.currentCycle.eventCount[2],
TRIGGER_WAVEFORM(expectedEventCount[0]),
TRIGGER_WAVEFORM(expectedEventCount[1]),
TRIGGER_WAVEFORM(expectedEventCount[2]));
TRIGGER_WAVEFORM(getExpectedEventCount(0)),
TRIGGER_WAVEFORM(getExpectedEventCount(1)),
TRIGGER_WAVEFORM(getExpectedEventCount(2)));
triggerCentral.triggerState.setTriggerErrorState();
@ -402,9 +402,9 @@ void Engine::OnTriggerStateDecodingError() {
#if EFI_PROD_CODE
efiPrintf("error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
triggerCentral.triggerState.currentCycle.current_index,
TRIGGER_WAVEFORM(expectedEventCount[0]),
TRIGGER_WAVEFORM(expectedEventCount[1]),
TRIGGER_WAVEFORM(expectedEventCount[2]),
TRIGGER_WAVEFORM(getExpectedEventCount(0)),
TRIGGER_WAVEFORM(getExpectedEventCount(1)),
TRIGGER_WAVEFORM(getExpectedEventCount(2)),
triggerCentral.triggerState.currentCycle.eventCount[0],
triggerCentral.triggerState.currentCycle.eventCount[1],
triggerCentral.triggerState.currentCycle.eventCount[2]);

View File

@ -183,6 +183,10 @@ operation_mode_e TriggerWaveform::getOperationMode() const {
extern bool printTriggerDebug;
#endif
int TriggerWaveform::getExpectedEventCount(int channelIndex) {
return expectedEventCount[channelIndex];
}
void TriggerWaveform::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
if (!useOnlyRisingEdgeForTrigger) {
for (size_t i = 0; i < efi::size(expectedEventCount); i++) {

View File

@ -178,6 +178,8 @@ public:
void calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger);
int getExpectedEventCount(int channelIndex);
/**
* This is used for signal validation
*/
@ -321,6 +323,6 @@ void findTriggerPosition(
void setToothedWheelConfiguration(TriggerWaveform *s, int total, int skipped, operation_mode_e operationMode);
#define TRIGGER_WAVEFORM(x) ENGINE(triggerCentral.triggerShape.x)
#define TRIGGER_WAVEFORM(x) ENGINE(triggerCentral.triggerShape).x
#define getTriggerSize() TRIGGER_WAVEFORM(privateTriggerDefinitionSize)

View File

@ -21,6 +21,7 @@ static char* trim(char *str) {
}
void CsvReader::open(const char *fileName, int *columnIndeces) {
printf("Reading from %s\r\n", fileName);
fp = fopen(fileName, "r");
this->columnIndeces = columnIndeces;
ASSERT_TRUE(fp != nullptr);