can sorting
This commit is contained in:
@@ -222,6 +222,9 @@ bool CommObd2Can::processFrame() {
|
|||||||
// First frame
|
// First frame
|
||||||
case 1:
|
case 1:
|
||||||
rxRemaining = ((rxBuf[0] & 0x0f) << 8) + rxBuf[1] + 1;
|
rxRemaining = ((rxBuf[0] & 0x0f) << 8) + rxBuf[1] + 1;
|
||||||
|
liveData->responseRowMerged = "";
|
||||||
|
for (uint16_t i = 0; i < 62; i++)
|
||||||
|
liveData->responseRowMerged += "00";
|
||||||
liveData->responseRow = "0:";
|
liveData->responseRow = "0:";
|
||||||
start = 2;
|
start = 2;
|
||||||
break;
|
break;
|
||||||
@@ -249,7 +252,19 @@ bool CommObd2Can::processFrame() {
|
|||||||
Serial.print(rxRemaining);
|
Serial.print(rxRemaining);
|
||||||
Serial.println(" ");
|
Serial.println(" ");
|
||||||
|
|
||||||
parseResponse();
|
//parseResponse();
|
||||||
|
// We need to sort frames
|
||||||
|
// 1 frame data
|
||||||
|
Serial.println(liveData->responseRow);
|
||||||
|
// Merge frames 0:xxxx 1:yyyy 2:zzzz to single response xxxxyyyyzzzz string
|
||||||
|
if (liveData->responseRow.length() >= 2 && liveData->responseRow.charAt(1) == ':') {
|
||||||
|
//liveData->responseRowMerged += liveData->responseRow.substring(2);
|
||||||
|
uint8_t rowNo = liveData->hexToDec(liveData->responseRow.substring(0, 1), 1, false);
|
||||||
|
uint16_t startPos = (rowNo * 14) - ((rowNo > 0) ? 2 : 0);
|
||||||
|
uint16_t endPos = ((rowNo + 1) * 14) - ((rowNo > 0) ? 2 : 0);
|
||||||
|
liveData->responseRowMerged = liveData->responseRowMerged.substring(0, startPos) + liveData->responseRow.substring(2) + liveData->responseRowMerged.substring(endPos);
|
||||||
|
Serial.println(liveData->responseRowMerged);
|
||||||
|
}
|
||||||
|
|
||||||
// Send command to board module (obd2 simulation)
|
// Send command to board module (obd2 simulation)
|
||||||
if (rxRemaining <= 0) {
|
if (rxRemaining <= 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user