Added parsing of BMW i3 params

- added some BMW i3 params parsing
- added rxBuffOffset to liveData
This commit is contained in:
Ján Mátik
2020-12-22 17:47:56 +01:00
parent a98b9b2b52
commit c3421c1b91
2 changed files with 30 additions and 33 deletions

View File

@@ -31,40 +31,12 @@ void CarBmwI3::activateCommandQueue() {
// Loop from (BMW i3) // Loop from (BMW i3)
// BMS // BMS
"ATSH6F1", "ATSH6F1",
"22DDBC" /*, // SOC
"22DD69", // HV_STORM
"22DDB4", // HV_SPANNUNG
"22DDBC" // SOC
// VMCU
"ATSH7E2",
"2101",
// speed, ...
"2102",
// aux, ...
//"ATSH7Df",
//"2106",
//"220106",
// Aircondition
// IONIQ OK
"ATSH7B3",
"220100",
// in/out temp
"220102",
// coolant temp1, 2
// BCM / TPMS
// IONIQ OK
"ATSH7A0",
"22c00b",
// tire pressure/temp
// CLUSTER MODULE
// IONIQ OK
"ATSH7C6",
"22B002",
// odo
*/
}; };
// 28kWh version // 28kWh version
@@ -82,6 +54,7 @@ void CarBmwI3::activateCommandQueue() {
liveData->commandQueueLoopFrom = commandQueueLoopFrom; liveData->commandQueueLoopFrom = commandQueueLoopFrom;
liveData->commandQueueCount = commandQueue.size(); liveData->commandQueueCount = commandQueue.size();
liveData->rxBuffOffset = 1; // there is one additional byte in received packets compared to other cars
} }
/** /**
@@ -89,7 +62,29 @@ void CarBmwI3::activateCommandQueue() {
*/ */
void CarBmwI3::parseRowMerged() void CarBmwI3::parseRowMerged()
{ {
Serial.println("--Parsing row merged: ");
Serial.print("--responseRowMerged: "); Serial.println(liveData->responseRowMerged);
Serial.print("--currentAtshRequest: "); Serial.println(liveData->currentAtshRequest);
Serial.print("--commandRequest: "); Serial.println(liveData->commandRequest);
Serial.print("--mergedLength: "); Serial.println(liveData->responseRowMerged.length());
if (liveData->responseRowMerged.length() <= 6) {
Serial.println("--too short data, skiping processing");
}
// BMS
if (liveData->currentAtshRequest.equals("ATSH6F1")) {
if (liveData->commandRequest.equals("22DD69")) {
liveData->params.batPowerAmp = - liveData->hexToDecFromResponse(6, 14, 4, true) / 100.0;
}
if (liveData->commandRequest.equals("22DDB4")) { // HV_SPANNUNG_BATTERIE
liveData->params.batVoltage = liveData->hexToDecFromResponse(6, 10, 2, false) / 100.0;
}
if (liveData->commandRequest.equals("22DDBC")) {
liveData->params.socPerc = liveData->hexToDecFromResponse(6, 10, 2, false) / 10.0;
}
}
} }
@@ -101,4 +96,3 @@ void CarBmwI3::loadTestData()
} }

View File

@@ -226,6 +226,9 @@ class LiveData {
BLEClient* pClient; BLEClient* pClient;
BLEScan* pBLEScan; BLEScan* pBLEScan;
// Canbus
uint8_t rxBuffOffset = 0; // offset of processing received data, in some cars needs to be set to 1, like in BMW i3
// Params // Params
PARAMS_STRUC params; // Realtime sensor values PARAMS_STRUC params; // Realtime sensor values
// Settings // Settings