Nissan VVT trigger decoder #2887
This commit is contained in:
parent
24cfbeba35
commit
c75dd65b56
|
@ -41,26 +41,25 @@ void CsvReader::processLine(EngineTestHelper *eth) {
|
|||
char *line = buffer;
|
||||
|
||||
char *timeStampstr = trim(strtok(line, s));
|
||||
bool newState[2];
|
||||
|
||||
bool newState[TRIGGER_INPUT_PIN_COUNT];
|
||||
bool newVvtState[CAM_INPUTS_COUNT];
|
||||
char *firstToken = trim(strtok(NULL, s));
|
||||
char *secondToken = trim(strtok(NULL, s));
|
||||
|
||||
for (size_t i = 0;i<m_triggerCount;i++) {
|
||||
char * triggerToken = trim(strtok(NULL, s));
|
||||
newState[columnIndeces[i]] = triggerToken[0] == '1';
|
||||
}
|
||||
|
||||
for (size_t i = 0;i<m_vvtCount;i++) {
|
||||
char *vvtToken = trim(strtok(NULL, s));
|
||||
newVvtState[i] = vvtToken[0] == '1';
|
||||
}
|
||||
|
||||
if (timeStampstr == nullptr) {
|
||||
firmwareError(OBD_PCM_Processor_Fault, "End of File");
|
||||
return;
|
||||
}
|
||||
|
||||
newState[columnIndeces[0]] = firstToken[0] == '1';
|
||||
if (secondToken != nullptr && m_triggerCount > 1) {
|
||||
newState[columnIndeces[1]] = secondToken[0] == '1';
|
||||
}
|
||||
|
||||
// todo: start reading states much smarter, start reading all 4 cam channels!
|
||||
if (m_vvtCount > 0) {
|
||||
newVvtState[0] = secondToken[0] == '1';
|
||||
}
|
||||
|
||||
double timeStamp = std::stod(timeStampstr);
|
||||
|
||||
timeStamp += m_timestampOffset;
|
||||
|
|
Loading…
Reference in New Issue