Ioniq 2018
This commit is contained in:
@@ -17,7 +17,7 @@ String commandQueueHyundaiIoniq[commandQueueCountHyundaiIoniq] = {
|
|||||||
|
|
||||||
// Loop from (HYUNDAI IONIQ)
|
// Loop from (HYUNDAI IONIQ)
|
||||||
// BMS
|
// BMS
|
||||||
"atsh7e4",
|
"ATSH7E4",
|
||||||
"2101", // power kw, ...
|
"2101", // power kw, ...
|
||||||
"2102", // cell voltages, screen 3 only
|
"2102", // cell voltages, screen 3 only
|
||||||
"2103", // cell voltages, screen 3 only
|
"2103", // cell voltages, screen 3 only
|
||||||
@@ -26,28 +26,28 @@ String commandQueueHyundaiIoniq[commandQueueCountHyundaiIoniq] = {
|
|||||||
"2106", // cooling water temp
|
"2106", // cooling water temp
|
||||||
|
|
||||||
// VMCU
|
// VMCU
|
||||||
"atsh7e2",
|
"ATSH7E2",
|
||||||
"2101", // speed, ...
|
"2101", // speed, ...
|
||||||
"2102", // aux, ...
|
"2102", // aux, ...
|
||||||
|
|
||||||
//"atsh7df",
|
//"ATSH7Df",
|
||||||
//"2106",
|
//"2106",
|
||||||
//"220106",
|
//"220106",
|
||||||
|
|
||||||
// ECU - Aircondition
|
// ECU - Aircondition
|
||||||
// IONIQ OK
|
// IONIQ OK
|
||||||
"atsh7b3",
|
"ATSH7B3",
|
||||||
"220100", // in/out temp
|
"220100", // in/out temp
|
||||||
"220102", // coolant temp1, 2
|
"220102", // coolant temp1, 2
|
||||||
|
|
||||||
// BCM / TPMS
|
// BCM / TPMS
|
||||||
// IONIQ OK
|
// IONIQ OK
|
||||||
"atsh7a0",
|
"ATSH7A0",
|
||||||
"22c00b", // tire pressure/temp
|
"22c00b", // tire pressure/temp
|
||||||
|
|
||||||
// CLUSTER MODULE
|
// CLUSTER MODULE
|
||||||
// IONIQ OK
|
// IONIQ OK
|
||||||
"atsh7c6",
|
"ATSH7C6",
|
||||||
"22B002", // odo
|
"22B002", // odo
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,130 +78,138 @@ bool activateCommandQueueForHyundaiIoniq() {
|
|||||||
*/
|
*/
|
||||||
bool parseRowMergedHyundaiIoniq() {
|
bool parseRowMergedHyundaiIoniq() {
|
||||||
|
|
||||||
// VMCU 7e2
|
// VMCU 7E2
|
||||||
if (commandRequest.equals("2101")) {
|
if (currentAtshRequest.equals("ATSH7E2")) {
|
||||||
params.speedKmh = hexToDec(responseRowMerged.substring(32, 36).c_str(), 2, false) * 0.0155; // / 100.0 *1.609 = real to gps is 1.750
|
if (commandRequest.equals("2101")) {
|
||||||
}
|
params.speedKmh = hexToDec(responseRowMerged.substring(32, 36).c_str(), 2, false) * 0.0155; // / 100.0 *1.609 = real to gps is 1.750
|
||||||
// VMCU 7e2
|
}
|
||||||
if (commandRequest.equals("2102")) {
|
if (commandRequest.equals("2102")) {
|
||||||
params.auxPerc = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, false);
|
params.auxPerc = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, false);
|
||||||
params.auxCurrentAmp = - hexToDec(responseRowMerged.substring(46, 50).c_str(), 2, true) / 1000.0;
|
params.auxCurrentAmp = - hexToDec(responseRowMerged.substring(46, 50).c_str(), 2, true) / 1000.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cluster module 7c6
|
// Cluster module 7c6
|
||||||
if (commandRequest.equals("22B002")) {
|
if (currentAtshRequest.equals("ATSH7C6")) {
|
||||||
params.odoKm = float(strtol(responseRowMerged.substring(18, 24).c_str(), 0, 16));
|
if (commandRequest.equals("22B002")) {
|
||||||
|
params.odoKm = float(strtol(responseRowMerged.substring(18, 24).c_str(), 0, 16));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aircon 7b3
|
// Aircon 7b3
|
||||||
// IONIQ OK
|
if (currentAtshRequest.equals("ATSH7B3")) {
|
||||||
if (commandRequest.equals("220100")) {
|
if (commandRequest.equals("220100")) {
|
||||||
params.indoorTemperature = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
params.indoorTemperature = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
||||||
params.outdoorTemperature = (hexToDec(responseRowMerged.substring(18, 20).c_str(), 1, false) / 2) - 40;
|
params.outdoorTemperature = (hexToDec(responseRowMerged.substring(18, 20).c_str(), 1, false) / 2) - 40;
|
||||||
|
}
|
||||||
|
if (commandRequest.equals("220102") && responseRowMerged.substring(12, 14) == "00") {
|
||||||
|
params.coolantTemp1C = (hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false) / 2) - 40;
|
||||||
|
params.coolantTemp2C = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Aircon 7b3
|
|
||||||
// IONIQ OK
|
|
||||||
if (commandRequest.equals("220102") && responseRowMerged.substring(12, 14) == "00") {
|
|
||||||
params.coolantTemp1C = (hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false) / 2) - 40;
|
|
||||||
params.coolantTemp2C = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("2101")) {
|
|
||||||
params.cumulativeEnergyChargedKWh = float(strtol(responseRowMerged.substring(80, 88).c_str(), 0, 16)) / 10.0;
|
|
||||||
if (params.cumulativeEnergyChargedKWhStart == -1)
|
|
||||||
params.cumulativeEnergyChargedKWhStart = params.cumulativeEnergyChargedKWh;
|
|
||||||
params.cumulativeEnergyDischargedKWh = float(strtol(responseRowMerged.substring(88, 96).c_str(), 0, 16)) / 10.0;
|
|
||||||
if (params.cumulativeEnergyDischargedKWhStart == -1)
|
|
||||||
params.cumulativeEnergyDischargedKWhStart = params.cumulativeEnergyDischargedKWh;
|
|
||||||
params.auxVoltage = hexToDec(responseRowMerged.substring(62, 64).c_str(), 2, true) / 10.0;
|
|
||||||
params.batPowerAmp = - hexToDec(responseRowMerged.substring(24, 28).c_str(), 2, true) / 10.0;
|
|
||||||
params.batVoltage = hexToDec(responseRowMerged.substring(28, 32).c_str(), 2, false) / 10.0;
|
|
||||||
params.batPowerKw = (params.batPowerAmp * params.batVoltage) / 1000.0;
|
|
||||||
params.batPowerKwh100 = params.batPowerKw / params.speedKmh * 100;
|
|
||||||
params.batCellMaxV = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, false) / 50.0;
|
|
||||||
params.batCellMinV = hexToDec(responseRowMerged.substring(54, 56).c_str(), 1, false) / 50.0;
|
|
||||||
params.batModule01TempC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
|
||||||
params.batModule02TempC = hexToDec(responseRowMerged.substring(38, 40).c_str(), 1, true);
|
|
||||||
params.batModule03TempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 1, true);
|
|
||||||
params.batModule04TempC = hexToDec(responseRowMerged.substring(42, 44).c_str(), 1, true);
|
|
||||||
//params.batTempC = hexToDec(responseRowMerged.substring(34, 36).c_str(), 1, true);
|
|
||||||
//params.batMaxC = hexToDec(responseRowMerged.substring(32, 34).c_str(), 1, true);
|
|
||||||
//params.batMinC = hexToDec(responseRowMerged.substring(34, 36).c_str(), 1, true);
|
|
||||||
|
|
||||||
// This is more accurate than min/max from BMS. It's required to detect kona/eniro cold gates (min 15C is needed > 43kW charging, min 25C is needed > 58kW charging)
|
// BMS 7e4
|
||||||
params.batMinC = params.batMaxC = params.batModule01TempC;
|
if (currentAtshRequest.equals("ATSH7E4")) {
|
||||||
params.batMinC = (params.batModule02TempC < params.batMinC) ? params.batModule02TempC : params.batMinC;
|
if (commandRequest.equals("2101")) {
|
||||||
params.batMinC = (params.batModule03TempC < params.batMinC) ? params.batModule03TempC : params.batMinC;
|
params.cumulativeEnergyChargedKWh = float(strtol(responseRowMerged.substring(80, 88).c_str(), 0, 16)) / 10.0;
|
||||||
params.batMinC = (params.batModule04TempC < params.batMinC) ? params.batModule04TempC : params.batMinC;
|
if (params.cumulativeEnergyChargedKWhStart == -1)
|
||||||
params.batMaxC = (params.batModule02TempC > params.batMaxC) ? params.batModule02TempC : params.batMaxC;
|
params.cumulativeEnergyChargedKWhStart = params.cumulativeEnergyChargedKWh;
|
||||||
params.batMaxC = (params.batModule03TempC > params.batMaxC) ? params.batModule03TempC : params.batMaxC;
|
params.cumulativeEnergyDischargedKWh = float(strtol(responseRowMerged.substring(88, 96).c_str(), 0, 16)) / 10.0;
|
||||||
params.batMaxC = (params.batModule04TempC > params.batMaxC) ? params.batModule04TempC : params.batMaxC;
|
if (params.cumulativeEnergyDischargedKWhStart == -1)
|
||||||
params.batTempC = params.batMinC;
|
params.cumulativeEnergyDischargedKWhStart = params.cumulativeEnergyDischargedKWh;
|
||||||
|
params.auxVoltage = hexToDec(responseRowMerged.substring(62, 64).c_str(), 2, true) / 10.0;
|
||||||
|
params.batPowerAmp = - hexToDec(responseRowMerged.substring(24, 28).c_str(), 2, true) / 10.0;
|
||||||
|
params.batVoltage = hexToDec(responseRowMerged.substring(28, 32).c_str(), 2, false) / 10.0;
|
||||||
|
params.batPowerKw = (params.batPowerAmp * params.batVoltage) / 1000.0;
|
||||||
|
params.batPowerKwh100 = params.batPowerKw / params.speedKmh * 100;
|
||||||
|
params.batCellMaxV = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, false) / 50.0;
|
||||||
|
params.batCellMinV = hexToDec(responseRowMerged.substring(54, 56).c_str(), 1, false) / 50.0;
|
||||||
|
params.batModule01TempC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
||||||
|
params.batModule02TempC = hexToDec(responseRowMerged.substring(38, 40).c_str(), 1, true);
|
||||||
|
params.batModule03TempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 1, true);
|
||||||
|
params.batModule04TempC = hexToDec(responseRowMerged.substring(42, 44).c_str(), 1, true);
|
||||||
|
//params.batTempC = hexToDec(responseRowMerged.substring(34, 36).c_str(), 1, true);
|
||||||
|
//params.batMaxC = hexToDec(responseRowMerged.substring(32, 34).c_str(), 1, true);
|
||||||
|
//params.batMinC = hexToDec(responseRowMerged.substring(34, 36).c_str(), 1, true);
|
||||||
|
|
||||||
params.batInletC = hexToDec(responseRowMerged.substring(48, 50).c_str(), 1, true);
|
// This is more accurate than min/max from BMS. It's required to detect kona/eniro cold gates (min 15C is needed > 43kW charging, min 25C is needed > 58kW charging)
|
||||||
if (params.speedKmh < 15 && params.batPowerKw >= 1 && params.socPerc > 0 && params.socPerc <= 100) {
|
params.batMinC = params.batMaxC = params.batModule01TempC;
|
||||||
params.chargingGraphKw[int(params.socPerc)] = params.batPowerKw;
|
params.batMinC = (params.batModule02TempC < params.batMinC) ? params.batModule02TempC : params.batMinC;
|
||||||
params.chargingGraphMinTempC[int(params.socPerc)] = params.batMinC;
|
params.batMinC = (params.batModule03TempC < params.batMinC) ? params.batModule03TempC : params.batMinC;
|
||||||
params.chargingGraphMaxTempC[int(params.socPerc)] = params.batMaxC;
|
params.batMinC = (params.batModule04TempC < params.batMinC) ? params.batModule04TempC : params.batMinC;
|
||||||
}
|
params.batMaxC = (params.batModule02TempC > params.batMaxC) ? params.batModule02TempC : params.batMaxC;
|
||||||
}
|
params.batMaxC = (params.batModule03TempC > params.batMaxC) ? params.batModule03TempC : params.batMaxC;
|
||||||
// BMS 7e4
|
params.batMaxC = (params.batModule04TempC > params.batMaxC) ? params.batModule04TempC : params.batMaxC;
|
||||||
if (commandRequest.equals("2102") && responseRowMerged.substring(10, 12) == "FF") {
|
params.batTempC = params.batMinC;
|
||||||
for (int i = 0; i < 32; i++) {
|
|
||||||
params.cellVoltage[i] = hexToDec(responseRowMerged.substring(12 + (i * 2), 12 + (i * 2) + 2).c_str(), 1, false) / 50;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("2103")) {
|
|
||||||
for (int i = 0; i < 32; i++) {
|
|
||||||
params.cellVoltage[32 + i] = hexToDec(responseRowMerged.substring(12 + (i * 2), 12 + (i * 2) + 2).c_str(), 1, false) / 50;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("2104")) {
|
|
||||||
for (int i = 0; i < 32; i++) {
|
|
||||||
params.cellVoltage[64 + i] = hexToDec(responseRowMerged.substring(12 + (i * 2), 12 + (i * 2) + 2).c_str(), 1, false) / 50;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("2105")) {
|
|
||||||
params.sohPerc = hexToDec(responseRowMerged.substring(54, 58).c_str(), 2, false) / 10.0;
|
|
||||||
params.socPerc = hexToDec(responseRowMerged.substring(66, 68).c_str(), 1, false) / 2.0;
|
|
||||||
|
|
||||||
// Soc10ced table, record x0% CEC/CED table (ex. 90%->89%, 80%->79%)
|
params.batInletC = hexToDec(responseRowMerged.substring(48, 50).c_str(), 1, true);
|
||||||
if (oldParams.socPerc - params.socPerc > 0) {
|
if (params.speedKmh < 15 && params.batPowerKw >= 1 && params.socPerc > 0 && params.socPerc <= 100) {
|
||||||
byte index = (int(params.socPerc) == 4) ? 0 : (int)(params.socPerc / 10) + 1;
|
params.chargingGraphKw[int(params.socPerc)] = params.batPowerKw;
|
||||||
if ((int(params.socPerc) % 10 == 9 || int(params.socPerc) == 4) && params.soc10ced[index] == -1) {
|
params.chargingGraphMinTempC[int(params.socPerc)] = params.batMinC;
|
||||||
struct tm now;
|
params.chargingGraphMaxTempC[int(params.socPerc)] = params.batMaxC;
|
||||||
getLocalTime(&now, 0);
|
|
||||||
time_t time_now_epoch = mktime(&now);
|
|
||||||
params.soc10ced[index] = params.cumulativeEnergyDischargedKWh;
|
|
||||||
params.soc10cec[index] = params.cumulativeEnergyChargedKWh;
|
|
||||||
params.soc10odo[index] = params.odoKm;
|
|
||||||
params.soc10time[index] = time_now_epoch;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.batHeaterC = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, true);
|
// BMS 7e4
|
||||||
//
|
if (commandRequest.equals("2102") && responseRowMerged.substring(10, 12) == "FF") {
|
||||||
for (int i = 30; i < 32; i++) { // ai/aj position
|
for (int i = 0; i < 32; i++) {
|
||||||
params.cellVoltage[96 - 30 + i] = -1;
|
params.cellVoltage[i] = hexToDec(responseRowMerged.substring(12 + (i * 2), 12 + (i * 2) + 2).c_str(), 1, false) / 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
if (commandRequest.equals("2103")) {
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
params.cellVoltage[32 + i] = hexToDec(responseRowMerged.substring(12 + (i * 2), 12 + (i * 2) + 2).c_str(), 1, false) / 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
if (commandRequest.equals("2104")) {
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
params.cellVoltage[64 + i] = hexToDec(responseRowMerged.substring(12 + (i * 2), 12 + (i * 2) + 2).c_str(), 1, false) / 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
if (commandRequest.equals("2105")) {
|
||||||
|
params.sohPerc = hexToDec(responseRowMerged.substring(54, 58).c_str(), 2, false) / 10.0;
|
||||||
|
params.socPerc = hexToDec(responseRowMerged.substring(66, 68).c_str(), 1, false) / 2.0;
|
||||||
|
|
||||||
|
// Soc10ced table, record x0% CEC/CED table (ex. 90%->89%, 80%->79%)
|
||||||
|
if (oldParams.socPerc - params.socPerc > 0) {
|
||||||
|
byte index = (int(params.socPerc) == 4) ? 0 : (int)(params.socPerc / 10) + 1;
|
||||||
|
if ((int(params.socPerc) % 10 == 9 || int(params.socPerc) == 4) && params.soc10ced[index] == -1) {
|
||||||
|
struct tm now;
|
||||||
|
getLocalTime(&now, 0);
|
||||||
|
time_t time_now_epoch = mktime(&now);
|
||||||
|
params.soc10ced[index] = params.cumulativeEnergyDischargedKWh;
|
||||||
|
params.soc10cec[index] = params.cumulativeEnergyChargedKWh;
|
||||||
|
params.soc10odo[index] = params.odoKm;
|
||||||
|
params.soc10time[index] = time_now_epoch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params.batHeaterC = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, true);
|
||||||
|
//
|
||||||
|
for (int i = 30; i < 32; i++) { // ai/aj position
|
||||||
|
params.cellVoltage[96 - 30 + i] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
// IONIQ FAILED
|
||||||
|
if (commandRequest.equals("2106")) {
|
||||||
|
params.coolingWaterTempC = hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// BMS 7e4
|
|
||||||
// IONIQ FAILED
|
|
||||||
if (commandRequest.equals("2106")) {
|
|
||||||
params.coolingWaterTempC = hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false);
|
|
||||||
}
|
|
||||||
// TPMS 7a0
|
// TPMS 7a0
|
||||||
// IONIQ OK
|
if (currentAtshRequest.equals("ATSH7A0")) {
|
||||||
if (commandRequest.equals("22c00b")) {
|
if (commandRequest.equals("22c00b")) {
|
||||||
params.tireFrontLeftPressureBar = hexToDec(responseRowMerged.substring(14, 16).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
params.tireFrontLeftPressureBar = hexToDec(responseRowMerged.substring(14, 16).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireFrontRightPressureBar = hexToDec(responseRowMerged.substring(22, 24).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
params.tireFrontRightPressureBar = hexToDec(responseRowMerged.substring(22, 24).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireRearRightPressureBar = hexToDec(responseRowMerged.substring(30, 32).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
params.tireRearRightPressureBar = hexToDec(responseRowMerged.substring(30, 32).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireRearLeftPressureBar = hexToDec(responseRowMerged.substring(38, 40).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
params.tireRearLeftPressureBar = hexToDec(responseRowMerged.substring(38, 40).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireFrontLeftTempC = hexToDec(responseRowMerged.substring(16, 18).c_str(), 2, false) - 50; // === OK Valid
|
params.tireFrontLeftTempC = hexToDec(responseRowMerged.substring(16, 18).c_str(), 2, false) - 50; // === OK Valid
|
||||||
params.tireFrontRightTempC = hexToDec(responseRowMerged.substring(24, 26).c_str(), 2, false) - 50; // === OK Valid
|
params.tireFrontRightTempC = hexToDec(responseRowMerged.substring(24, 26).c_str(), 2, false) - 50; // === OK Valid
|
||||||
params.tireRearRightTempC = hexToDec(responseRowMerged.substring(32, 34).c_str(), 2, false) - 50; // === OK Valid
|
params.tireRearRightTempC = hexToDec(responseRowMerged.substring(32, 34).c_str(), 2, false) - 50; // === OK Valid
|
||||||
params.tireRearLeftTempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 2, false) - 50; // === OK Valid
|
params.tireRearLeftTempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 2, false) - 50; // === OK Valid
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -212,99 +220,69 @@ bool parseRowMergedHyundaiIoniq() {
|
|||||||
*/
|
*/
|
||||||
bool testDataHyundaiIoniq() {
|
bool testDataHyundaiIoniq() {
|
||||||
|
|
||||||
// VMCU atsh7e2
|
// VMCU ATSH7E2
|
||||||
|
currentAtshRequest = "ATSH7E2";
|
||||||
// 2101
|
// 2101
|
||||||
commandRequest = "2101";
|
commandRequest = "2101";
|
||||||
//eniro = "6101FFF8000009285A3B0648030000B4179D763404080805000000";
|
|
||||||
responseRowMerged = "6101FFE0000009211222062F03000000001D7734";
|
responseRowMerged = "6101FFE0000009211222062F03000000001D7734";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// VMCU atsh7e2
|
|
||||||
// 2102
|
// 2102
|
||||||
commandRequest = "2102";
|
commandRequest = "2102";
|
||||||
//eniro = "6102F8FFFC000101000000840FBF83BD33270680953033757F59291C76000001010100000007000000";
|
|
||||||
responseRowMerged = "6102FF80000001010000009311AE8C9839640611887C3900000000";
|
responseRowMerged = "6102FF80000001010000009311AE8C9839640611887C3900000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// "atsh7df",
|
// "ATSH7DF",
|
||||||
// 2106
|
currentAtshRequest = "ATSH7DF";
|
||||||
//commandRequest = "2106";
|
|
||||||
//eniro = "6106FFFF800000000000000200001B001C001C000600060006000E000000010000000000000000013D013D013E013E00";
|
|
||||||
//parseRowMergedHyundaiIoniq();
|
|
||||||
|
|
||||||
// AIRCON / ACU atsh7b3
|
// AIRCON / ACU ATSH7B3
|
||||||
|
currentAtshRequest = "ATSH7B3";
|
||||||
// 220100
|
// 220100
|
||||||
commandRequest = "220100";
|
commandRequest = "220100";
|
||||||
//eniro = "6201007E5027C8FF7F765D05B95AFFFF5AFF11FFFFFFFFFFFF6AFFFF2DF0757630FFFF00FFFF000000";
|
|
||||||
responseRowMerged = "6201007E5007C8FF8A876A011010FFFF10FF10FFFFFFFFFFFFFFFFFF2EEF767D00FFFF00FFFF000000";
|
responseRowMerged = "6201007E5007C8FF8A876A011010FFFF10FF10FFFFFFFFFFFFFFFFFF2EEF767D00FFFF00FFFF000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// AIRCON / ACU atsh7b3
|
|
||||||
// 220102
|
// 220102
|
||||||
commandRequest = "220102";
|
commandRequest = "220102";
|
||||||
responseRowMerged = "620102FF800000A3950000000000002600000000";
|
responseRowMerged = "620102FF800000A3950000000000002600000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
|
// BMS ATSH7E4
|
||||||
// BMS atsh7e4
|
currentAtshRequest = "ATSH7E4";
|
||||||
// 220101
|
// 220101
|
||||||
commandRequest = "2101";
|
commandRequest = "2101";
|
||||||
//eniro = "620101FFF7E7FFB3000000000300120F9B111011101011000014CC38CB3B00009100003A510000367C000015FB000013D3000690250D018E0000000003E8";
|
|
||||||
responseRowMerged = "6101FFFFFFFF5026482648A3FFC30D9E181717171718170019B50FB501000090000142230001425F0000771B00007486007815D809015C0000000003E800";
|
responseRowMerged = "6101FFFFFFFF5026482648A3FFC30D9E181717171718170019B50FB501000090000142230001425F0000771B00007486007815D809015C0000000003E800";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// BMS atsh7e4
|
|
||||||
// 220102
|
// 220102
|
||||||
commandRequest = "2102";
|
commandRequest = "2102";
|
||||||
// eniro = "620102FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBAAAA";
|
|
||||||
responseRowMerged = "6102FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
responseRowMerged = "6102FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// BMS atsh7e4
|
|
||||||
// 220103
|
// 220103
|
||||||
commandRequest = "2103";
|
commandRequest = "2103";
|
||||||
//eniro = "620103FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCACBCACACFCCCBCBCBCBCBCBCBCBAAAA";
|
|
||||||
responseRowMerged = "6103FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
responseRowMerged = "6103FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// BMS atsh7e4
|
|
||||||
// 220104
|
// 220104
|
||||||
commandRequest = "2104";
|
commandRequest = "2104";
|
||||||
//eniro = "620104FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBAAAA";
|
|
||||||
responseRowMerged = "6104FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
responseRowMerged = "6104FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// BMS atsh7e4
|
|
||||||
// 220105
|
// 220105
|
||||||
commandRequest = "2105";
|
commandRequest = "2105";
|
||||||
//eniro = "620105003fff9000000000000000000F8A86012B4946500101500DAC03E800000000AC0000C7C701000F00000000AAAA";
|
|
||||||
responseRowMerged = "6105FFFFFFFF00000000001717171817171726482648000150181703E81A03E801520029000000000000000000000000";
|
responseRowMerged = "6105FFFFFFFF00000000001717171817171726482648000150181703E81A03E801520029000000000000000000000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// BMS atsh7e4
|
|
||||||
// 220106
|
// 220106
|
||||||
commandRequest = "2106";
|
commandRequest = "2106";
|
||||||
//eniro = "620106FFFFFFFF14001A00240000003A7C86B4B30000000928EA00";
|
|
||||||
responseRowMerged = "7F2112"; // n/a on ioniq
|
responseRowMerged = "7F2112"; // n/a on ioniq
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// 22c002
|
// BCM / TPMS ATSH7A0
|
||||||
//commandRequest = "22c002";
|
currentAtshRequest = "ATSH7A0";
|
||||||
// eniro = "62C002FFFF0000D2E84E93D2E84EBBD2DBDACBD2E149F3AAAAAAAA";
|
|
||||||
//responseRowMerged = "";
|
|
||||||
//parseRowMergedHyundaiIoniq();
|
|
||||||
|
|
||||||
// BCM / TPMS atsh7a0
|
|
||||||
// 22c00b
|
// 22c00b
|
||||||
commandRequest = "22c00b";
|
commandRequest = "22c00b";
|
||||||
// eniro = "62C00BFFFF0000B93D0100B43E0100B43D0100BB3C0100AAAAAAAA";
|
|
||||||
responseRowMerged = "62C00BFFFF0000B9510100B9510100B84F0100B54F0100AAAAAAAA";
|
responseRowMerged = "62C00BFFFF0000B9510100B9510100B84F0100B54F0100AAAAAAAA";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
// atsh7c6
|
// ATSH7C6
|
||||||
|
currentAtshRequest = "ATSH7C6";
|
||||||
// 22b002
|
// 22b002
|
||||||
commandRequest = "22b002";
|
commandRequest = "22b002";
|
||||||
// eniro = "62B002E0000000FFB400330B0000000000000000";
|
|
||||||
responseRowMerged = "62B002E000000000AD003D2D0000000000000000";
|
responseRowMerged = "62B002E000000000AD003D2D0000000000000000";
|
||||||
parseRowMergedHyundaiIoniq();
|
parseRowMergedHyundaiIoniq();
|
||||||
|
|
||||||
|
|||||||
272
car_kia_eniro.h
272
car_kia_eniro.h
@@ -19,7 +19,7 @@ String commandQueueKiaENiro[commandQueueCountKiaENiro] = {
|
|||||||
|
|
||||||
// Loop from (KIA ENIRO)
|
// Loop from (KIA ENIRO)
|
||||||
// BMS
|
// BMS
|
||||||
"atsh7e4",
|
"ATSH7E4",
|
||||||
"220101", // power kw, ...
|
"220101", // power kw, ...
|
||||||
"220102", // cell voltages, screen 3 only
|
"220102", // cell voltages, screen 3 only
|
||||||
"220103", // cell voltages, screen 3 only
|
"220103", // cell voltages, screen 3 only
|
||||||
@@ -28,31 +28,31 @@ String commandQueueKiaENiro[commandQueueCountKiaENiro] = {
|
|||||||
"220106", // cooling water temp
|
"220106", // cooling water temp
|
||||||
|
|
||||||
// VMCU
|
// VMCU
|
||||||
"atsh7e2",
|
"ATSH7E2",
|
||||||
"2101", // speed, ...
|
"2101", // speed, ...
|
||||||
"2102", // aux, ...
|
"2102", // aux, ...
|
||||||
|
|
||||||
//"atsh7df",
|
//"ATSH7Df",
|
||||||
//"2106",
|
//"2106",
|
||||||
//"220106",
|
//"220106",
|
||||||
|
|
||||||
// ECU - Aircondition
|
// ECU - Aircondition
|
||||||
"atsh7b3",
|
"ATSH7B3",
|
||||||
"220100", // in/out temp
|
"220100", // in/out temp
|
||||||
"220102", // coolant temp1, 2
|
"220102", // coolant temp1, 2
|
||||||
|
|
||||||
// BCM / TPMS
|
// BCM / TPMS
|
||||||
"atsh7a0",
|
"ATSH7A0",
|
||||||
"22c00b", // tire pressure/temp
|
"22c00b", // tire pressure/temp
|
||||||
|
|
||||||
// CLUSTER MODULE
|
// CLUSTER MODULE
|
||||||
"atsh7c6",
|
"ATSH7C6",
|
||||||
"22B002", // odo
|
"22B002", // odo
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init command queue
|
Init command queue
|
||||||
*/
|
*/
|
||||||
bool activateCommandQueueForKiaENiro() {
|
bool activateCommandQueueForKiaENiro() {
|
||||||
|
|
||||||
// 39 or 64 kWh model?
|
// 39 or 64 kWh model?
|
||||||
@@ -63,10 +63,10 @@ bool activateCommandQueueForKiaENiro() {
|
|||||||
|
|
||||||
// Empty and fill command queue
|
// Empty and fill command queue
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
commandQueue[i] = "";
|
commandQueue[i] = "";
|
||||||
}
|
}
|
||||||
for (int i = 0; i < commandQueueCountKiaENiro; i++) {
|
for (int i = 0; i < commandQueueCountKiaENiro; i++) {
|
||||||
commandQueue[i] = commandQueueKiaENiro[i];
|
commandQueue[i] = commandQueueKiaENiro[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
commandQueueLoopFrom = commandQueueLoopFromKiaENiro;
|
commandQueueLoopFrom = commandQueueLoopFromKiaENiro;
|
||||||
@@ -80,198 +80,212 @@ bool activateCommandQueueForKiaENiro() {
|
|||||||
*/
|
*/
|
||||||
bool parseRowMergedKiaENiro() {
|
bool parseRowMergedKiaENiro() {
|
||||||
|
|
||||||
if (commandRequest.equals("2101")) {
|
// VMCU 7E2
|
||||||
params.speedKmh = hexToDec(responseRowMerged.substring(32, 36).c_str(), 2, false) * 0.0155; // / 100.0 *1.609 = real to gps is 1.750
|
if (currentAtshRequest.equals("ATSH7E2")) {
|
||||||
}
|
if (commandRequest.equals("2101")) {
|
||||||
if (commandRequest.equals("2102")) {
|
params.speedKmh = hexToDec(responseRowMerged.substring(32, 36).c_str(), 2, false) * 0.0155; // / 100.0 *1.609 = real to gps is 1.750
|
||||||
params.auxPerc = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, false);
|
}
|
||||||
params.auxCurrentAmp = - hexToDec(responseRowMerged.substring(46, 50).c_str(), 2, true) / 1000.0;
|
if (commandRequest.equals("2102")) {
|
||||||
|
params.auxPerc = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, false);
|
||||||
|
params.auxCurrentAmp = - hexToDec(responseRowMerged.substring(46, 50).c_str(), 2, true) / 1000.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cluster module 7c6
|
// Cluster module 7c6
|
||||||
if (commandRequest.equals("22B002")) {
|
if (currentAtshRequest.equals("ATSH7C6")) {
|
||||||
params.odoKm = float(strtol(responseRowMerged.substring(18, 24).c_str(), 0, 16));
|
if (commandRequest.equals("22B002")) {
|
||||||
|
params.odoKm = float(strtol(responseRowMerged.substring(18, 24).c_str(), 0, 16));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aircon 7b3
|
// Aircon 7b3
|
||||||
if (commandRequest.equals("220100")) {
|
if (currentAtshRequest.equals("ATSH7B3")) {
|
||||||
params.indoorTemperature = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
if (commandRequest.equals("220100")) {
|
||||||
params.outdoorTemperature = (hexToDec(responseRowMerged.substring(18, 20).c_str(), 1, false) / 2) - 40;
|
params.indoorTemperature = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
||||||
|
params.outdoorTemperature = (hexToDec(responseRowMerged.substring(18, 20).c_str(), 1, false) / 2) - 40;
|
||||||
|
}
|
||||||
|
if (commandRequest.equals("220102") && responseRowMerged.substring(12, 14) == "00") {
|
||||||
|
params.coolantTemp1C = (hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false) / 2) - 40;
|
||||||
|
params.coolantTemp2C = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Aircon 7b3
|
|
||||||
if (commandRequest.equals("220102") && responseRowMerged.substring(12, 14) == "00") {
|
|
||||||
params.coolantTemp1C = (hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false) / 2) - 40;
|
|
||||||
params.coolantTemp2C = (hexToDec(responseRowMerged.substring(16, 18).c_str(), 1, false) / 2) - 40;
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("220101")) {
|
|
||||||
params.cumulativeEnergyChargedKWh = float(strtol(responseRowMerged.substring(82, 90).c_str(), 0, 16)) / 10.0;
|
|
||||||
if (params.cumulativeEnergyChargedKWhStart == -1)
|
|
||||||
params.cumulativeEnergyChargedKWhStart = params.cumulativeEnergyChargedKWh;
|
|
||||||
params.cumulativeEnergyDischargedKWh = float(strtol(responseRowMerged.substring(90, 98).c_str(), 0, 16)) / 10.0;
|
|
||||||
if (params.cumulativeEnergyDischargedKWhStart == -1)
|
|
||||||
params.cumulativeEnergyDischargedKWhStart = params.cumulativeEnergyDischargedKWh;
|
|
||||||
params.auxVoltage = hexToDec(responseRowMerged.substring(64, 66).c_str(), 2, true) / 10.0;
|
|
||||||
params.batPowerAmp = - hexToDec(responseRowMerged.substring(26, 30).c_str(), 2, true) / 10.0;
|
|
||||||
params.batVoltage = hexToDec(responseRowMerged.substring(30, 34).c_str(), 2, false) / 10.0;
|
|
||||||
params.batPowerKw = (params.batPowerAmp * params.batVoltage) / 1000.0;
|
|
||||||
params.batPowerKwh100 = params.batPowerKw / params.speedKmh * 100;
|
|
||||||
params.batCellMaxV = hexToDec(responseRowMerged.substring(52, 54).c_str(), 1, false) / 50.0;
|
|
||||||
params.batCellMinV = hexToDec(responseRowMerged.substring(56, 58).c_str(), 1, false) / 50.0;
|
|
||||||
params.batModule01TempC = hexToDec(responseRowMerged.substring(38, 40).c_str(), 1, true);
|
|
||||||
params.batModule02TempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 1, true);
|
|
||||||
params.batModule03TempC = hexToDec(responseRowMerged.substring(42, 44).c_str(), 1, true);
|
|
||||||
params.batModule04TempC = hexToDec(responseRowMerged.substring(44, 46).c_str(), 1, true);
|
|
||||||
//params.batTempC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
|
||||||
//params.batMaxC = hexToDec(responseRowMerged.substring(34, 36).c_str(), 1, true);
|
|
||||||
//params.batMinC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
|
||||||
|
|
||||||
// This is more accurate than min/max from BMS. It's required to detect kona/eniro cold gates (min 15C is needed > 43kW charging, min 25C is needed > 58kW charging)
|
// BMS 7e4
|
||||||
params.batMinC = params.batMaxC = params.batModule01TempC;
|
if (currentAtshRequest.equals("ATSH7E4")) {
|
||||||
params.batMinC = (params.batModule02TempC < params.batMinC) ? params.batModule02TempC : params.batMinC;
|
if (commandRequest.equals("220101")) {
|
||||||
params.batMinC = (params.batModule03TempC < params.batMinC) ? params.batModule03TempC : params.batMinC;
|
params.cumulativeEnergyChargedKWh = float(strtol(responseRowMerged.substring(82, 90).c_str(), 0, 16)) / 10.0;
|
||||||
params.batMinC = (params.batModule04TempC < params.batMinC) ? params.batModule04TempC : params.batMinC;
|
if (params.cumulativeEnergyChargedKWhStart == -1)
|
||||||
params.batMaxC = (params.batModule02TempC > params.batMaxC) ? params.batModule02TempC : params.batMaxC;
|
params.cumulativeEnergyChargedKWhStart = params.cumulativeEnergyChargedKWh;
|
||||||
params.batMaxC = (params.batModule03TempC > params.batMaxC) ? params.batModule03TempC : params.batMaxC;
|
params.cumulativeEnergyDischargedKWh = float(strtol(responseRowMerged.substring(90, 98).c_str(), 0, 16)) / 10.0;
|
||||||
params.batMaxC = (params.batModule04TempC > params.batMaxC) ? params.batModule04TempC : params.batMaxC;
|
if (params.cumulativeEnergyDischargedKWhStart == -1)
|
||||||
params.batTempC = params.batMinC;
|
params.cumulativeEnergyDischargedKWhStart = params.cumulativeEnergyDischargedKWh;
|
||||||
|
params.auxVoltage = hexToDec(responseRowMerged.substring(64, 66).c_str(), 2, true) / 10.0;
|
||||||
|
params.batPowerAmp = - hexToDec(responseRowMerged.substring(26, 30).c_str(), 2, true) / 10.0;
|
||||||
|
params.batVoltage = hexToDec(responseRowMerged.substring(30, 34).c_str(), 2, false) / 10.0;
|
||||||
|
params.batPowerKw = (params.batPowerAmp * params.batVoltage) / 1000.0;
|
||||||
|
params.batPowerKwh100 = params.batPowerKw / params.speedKmh * 100;
|
||||||
|
params.batCellMaxV = hexToDec(responseRowMerged.substring(52, 54).c_str(), 1, false) / 50.0;
|
||||||
|
params.batCellMinV = hexToDec(responseRowMerged.substring(56, 58).c_str(), 1, false) / 50.0;
|
||||||
|
params.batModule01TempC = hexToDec(responseRowMerged.substring(38, 40).c_str(), 1, true);
|
||||||
|
params.batModule02TempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 1, true);
|
||||||
|
params.batModule03TempC = hexToDec(responseRowMerged.substring(42, 44).c_str(), 1, true);
|
||||||
|
params.batModule04TempC = hexToDec(responseRowMerged.substring(44, 46).c_str(), 1, true);
|
||||||
|
//params.batTempC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
||||||
|
//params.batMaxC = hexToDec(responseRowMerged.substring(34, 36).c_str(), 1, true);
|
||||||
|
//params.batMinC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
||||||
|
|
||||||
params.batInletC = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, true);
|
// This is more accurate than min/max from BMS. It's required to detect kona/eniro cold gates (min 15C is needed > 43kW charging, min 25C is needed > 58kW charging)
|
||||||
if (params.speedKmh < 15 && params.batPowerKw >= 1 && params.socPerc > 0 && params.socPerc <= 100) {
|
params.batMinC = params.batMaxC = params.batModule01TempC;
|
||||||
params.chargingGraphKw[int(params.socPerc)] = params.batPowerKw;
|
params.batMinC = (params.batModule02TempC < params.batMinC) ? params.batModule02TempC : params.batMinC;
|
||||||
params.chargingGraphMinTempC[int(params.socPerc)] = params.batMinC;
|
params.batMinC = (params.batModule03TempC < params.batMinC) ? params.batModule03TempC : params.batMinC;
|
||||||
params.chargingGraphMaxTempC[int(params.socPerc)] = params.batMaxC;
|
params.batMinC = (params.batModule04TempC < params.batMinC) ? params.batModule04TempC : params.batMinC;
|
||||||
}
|
params.batMaxC = (params.batModule02TempC > params.batMaxC) ? params.batModule02TempC : params.batMaxC;
|
||||||
}
|
params.batMaxC = (params.batModule03TempC > params.batMaxC) ? params.batModule03TempC : params.batMaxC;
|
||||||
// BMS 7e4
|
params.batMaxC = (params.batModule04TempC > params.batMaxC) ? params.batModule04TempC : params.batMaxC;
|
||||||
if (commandRequest.equals("220102") && responseRowMerged.substring(12, 14) == "FF") {
|
params.batTempC = params.batMinC;
|
||||||
for (int i = 0; i < 32; i++) {
|
|
||||||
params.cellVoltage[i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("220103")) {
|
|
||||||
for (int i = 0; i < 32; i++) {
|
|
||||||
params.cellVoltage[32 + i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("220104")) {
|
|
||||||
for (int i = 0; i < 32; i++) {
|
|
||||||
params.cellVoltage[64 + i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("220105")) {
|
|
||||||
params.sohPerc = hexToDec(responseRowMerged.substring(56, 60).c_str(), 2, false) / 10.0;
|
|
||||||
params.socPerc = hexToDec(responseRowMerged.substring(68, 70).c_str(), 1, false) / 2.0;
|
|
||||||
|
|
||||||
// Soc10ced table, record x0% CEC/CED table (ex. 90%->89%, 80%->79%)
|
params.batInletC = hexToDec(responseRowMerged.substring(50, 52).c_str(), 1, true);
|
||||||
if (oldParams.socPerc - params.socPerc > 0) {
|
if (params.speedKmh < 15 && params.batPowerKw >= 1 && params.socPerc > 0 && params.socPerc <= 100) {
|
||||||
byte index = (int(params.socPerc) == 4) ? 0 : (int)(params.socPerc / 10) + 1;
|
params.chargingGraphKw[int(params.socPerc)] = params.batPowerKw;
|
||||||
if ((int(params.socPerc) % 10 == 9 || int(params.socPerc) == 4) && params.soc10ced[index] == -1) {
|
params.chargingGraphMinTempC[int(params.socPerc)] = params.batMinC;
|
||||||
struct tm now;
|
params.chargingGraphMaxTempC[int(params.socPerc)] = params.batMaxC;
|
||||||
getLocalTime(&now, 0);
|
|
||||||
time_t time_now_epoch = mktime(&now);
|
|
||||||
params.soc10ced[index] = params.cumulativeEnergyDischargedKWh;
|
|
||||||
params.soc10cec[index] = params.cumulativeEnergyChargedKWh;
|
|
||||||
params.soc10odo[index] = params.odoKm;
|
|
||||||
params.soc10time[index] = time_now_epoch;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.batHeaterC = hexToDec(responseRowMerged.substring(52, 54).c_str(), 1, true);
|
// BMS 7e4
|
||||||
//
|
if (commandRequest.equals("220102") && responseRowMerged.substring(12, 14) == "FF") {
|
||||||
for (int i = 30; i < 32; i++) { // ai/aj position
|
for (int i = 0; i < 32; i++) {
|
||||||
params.cellVoltage[96 - 30 + i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
params.cellVoltage[i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
if (commandRequest.equals("220103")) {
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
params.cellVoltage[32 + i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
if (commandRequest.equals("220104")) {
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
params.cellVoltage[64 + i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
if (commandRequest.equals("220105")) {
|
||||||
|
params.sohPerc = hexToDec(responseRowMerged.substring(56, 60).c_str(), 2, false) / 10.0;
|
||||||
|
params.socPerc = hexToDec(responseRowMerged.substring(68, 70).c_str(), 1, false) / 2.0;
|
||||||
|
|
||||||
|
// Soc10ced table, record x0% CEC/CED table (ex. 90%->89%, 80%->79%)
|
||||||
|
if (oldParams.socPerc - params.socPerc > 0) {
|
||||||
|
byte index = (int(params.socPerc) == 4) ? 0 : (int)(params.socPerc / 10) + 1;
|
||||||
|
if ((int(params.socPerc) % 10 == 9 || int(params.socPerc) == 4) && params.soc10ced[index] == -1) {
|
||||||
|
struct tm now;
|
||||||
|
getLocalTime(&now, 0);
|
||||||
|
time_t time_now_epoch = mktime(&now);
|
||||||
|
params.soc10ced[index] = params.cumulativeEnergyDischargedKWh;
|
||||||
|
params.soc10cec[index] = params.cumulativeEnergyChargedKWh;
|
||||||
|
params.soc10odo[index] = params.odoKm;
|
||||||
|
params.soc10time[index] = time_now_epoch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params.batHeaterC = hexToDec(responseRowMerged.substring(52, 54).c_str(), 1, true);
|
||||||
|
//
|
||||||
|
for (int i = 30; i < 32; i++) { // ai/aj position
|
||||||
|
params.cellVoltage[96 - 30 + i] = hexToDec(responseRowMerged.substring(14 + (i * 2), 14 + (i * 2) + 2).c_str(), 1, false) / 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMS 7e4
|
||||||
|
if (commandRequest.equals("220106")) {
|
||||||
|
params.coolingWaterTempC = hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// BMS 7e4
|
|
||||||
if (commandRequest.equals("220106")) {
|
|
||||||
params.coolingWaterTempC = hexToDec(responseRowMerged.substring(14, 16).c_str(), 1, false);
|
|
||||||
}
|
|
||||||
// TPMS 7a0
|
// TPMS 7a0
|
||||||
if (commandRequest.equals("22c00b")) {
|
if (currentAtshRequest.equals("ATSH7A0")) {
|
||||||
params.tireFrontLeftPressureBar = hexToDec(responseRowMerged.substring(14, 16).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
if (commandRequest.equals("22c00b")) {
|
||||||
params.tireFrontRightPressureBar = hexToDec(responseRowMerged.substring(22, 24).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
params.tireFrontLeftPressureBar = hexToDec(responseRowMerged.substring(14, 16).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireRearRightPressureBar = hexToDec(responseRowMerged.substring(30, 32).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
params.tireFrontRightPressureBar = hexToDec(responseRowMerged.substring(22, 24).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireRearLeftPressureBar = hexToDec(responseRowMerged.substring(38, 40).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
params.tireRearRightPressureBar = hexToDec(responseRowMerged.substring(30, 32).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireFrontLeftTempC = hexToDec(responseRowMerged.substring(16, 18).c_str(), 2, false) - 50; // === OK Valid
|
params.tireRearLeftPressureBar = hexToDec(responseRowMerged.substring(38, 40).c_str(), 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||||
params.tireFrontRightTempC = hexToDec(responseRowMerged.substring(24, 26).c_str(), 2, false) - 50; // === OK Valid
|
params.tireFrontLeftTempC = hexToDec(responseRowMerged.substring(16, 18).c_str(), 2, false) - 50; // === OK Valid
|
||||||
params.tireRearRightTempC = hexToDec(responseRowMerged.substring(32, 34).c_str(), 2, false) - 50; // === OK Valid
|
params.tireFrontRightTempC = hexToDec(responseRowMerged.substring(24, 26).c_str(), 2, false) - 50; // === OK Valid
|
||||||
params.tireRearLeftTempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 2, false) - 50; // === OK Valid
|
params.tireRearRightTempC = hexToDec(responseRowMerged.substring(32, 34).c_str(), 2, false) - 50; // === OK Valid
|
||||||
|
params.tireRearLeftTempC = hexToDec(responseRowMerged.substring(40, 42).c_str(), 2, false) - 50; // === OK Valid
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test data
|
Test data
|
||||||
*/
|
*/
|
||||||
bool testDataKiaENiro() {
|
bool testDataKiaENiro() {
|
||||||
|
|
||||||
|
// VMCU ATSH7E2
|
||||||
|
currentAtshRequest = "ATSH7E2";
|
||||||
// 2101
|
// 2101
|
||||||
commandRequest = "2101";
|
commandRequest = "2101";
|
||||||
responseRowMerged = "6101FFF8000009285A3B0648030000B4179D763404080805000000";
|
responseRowMerged = "6101FFF8000009285A3B0648030000B4179D763404080805000000";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
// 2102
|
// 2102
|
||||||
commandRequest = "2102";
|
commandRequest = "2102";
|
||||||
responseRowMerged = "6102F8FFFC000101000000840FBF83BD33270680953033757F59291C76000001010100000007000000";
|
responseRowMerged = "6102F8FFFC000101000000840FBF83BD33270680953033757F59291C76000001010100000007000000";
|
||||||
responseRowMerged = "6102F8FFFC000101000000931CC77F4C39040BE09BA7385D8158832175000001010100000007000000";
|
responseRowMerged = "6102F8FFFC000101000000931CC77F4C39040BE09BA7385D8158832175000001010100000007000000";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
|
// "ATSH7DF",
|
||||||
|
currentAtshRequest = "ATSH7DF";
|
||||||
// 2106
|
// 2106
|
||||||
commandRequest = "2106";
|
commandRequest = "2106";
|
||||||
responseRowMerged = "6106FFFF800000000000000200001B001C001C000600060006000E000000010000000000000000013D013D013E013E00";
|
responseRowMerged = "6106FFFF800000000000000200001B001C001C000600060006000E000000010000000000000000013D013D013E013E00";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
|
// AIRCON / ACU ATSH7B3
|
||||||
|
currentAtshRequest = "ATSH7B3";
|
||||||
// 220100
|
// 220100
|
||||||
commandRequest = "220100";
|
commandRequest = "220100";
|
||||||
responseRowMerged = "6201007E5027C8FF7F765D05B95AFFFF5AFF11FFFFFFFFFFFF6AFFFF2DF0757630FFFF00FFFF000000";
|
responseRowMerged = "6201007E5027C8FF7F765D05B95AFFFF5AFF11FFFFFFFFFFFF6AFFFF2DF0757630FFFF00FFFF000000";
|
||||||
responseRowMerged = "6201007E5027C8FF867C58121010FFFF10FF8EFFFFFFFFFFFF10FFFF0DF0617900FFFF01FFFF000000";
|
responseRowMerged = "6201007E5027C8FF867C58121010FFFF10FF8EFFFFFFFFFFFF10FFFF0DF0617900FFFF01FFFF000000";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
|
// BMS ATSH7E4
|
||||||
|
currentAtshRequest = "ATSH7E4";
|
||||||
// 220101
|
// 220101
|
||||||
commandRequest = "220101";
|
commandRequest = "220101";
|
||||||
responseRowMerged = "620101FFF7E7FF99000000000300B10EFE120F11100F12000018C438C30B00008400003864000035850000153A00001374000647010D017F0BDA0BDA03E8";
|
responseRowMerged = "620101FFF7E7FF99000000000300B10EFE120F11100F12000018C438C30B00008400003864000035850000153A00001374000647010D017F0BDA0BDA03E8";
|
||||||
responseRowMerged = "620101FFF7E7FFB3000000000300120F9B111011101011000014CC38CB3B00009100003A510000367C000015FB000013D3000690250D018E0000000003E8";
|
responseRowMerged = "620101FFF7E7FFB3000000000300120F9B111011101011000014CC38CB3B00009100003A510000367C000015FB000013D3000690250D018E0000000003E8";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
// 220102
|
// 220102
|
||||||
commandRequest = "220102";
|
commandRequest = "220102";
|
||||||
responseRowMerged = "620102FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBAAAA";
|
responseRowMerged = "620102FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBAAAA";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
// 220103
|
// 220103
|
||||||
commandRequest = "220103";
|
commandRequest = "220103";
|
||||||
responseRowMerged = "620103FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCACBCACACFCCCBCBCBCBCBCBCBCBAAAA";
|
responseRowMerged = "620103FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCACBCACACFCCCBCBCBCBCBCBCBCBAAAA";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
// 220104
|
// 220104
|
||||||
commandRequest = "220104";
|
commandRequest = "220104";
|
||||||
responseRowMerged = "620104FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBAAAA";
|
responseRowMerged = "620104FFFFFFFFCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBAAAA";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
// 220105
|
// 220105
|
||||||
commandRequest = "220105";
|
commandRequest = "220105";
|
||||||
responseRowMerged = "620105003fff9000000000000000000F8A86012B4946500101500DAC03E800000000AC0000C7C701000F00000000AAAA";
|
responseRowMerged = "620105003fff9000000000000000000F8A86012B4946500101500DAC03E800000000AC0000C7C701000F00000000AAAA";
|
||||||
responseRowMerged = "620105003FFF90000000000000000014918E012927465000015013BB03E800000000BB0000CBCB01001300000000AAAA";
|
responseRowMerged = "620105003FFF90000000000000000014918E012927465000015013BB03E800000000BB0000CBCB01001300000000AAAA";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
// 220106
|
// 220106
|
||||||
commandRequest = "220106";
|
commandRequest = "220106";
|
||||||
responseRowMerged = "620106FFFFFFFF14001A00240000003A7C86B4B30000000928EA00";
|
responseRowMerged = "620106FFFFFFFF14001A00240000003A7C86B4B30000000928EA00";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
// 22c002
|
// BCM / TPMS ATSH7A0
|
||||||
commandRequest = "22c002";
|
currentAtshRequest = "ATSH7A0";
|
||||||
responseRowMerged = "62C002FFFF0000D2E84E93D2E84EBBD2DBDACBD2E149F3AAAAAAAA";
|
|
||||||
parseRowMergedKiaENiro();
|
|
||||||
|
|
||||||
// 22c00b
|
// 22c00b
|
||||||
commandRequest = "22c00b";
|
commandRequest = "22c00b";
|
||||||
responseRowMerged = "62C00BFFFF0000B93D0100B43E0100B43D0100BB3C0100AAAAAAAA";
|
responseRowMerged = "62C00BFFFF0000B93D0100B43E0100B43D0100BB3C0100AAAAAAAA";
|
||||||
parseRowMergedKiaENiro();
|
parseRowMergedKiaENiro();
|
||||||
|
|
||||||
|
// ATSH7C6
|
||||||
|
currentAtshRequest = "ATSH7C6";
|
||||||
// 22b002
|
// 22b002
|
||||||
commandRequest = "22b002";
|
commandRequest = "22b002";
|
||||||
responseRowMerged = "62B002E0000000FFB400330B0000000000000000";
|
responseRowMerged = "62B002E0000000FFB400330B0000000000000000";
|
||||||
@@ -281,10 +295,6 @@ bool testDataKiaENiro() {
|
|||||||
params.batModule02TempC = 29;
|
params.batModule02TempC = 29;
|
||||||
params.batModule03TempC = 28;
|
params.batModule03TempC = 28;
|
||||||
params.batModule04TempC = 30;
|
params.batModule04TempC = 30;
|
||||||
//params.batTempC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
|
||||||
//params.batMaxC = hexToDec(responseRowMerged.substring(34, 36).c_str(), 1, true);
|
|
||||||
//params.batMinC = hexToDec(responseRowMerged.substring(36, 38).c_str(), 1, true);
|
|
||||||
|
|
||||||
// This is more accurate than min/max from BMS. It's required to detect kona/eniro cold gates (min 15C is needed > 43kW charging, min 25C is needed > 58kW charging)
|
// This is more accurate than min/max from BMS. It's required to detect kona/eniro cold gates (min 15C is needed > 43kW charging, min 25C is needed > 58kW charging)
|
||||||
params.batMinC = params.batMaxC = params.batModule01TempC;
|
params.batMinC = params.batMaxC = params.batModule01TempC;
|
||||||
params.batMinC = (params.batModule02TempC < params.batMinC) ? params.batModule02TempC : params.batMinC ;
|
params.batMinC = (params.batModule02TempC < params.batMinC) ? params.batModule02TempC : params.batMinC ;
|
||||||
|
|||||||
@@ -1118,6 +1118,10 @@ bool doNextAtCommand() {
|
|||||||
|
|
||||||
// Send AT command to obd
|
// Send AT command to obd
|
||||||
commandRequest = commandQueue[commandQueueIndex];
|
commandRequest = commandQueue[commandQueueIndex];
|
||||||
|
if (commandRequest.startsWith("ATSH")) {
|
||||||
|
currentAtshRequest = commandRequest;
|
||||||
|
}
|
||||||
|
|
||||||
Serial.print(">>> ");
|
Serial.print(">>> ");
|
||||||
Serial.println(commandRequest);
|
Serial.println(commandRequest);
|
||||||
String tmpStr = commandRequest + "\r";
|
String tmpStr = commandRequest + "\r";
|
||||||
|
|||||||
1
struct.h
1
struct.h
@@ -14,6 +14,7 @@ String responseRowMerged;
|
|||||||
byte commandQueueIndex;
|
byte commandQueueIndex;
|
||||||
bool canSendNextAtCommand = false;
|
bool canSendNextAtCommand = false;
|
||||||
String commandRequest = "";
|
String commandRequest = "";
|
||||||
|
String currentAtshRequest = "";
|
||||||
|
|
||||||
// Structure with realtime values
|
// Structure with realtime values
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user