odb analyzer

This commit is contained in:
Lubos Petrovic
2020-11-12 07:57:54 +01:00
parent b1588db758
commit eff51759bc
5 changed files with 82 additions and 16 deletions

View File

@@ -48,6 +48,8 @@ Screen list
### v1.7.3 2020-11-11 ### v1.7.3 2020-11-11
- Headlights reminder (if drive mode & headlights are off) - Headlights reminder (if drive mode & headlights are off)
- ODB response analyzer. Please help community to decode unknown values like BMS valves, heater ON switch,...
https://docs.google.com/spreadsheets/d/1eT2R8hmsD1hC__9LtnkZ3eDjLcdib9JR-3Myc97jy8M/edit?usp=sharing
### v1.7.2 2020-11-10 ### v1.7.2 2020-11-10
- improved charging graph - improved charging graph

View File

@@ -96,15 +96,15 @@ String commandQueueDebugObd2Kia[commandQueueCountDebugObd2Kia] = {
// 7A5 7AD SMK B UDS Smart Key // 7A5 7AD SMK B UDS Smart Key
"ATSH7A5", "ATSH7A5",
"22B001", // 7F2278 7F2231 "22B001", // 7F2278 7F2231
"22B002", // 0B2 0014320007120A0A1910E016800403320503090A1E32320205320F0014051E010000000002000000000001020000001000000000000000000000000000000000000000AAAAAA "22B002", // positive
"22B003", // 019 62B003000000003412900200000000E6A21221000000009F2FAAAA "22B003", // positive
"22B004", // 7F2278 7F2231 "22B004", // 7F2278 7F2231
"22B005", // 010 62B005FA6090001C04C001E000000004AAAAAAAA "22B005", // positive
"22B006", // 7F2278 017 62B006AFE00000A40000000000A4A4A500A40000000000AAAAAAAA "22B006", // positive
"22B007", // 011 62B0071E7FB80000E600007FFF00000000AAAAAA "22B007", // positive
"22B008", // 7F2278 011 62B0080000000000000009000000000000AAAAAA "22B008", // positive
"22B009", // 7F2278 021 62B009000000000000000000000000000000000000000000000000000000000000AA "22B009", // positive
"22B00A", // 7F2278 013 62B00A0000F038000501080600000021010000AA "22B00A", // positive
// 7B3 7BB AIRCON / ACU UDS Aircondition // 7B3 7BB AIRCON / ACU UDS Aircondition
"ATSH7B3", "ATSH7B3",

View File

@@ -21,9 +21,9 @@ String commandQueueKiaENiro[commandQueueCountKiaENiro] = {
// BMS // BMS
"ATSH7E4", "ATSH7E4",
"220101", // power kw, ... "220101", // power kw, ...
"220102", // cell voltages, screen 3 only "220102", // cell voltages
"220103", // cell voltages, screen 3 only "220103", // cell voltages
"220104", // cell voltages, screen 3 only "220104", // cell voltages
"220105", // soh, soc, .. "220105", // soh, soc, ..
"220106", // cooling water temp "220106", // cooling water temp

Binary file not shown.

View File

@@ -101,8 +101,8 @@ char tmpStr3[20];
char tmpStr4[20]; char tmpStr4[20];
// Screens, buttons // Screens, buttons
#define displayScreenCount 6 #define displayScreenCount 7
byte displayScreen = 1; // 0 - blank screen, 1 - automatic mode, 2 - dash board (default), 3 - big speed + kwh/100, 4 - battery cells, 5 - charging graph, 6 - soc10% CED table byte displayScreen = 1; // 0 - blank screen, 1 - automatic mode, 2 - dash board (default), 3 - big speed + kwh/100, 4 - battery cells, 5 - charging graph, 6 - soc10% CED table, 7 - debug screen
byte displayScreenAutoMode = 0; byte displayScreenAutoMode = 0;
bool btnLeftPressed = true; bool btnLeftPressed = true;
bool btnMiddlePressed = true; bool btnMiddlePressed = true;
@@ -180,6 +180,14 @@ MENU_ITEM menuItems[menuItemsCount] = {
{10009, 9999, -1, "-"}, {10009, 9999, -1, "-"},
}; };
// debug screen - move with right button
uint16_t debugCommandIndex = 0;
String debugAtshRequest = "ATSH7E4";
String debugCommandRequest = "220101";
String debugLastString = "620101FFF7E7FF99000000000300B10EFE120F11100F12000018C438C30B00008400003864000035850000153A00001374000647010D017F0BDA0BDA03E8";
String debugPreviousString = "620101FFF7E7FFB3000000000300120F9B111011101011000014CC38CB3B00009100003A510000367C000015FB000013D3000690250D018E0000000003E8";
/** /**
Load settings from flash memory, upgrade structure if version differs Load settings from flash memory, upgrade structure if version differs
*/ */
@@ -268,6 +276,7 @@ bool loadSettings() {
if (settings.carType == CAR_DEBUG_OBD2_KIA) { if (settings.carType == CAR_DEBUG_OBD2_KIA) {
activateCommandQueueForDebugObd2Kia(); activateCommandQueueForDebugObd2Kia();
} }
debugCommandIndex = commandQueueLoopFrom;
return true; return true;
} }
@@ -718,7 +727,7 @@ bool drawSceneSpeed(bool force) {
tft.drawString(tmpStr3, 250, 80, GFXFF); tft.drawString(tmpStr3, 250, 80, GFXFF);
//sprintf(tmpStr3, " %d", params.driveMode); //sprintf(tmpStr3, " %d", params.driveMode);
//tft.drawString(tmpStr3, 250, 80, GFXFF); //tft.drawString(tmpStr3, 250, 80, GFXFF);
// Soc%, bat.kWh // Soc%, bat.kWh
tft.setFreeFont(&Orbitron_Light_32); tft.setFreeFont(&Orbitron_Light_32);
tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setTextColor(TFT_WHITE, TFT_BLACK);
@@ -943,7 +952,7 @@ bool drawSceneChargingGraph(bool force) {
} }
/** /**
SOC 10% table (screen 5) SOC 10% table (screen 5)
*/ */
bool drawSceneSoc10Table(bool force) { bool drawSceneSoc10Table(bool force) {
@@ -1031,6 +1040,42 @@ bool drawSceneSoc10Table(bool force) {
return true; return true;
} }
/**
DEBUG screen
*/
bool drawSceneDebug(bool force) {
int32_t posx, posy;
String chHex, chHex2;
uint8_t chByte;
tft.setTextSize(1); // Size for small 5x7 font
tft.setTextColor(TFT_SILVER, TFT_TEMP);
tft.setTextDatum(TL_DATUM);
tft.drawString(debugAtshRequest, 0, 0, 2);
tft.drawString(debugCommandRequest, 128, 0, 2);
tft.setTextDatum(TR_DATUM);
for (int i = 0; i < debugLastString.length() / 2; i++) {
chHex = debugLastString.substring(i * 2, (i * 2) + 2);
chHex2 = debugPreviousString.substring(i * 2, (i * 2) + 2);
tft.setTextColor(((chHex.equals(chHex2)) ? TFT_SILVER : TFT_GREEN), TFT_TEMP);
chByte = hexToDec(chHex.c_str(), 1, false);
posx = (((i) % 10) * 32) + 24;
posy = ((floor((i) / 10)) * 32) + 24;
sprintf(tmpStr1, "%03d", chByte);
tft.drawString(tmpStr1, posx + 4, posy, 2);
tft.setTextColor(TFT_YELLOW, TFT_TEMP);
sprintf(tmpStr1, "%c", (char)chByte);
tft.drawString(tmpStr1, posx + 4, posy + 13, 2);
}
debugPreviousString = debugLastString;
return true;
}
/** /**
Modify caption Modify caption
*/ */
@@ -1258,6 +1303,10 @@ bool redrawScreen(bool force) {
if (displayScreen == 6) { if (displayScreen == 6) {
drawSceneSoc10Table(force); drawSceneSoc10Table(force);
} }
// 7. DEBUG SCREEN
if (displayScreen == 7) {
drawSceneDebug(force);
}
// BLE not connected // BLE not connected
if (!bleConnected && bleConnect) { if (!bleConnected && bleConnect) {
@@ -1326,6 +1375,16 @@ bool parseRowMerged() {
Serial.print("merged:"); Serial.print("merged:");
Serial.println(responseRowMerged); Serial.println(responseRowMerged);
// Catch output for debug screen
if (displayScreen == 7) {
if (debugCommandIndex == commandQueueIndex) {
debugAtshRequest = currentAtshRequest;
debugCommandRequest = commandRequest;
debugLastString = responseRowMerged;
}
}
// Parse by car
if (settings.carType == CAR_KIA_ENIRO_2020_64 || settings.carType == CAR_HYUNDAI_KONA_2020_64 || if (settings.carType == CAR_KIA_ENIRO_2020_64 || settings.carType == CAR_HYUNDAI_KONA_2020_64 ||
settings.carType == CAR_KIA_ENIRO_2020_39 || settings.carType == CAR_HYUNDAI_KONA_2020_39) { settings.carType == CAR_KIA_ENIRO_2020_39 || settings.carType == CAR_HYUNDAI_KONA_2020_39) {
parseRowMergedKiaENiro(); parseRowMergedKiaENiro();
@@ -1467,7 +1526,7 @@ class MySecurity : public BLESecurityCallbacks {
/** /**
Ble notification callback Ble notification callback
*/ */
static void notifyCallback (BLERemoteCharacteristic* pBLERemoteCharacteristic, uint8_t* pData, size_t length, bool isNotify) { static void notifyCallback (BLERemoteCharacteristic * pBLERemoteCharacteristic, uint8_t* pData, size_t length, bool isNotify) {
char ch; char ch;
@@ -1771,6 +1830,11 @@ void loop() {
menuMove(true); menuMove(true);
} else { } else {
// doAction // doAction
if (displayScreen == 7) {
debugCommandIndex = (debugCommandIndex >= commandQueueCount) ? commandQueueLoopFrom : debugCommandIndex +1;
redrawScreen(true);
}
} }
} }
} }