SD card - log every loop, added debug bms 220105/220106 for eniro, display gps ready state on speed screen + number of satellites
This commit is contained in:
@@ -1128,21 +1128,23 @@ void Board320_240::redrawScreen() {
|
|||||||
// 1. Auto mode = >5kpm Screen 3 - speed, other wise basic Screen2 - Main screen, if charging then Screen 5 Graph
|
// 1. Auto mode = >5kpm Screen 3 - speed, other wise basic Screen2 - Main screen, if charging then Screen 5 Graph
|
||||||
if (displayScreen == SCREEN_AUTO) {
|
if (displayScreen == SCREEN_AUTO) {
|
||||||
if (liveData->params.speedKmh > 5) {
|
if (liveData->params.speedKmh > 5) {
|
||||||
if (displayScreenAutoMode != 3) {
|
if (displayScreenAutoMode != SCREEN_SPEED) {
|
||||||
displayScreenAutoMode = 3;
|
displayScreenAutoMode = SCREEN_SPEED;
|
||||||
}
|
}
|
||||||
drawSceneSpeed();
|
drawSceneSpeed();
|
||||||
} else if (liveData->params.batPowerKw > 1) {
|
} else if (liveData->params.batPowerKw > 1) {
|
||||||
if (displayScreenAutoMode != 5) {
|
if (displayScreenAutoMode != SCREEN_CHARGING) {
|
||||||
displayScreenAutoMode = 5;
|
displayScreenAutoMode = SCREEN_CHARGING;
|
||||||
}
|
}
|
||||||
drawSceneChargingGraph();
|
drawSceneChargingGraph();
|
||||||
} else {
|
} else {
|
||||||
if (displayScreenAutoMode != 2) {
|
if (displayScreenAutoMode != SCREEN_DASH) {
|
||||||
displayScreenAutoMode = 2;
|
displayScreenAutoMode = SCREEN_DASH;
|
||||||
}
|
}
|
||||||
drawSceneMain();
|
drawSceneMain();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
displayScreenAutoMode = SCREEN_DASH;
|
||||||
}
|
}
|
||||||
// 2. Main screen
|
// 2. Main screen
|
||||||
if (displayScreen == SCREEN_DASH) {
|
if (displayScreen == SCREEN_DASH) {
|
||||||
@@ -1174,9 +1176,8 @@ void Board320_240::redrawScreen() {
|
|||||||
// SDCARD recording
|
// SDCARD recording
|
||||||
/*liveData->params.sdcardRecording*/
|
/*liveData->params.sdcardRecording*/
|
||||||
if (liveData->settings.sdcardEnabled == 1) {
|
if (liveData->settings.sdcardEnabled == 1) {
|
||||||
spr.fillCircle(310, 10, 4, TFT_BLACK);
|
spr.fillCircle((displayScreen == SCREEN_SPEED || displayScreenAutoMode == SCREEN_SPEED) ? 160 : 310, 10, 4, TFT_BLACK);
|
||||||
|
spr.fillCircle((displayScreen == SCREEN_SPEED || displayScreenAutoMode == SCREEN_SPEED) ? 160 : 310, 10, 3,
|
||||||
spr.fillCircle(310, 10, 3,
|
|
||||||
(liveData->params.sdcardInit == 1) ?
|
(liveData->params.sdcardInit == 1) ?
|
||||||
(liveData->params.sdcardRecording) ?
|
(liveData->params.sdcardRecording) ?
|
||||||
(strlen(liveData->params.sdcardFilename) != 0) ?
|
(strlen(liveData->params.sdcardFilename) != 0) ?
|
||||||
@@ -1186,6 +1187,15 @@ void Board320_240::redrawScreen() {
|
|||||||
TFT_YELLOW /* failed to initialize sdcard */
|
TFT_YELLOW /* failed to initialize sdcard */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (gpsHwUart != NULL && (displayScreen == SCREEN_SPEED || displayScreenAutoMode == SCREEN_SPEED)) {
|
||||||
|
spr.drawCircle(180, 10, 5, (gps.location.isValid()) ? TFT_GREEN : TFT_RED);
|
||||||
|
spr.setTextSize(1);
|
||||||
|
spr.setTextColor((gps.location.isValid()) ? TFT_GREEN : TFT_WHITE, TFT_BLACK);
|
||||||
|
spr.setTextDatum(TL_DATUM);
|
||||||
|
sprintf(tmpStr1, "%d", liveData->params.gpsSat);
|
||||||
|
spr.drawString(tmpStr1, 194, 2, 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// BLE not connected
|
// BLE not connected
|
||||||
if (!liveData->bleConnected && liveData->bleConnect) {
|
if (!liveData->bleConnected && liveData->bleConnect) {
|
||||||
@@ -1197,7 +1207,7 @@ void Board320_240::redrawScreen() {
|
|||||||
spr.drawString("Press middle button to menu.", 0, 200, 2);
|
spr.drawString("Press middle button to menu.", 0, 200, 2);
|
||||||
spr.drawString(APP_VERSION, 0, 220, 2);
|
spr.drawString(APP_VERSION, 0, 220, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
spr.pushSprite(0, 0);
|
spr.pushSprite(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1272,8 +1282,6 @@ void Board320_240::mainLoop() {
|
|||||||
if (liveData->settings.debugScreen == 1 && displayScreen == SCREEN_DEBUG) {
|
if (liveData->settings.debugScreen == 1 && displayScreen == SCREEN_DEBUG) {
|
||||||
debugCommandIndex = (debugCommandIndex >= liveData->commandQueueCount) ? liveData->commandQueueLoopFrom : debugCommandIndex + 1;
|
debugCommandIndex = (debugCommandIndex >= liveData->commandQueueCount) ? liveData->commandQueueLoopFrom : debugCommandIndex + 1;
|
||||||
redrawScreen();
|
redrawScreen();
|
||||||
// log every queue loop (temp)
|
|
||||||
liveData->params.sdcardCanNotify = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,22 +193,21 @@ void BoardInterface::loadSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After setup
|
After setup
|
||||||
*/
|
*/
|
||||||
void BoardInterface::afterSetup() {
|
void BoardInterface::afterSetup() {
|
||||||
|
|
||||||
// Init Comm iterface
|
// Init Comm iterface
|
||||||
if (liveData->settings.commType == COMM_TYPE_OBD2BLE4) {
|
if (liveData->settings.commType == COMM_TYPE_OBD2BLE4) {
|
||||||
commInterface = new CommObd2Ble4();
|
commInterface = new CommObd2Ble4();
|
||||||
} else
|
} else if (liveData->settings.commType == COMM_TYPE_OBD2CAN) {
|
||||||
if (liveData->settings.commType == COMM_TYPE_OBD2CAN) {
|
|
||||||
commInterface = new CommObd2Ble4();
|
commInterface = new CommObd2Ble4();
|
||||||
//commInterface = new CommObd2Can();
|
//commInterface = new CommObd2Can();
|
||||||
}
|
}
|
||||||
//commInterface->initComm(liveData, NULL);
|
//commInterface->initComm(liveData, NULL);
|
||||||
commInterface->connectDevice();
|
commInterface->connectDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Custom commands
|
Custom commands
|
||||||
*/
|
*/
|
||||||
@@ -232,15 +231,15 @@ void BoardInterface::customConsoleCommand(String cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize parameters
|
Serialize parameters
|
||||||
*/
|
*/
|
||||||
bool BoardInterface::serializeParamsToJson(File file, bool inclApiKey) {
|
bool BoardInterface::serializeParamsToJson(File file, bool inclApiKey) {
|
||||||
|
|
||||||
StaticJsonDocument<1500> jsonData;
|
|
||||||
|
|
||||||
if (inclApiKey)
|
StaticJsonDocument<2048> jsonData;
|
||||||
|
|
||||||
|
if (inclApiKey)
|
||||||
jsonData["apiKey"] = liveData->settings.remoteApiKey;
|
jsonData["apiKey"] = liveData->settings.remoteApiKey;
|
||||||
|
|
||||||
jsonData["carType"] = liveData->settings.carType;
|
jsonData["carType"] = liveData->settings.carType;
|
||||||
jsonData["batTotalKwh"] = liveData->params.batteryTotalAvailableKWh;
|
jsonData["batTotalKwh"] = liveData->params.batteryTotalAvailableKWh;
|
||||||
jsonData["currTime"] = liveData->params.currentTime;
|
jsonData["currTime"] = liveData->params.currentTime;
|
||||||
@@ -250,14 +249,14 @@ bool BoardInterface::serializeParamsToJson(File file, bool inclApiKey) {
|
|||||||
jsonData["lat"] = liveData->params.gpsLat;
|
jsonData["lat"] = liveData->params.gpsLat;
|
||||||
jsonData["lon"] = liveData->params.gpsLon;
|
jsonData["lon"] = liveData->params.gpsLon;
|
||||||
jsonData["alt"] = liveData->params.gpsAlt;
|
jsonData["alt"] = liveData->params.gpsAlt;
|
||||||
|
|
||||||
jsonData["socPerc"] = liveData->params.socPerc;
|
jsonData["socPerc"] = liveData->params.socPerc;
|
||||||
jsonData["sohPerc"] = liveData->params.sohPerc;
|
jsonData["sohPerc"] = liveData->params.sohPerc;
|
||||||
jsonData["powKwh100"] = liveData->params.batPowerKwh100;
|
jsonData["powKwh100"] = liveData->params.batPowerKwh100;
|
||||||
jsonData["speedKmh"] = liveData->params.speedKmh;
|
jsonData["speedKmh"] = liveData->params.speedKmh;
|
||||||
jsonData["motorRpm"] = liveData->params.motorRpm;
|
jsonData["motorRpm"] = liveData->params.motorRpm;
|
||||||
jsonData["odoKm"] = liveData->params.odoKm;
|
jsonData["odoKm"] = liveData->params.odoKm;
|
||||||
|
|
||||||
jsonData["batPowKw"] = liveData->params.batPowerKw;
|
jsonData["batPowKw"] = liveData->params.batPowerKw;
|
||||||
jsonData["batPowA"] = liveData->params.batPowerAmp;
|
jsonData["batPowA"] = liveData->params.batPowerAmp;
|
||||||
jsonData["batV"] = liveData->params.batVoltage;
|
jsonData["batV"] = liveData->params.batVoltage;
|
||||||
@@ -265,7 +264,7 @@ bool BoardInterface::serializeParamsToJson(File file, bool inclApiKey) {
|
|||||||
jsonData["cedKwh"] = liveData->params.cumulativeEnergyDischargedKWh;
|
jsonData["cedKwh"] = liveData->params.cumulativeEnergyDischargedKWh;
|
||||||
jsonData["maxChKw"] = liveData->params.availableChargePower;
|
jsonData["maxChKw"] = liveData->params.availableChargePower;
|
||||||
jsonData["maxDisKw"] = liveData->params.availableDischargePower;
|
jsonData["maxDisKw"] = liveData->params.availableDischargePower;
|
||||||
|
|
||||||
jsonData["cellMinV"] = liveData->params.batCellMinV;
|
jsonData["cellMinV"] = liveData->params.batCellMinV;
|
||||||
jsonData["cellMaxV"] = liveData->params.batCellMaxV;
|
jsonData["cellMaxV"] = liveData->params.batCellMaxV;
|
||||||
jsonData["bMinC"] = round(liveData->params.batMinC);
|
jsonData["bMinC"] = round(liveData->params.batMinC);
|
||||||
@@ -282,7 +281,7 @@ bool BoardInterface::serializeParamsToJson(File file, bool inclApiKey) {
|
|||||||
jsonData["auxPerc"] = liveData->params.auxPerc;
|
jsonData["auxPerc"] = liveData->params.auxPerc;
|
||||||
jsonData["auxV"] = liveData->params.auxVoltage;
|
jsonData["auxV"] = liveData->params.auxVoltage;
|
||||||
jsonData["auxA"] = liveData->params.auxCurrentAmp;
|
jsonData["auxA"] = liveData->params.auxCurrentAmp;
|
||||||
|
|
||||||
jsonData["inC"] = liveData->params.indoorTemperature;
|
jsonData["inC"] = liveData->params.indoorTemperature;
|
||||||
jsonData["outC"] = liveData->params.outdoorTemperature;
|
jsonData["outC"] = liveData->params.outdoorTemperature;
|
||||||
jsonData["c1C"] = liveData->params.coolantTemp1C;
|
jsonData["c1C"] = liveData->params.coolantTemp1C;
|
||||||
@@ -297,6 +296,8 @@ bool BoardInterface::serializeParamsToJson(File file, bool inclApiKey) {
|
|||||||
jsonData["tRrC"] = liveData->params.tireRearRightTempC;
|
jsonData["tRrC"] = liveData->params.tireRearRightTempC;
|
||||||
jsonData["tRrBar"] = round(liveData->params.tireRearRightPressureBar * 10) / 10;
|
jsonData["tRrBar"] = round(liveData->params.tireRearRightPressureBar * 10) / 10;
|
||||||
|
|
||||||
|
jsonData["debugData"] = liveData->params.debugData;
|
||||||
|
|
||||||
serializeJson(jsonData, Serial);
|
serializeJson(jsonData, Serial);
|
||||||
serializeJson(jsonData, file);
|
serializeJson(jsonData, file);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,9 +110,14 @@ void CarKiaEniro::parseRowMerged() {
|
|||||||
|
|
||||||
bool tempByte;
|
bool tempByte;
|
||||||
float tempFloat;
|
float tempFloat;
|
||||||
|
String tmpStr;
|
||||||
|
|
||||||
// ABS / ESP + AHB 7D1
|
// ABS / ESP + AHB 7D1
|
||||||
if (liveData->currentAtshRequest.equals("ATSH7D1")) {
|
if (liveData->currentAtshRequest.equals("ATSH7D1")) {
|
||||||
|
// Init debug data
|
||||||
|
tmpStr = "";
|
||||||
|
tmpStr.toCharArray(liveData->params.debugData, tmpStr.length() + 1);
|
||||||
|
//
|
||||||
if (liveData->commandRequest.equals("22C101")) {
|
if (liveData->commandRequest.equals("22C101")) {
|
||||||
uint8_t driveMode = liveData->hexToDecFromResponse(22, 24, 1, false);
|
uint8_t driveMode = liveData->hexToDecFromResponse(22, 24, 1, false);
|
||||||
liveData->params.forwardDriveMode = (driveMode == 4);
|
liveData->params.forwardDriveMode = (driveMode == 4);
|
||||||
@@ -158,8 +163,7 @@ void CarKiaEniro::parseRowMerged() {
|
|||||||
if (liveData->commandRequest.equals("22B002")) {
|
if (liveData->commandRequest.equals("22B002")) {
|
||||||
tempFloat = liveData->params.odoKm;
|
tempFloat = liveData->params.odoKm;
|
||||||
liveData->params.odoKm = liveData->decFromResponse(18, 24);
|
liveData->params.odoKm = liveData->decFromResponse(18, 24);
|
||||||
if (tempFloat != liveData->params.odoKm)
|
//if (tempFloat != liveData->params.odoKm) liveData->params.sdcardCanNotify = true;
|
||||||
liveData->params.sdcardCanNotify = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,8 +257,7 @@ void CarKiaEniro::parseRowMerged() {
|
|||||||
liveData->params.socPercPrevious = liveData->params.socPerc;
|
liveData->params.socPercPrevious = liveData->params.socPerc;
|
||||||
liveData->params.sohPerc = liveData->hexToDecFromResponse(56, 60, 2, false) / 10.0;
|
liveData->params.sohPerc = liveData->hexToDecFromResponse(56, 60, 2, false) / 10.0;
|
||||||
liveData->params.socPerc = liveData->hexToDecFromResponse(68, 70, 1, false) / 2.0;
|
liveData->params.socPerc = liveData->hexToDecFromResponse(68, 70, 1, false) / 2.0;
|
||||||
if (liveData->params.socPercPrevious != liveData->params.socPerc)
|
// if (liveData->params.socPercPrevious != liveData->params.socPerc) liveData->params.sdcardCanNotify = true;
|
||||||
liveData->params.sdcardCanNotify = true;
|
|
||||||
|
|
||||||
// Soc10ced table, record x0% CEC/CED table (ex. 90%->89%, 80%->79%)
|
// Soc10ced table, record x0% CEC/CED table (ex. 90%->89%, 80%->79%)
|
||||||
if (liveData->params.socPercPrevious - liveData->params.socPerc > 0) {
|
if (liveData->params.socPercPrevious - liveData->params.socPerc > 0) {
|
||||||
@@ -273,12 +276,18 @@ void CarKiaEniro::parseRowMerged() {
|
|||||||
for (int i = 30; i < 32; i++) { // ai/aj position
|
for (int i = 30; i < 32; i++) { // ai/aj position
|
||||||
liveData->params.cellVoltage[96 - 30 + i] = liveData->hexToDecFromResponse(14 + (i * 2), 14 + (i * 2) + 2, 1, false) / 50;
|
liveData->params.cellVoltage[96 - 30 + i] = liveData->hexToDecFromResponse(14 + (i * 2), 14 + (i * 2) + 2, 1, false) / 50;
|
||||||
}
|
}
|
||||||
|
// log 220105 to sdcard
|
||||||
|
tmpStr = String(liveData->params.debugData) + liveData->currentAtshRequest + '/' + liveData->commandRequest + '/' + liveData->responseRowMerged + '\n';
|
||||||
|
tmpStr.toCharArray(liveData->params.debugData, tmpStr.length() + 1);
|
||||||
}
|
}
|
||||||
// BMS 7e4
|
// BMS 7e4
|
||||||
if (liveData->commandRequest.equals("220106")) {
|
if (liveData->commandRequest.equals("220106")) {
|
||||||
liveData->params.coolingWaterTempC = liveData->hexToDecFromResponse(14, 16, 1, false);
|
liveData->params.coolingWaterTempC = liveData->hexToDecFromResponse(14, 16, 1, false);
|
||||||
liveData->params.bmsUnknownTempC = liveData->hexToDecFromResponse(18, 20, 1, true);
|
liveData->params.bmsUnknownTempC = liveData->hexToDecFromResponse(18, 20, 1, true);
|
||||||
liveData->params.bmsUnknownTempD = liveData->hexToDecFromResponse(46, 48, 1, true);
|
liveData->params.bmsUnknownTempD = liveData->hexToDecFromResponse(46, 48, 1, true);
|
||||||
|
// log 220106 to sdcard
|
||||||
|
tmpStr = String(liveData->params.debugData) + liveData->currentAtshRequest + '/' + liveData->commandRequest + '/' + liveData->responseRowMerged + '\n';
|
||||||
|
tmpStr.toCharArray(liveData->params.debugData, tmpStr.length() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,9 @@ void LiveData::initParams() {
|
|||||||
params.chargingGraphHeaterTempC[i] = -100;
|
params.chargingGraphHeaterTempC[i] = -100;
|
||||||
params.chargingGraphWaterCoolantTempC[i] = -100;
|
params.chargingGraphWaterCoolantTempC[i] = -100;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
tmpStr = "";
|
||||||
|
tmpStr.toCharArray(params.debugData, tmpStr.length() + 1);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
menuItemsCount = sizeof(menuItemsSource) / sizeof(menuItemsSource[0]);
|
menuItemsCount = sizeof(menuItemsSource) / sizeof(menuItemsSource[0]);
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ typedef struct {
|
|||||||
float soc10odo[11]; // odo history
|
float soc10odo[11]; // odo history
|
||||||
time_t soc10time[11]; // time for avg speed
|
time_t soc10time[11]; // time for avg speed
|
||||||
// additional
|
// additional
|
||||||
|
char debugData[256];
|
||||||
/*
|
/*
|
||||||
uint8_t bmsMainRelay;
|
uint8_t bmsMainRelay;
|
||||||
uint8_t highVoltageCharging;
|
uint8_t highVoltageCharging;
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ bool doNextAtCommand() {
|
|||||||
if (liveData->commandQueueIndex >= liveData->commandQueueCount) {
|
if (liveData->commandQueueIndex >= liveData->commandQueueCount) {
|
||||||
liveData->commandQueueIndex = liveData->commandQueueLoopFrom;
|
liveData->commandQueueIndex = liveData->commandQueueLoopFrom;
|
||||||
board->redrawScreen();
|
board->redrawScreen();
|
||||||
|
// log every queue loop (temp)
|
||||||
|
liveData->params.sdcardCanNotify = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send AT command to obd
|
// Send AT command to obd
|
||||||
|
|||||||
Reference in New Issue
Block a user