Ioniq bat.fan status + display 1 - autommode (speed>20kph,chargin>1kW graph, else main screen)
This commit is contained in:
@@ -118,6 +118,8 @@ bool parseRowMergedHyundaiIoniq() {
|
|||||||
params.cumulativeEnergyDischargedKWh = float(strtol(responseRowMerged.substring(88, 96).c_str(), 0, 16)) / 10.0;
|
params.cumulativeEnergyDischargedKWh = float(strtol(responseRowMerged.substring(88, 96).c_str(), 0, 16)) / 10.0;
|
||||||
if (params.cumulativeEnergyDischargedKWhStart == -1)
|
if (params.cumulativeEnergyDischargedKWhStart == -1)
|
||||||
params.cumulativeEnergyDischargedKWhStart = params.cumulativeEnergyDischargedKWh;
|
params.cumulativeEnergyDischargedKWhStart = params.cumulativeEnergyDischargedKWh;
|
||||||
|
params.batFanStatus = hexToDec(responseRowMerged.substring(58, 60).c_str(), 2, true);
|
||||||
|
params.batFanFeedbackHz = hexToDec(responseRowMerged.substring(60, 62).c_str(), 2, true);
|
||||||
params.auxVoltage = hexToDec(responseRowMerged.substring(62, 64).c_str(), 2, true) / 10.0;
|
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.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.batVoltage = hexToDec(responseRowMerged.substring(28, 32).c_str(), 2, false) / 10.0;
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ char tmpStr3[20];
|
|||||||
char tmpStr4[20];
|
char tmpStr4[20];
|
||||||
|
|
||||||
// Screens, buttons
|
// Screens, buttons
|
||||||
#define displayScreenCount 5
|
#define displayScreenCount 6
|
||||||
byte displayScreen = 1; // 0 - blank screen, 1 - dash board (default), 2 - big speed + kwh/100, 3 - battery cells, 4 - charging graph, 5 - 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
|
||||||
bool btnLeftPressed = true;
|
bool btnLeftPressed = true;
|
||||||
bool btnMiddlePressed = true;
|
bool btnMiddlePressed = true;
|
||||||
bool btnRightPressed = true;
|
bool btnRightPressed = true;
|
||||||
@@ -271,6 +271,8 @@ bool initStructure() {
|
|||||||
params.batTempC = -1;
|
params.batTempC = -1;
|
||||||
params.batHeaterC = -1;
|
params.batHeaterC = -1;
|
||||||
params.batInletC = -1;
|
params.batInletC = -1;
|
||||||
|
params.batFanStatus = -1;
|
||||||
|
params.batFanFeedbackHz = -1;
|
||||||
params.batMinC = -1;
|
params.batMinC = -1;
|
||||||
params.batMaxC = -1;
|
params.batMaxC = -1;
|
||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 12; i++) {
|
||||||
@@ -705,14 +707,14 @@ bool drawSceneBatteryCells(bool force) {
|
|||||||
for (uint16_t i = 4; i < params.batModuleTempCount; i++) {
|
for (uint16_t i = 4; i < params.batModuleTempCount; i++) {
|
||||||
if (params.batModuleTempC[i] == 0)
|
if (params.batModuleTempC[i] == 0)
|
||||||
continue;
|
continue;
|
||||||
posx = (((i-4) % 8) * 40);
|
posx = (((i - 4) % 8) * 40);
|
||||||
posy = ((floor((i-4) / 8)) * 13) + 64;
|
posy = ((floor((i - 4) / 8)) * 13) + 64;
|
||||||
//tft.fillRect(x * 80, y * 32, ((w) * 80), ((h) * 32), bgColor);
|
//tft.fillRect(x * 80, y * 32, ((w) * 80), ((h) * 32), bgColor);
|
||||||
tft.setTextSize(1); // Size for small 5x7 font
|
tft.setTextSize(1); // Size for small 5x7 font
|
||||||
tft.setTextDatum(TL_DATUM);
|
tft.setTextDatum(TL_DATUM);
|
||||||
tft.setTextColor(((params.batModuleTempC[i] >= 15) ? ((params.batModuleTempC[i] >= 25) ? TFT_GREEN : TFT_BLUE) : TFT_RED), TFT_BLACK);
|
tft.setTextColor(((params.batModuleTempC[i] >= 15) ? ((params.batModuleTempC[i] >= 25) ? TFT_GREEN : TFT_BLUE) : TFT_RED), TFT_BLACK);
|
||||||
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "%01.00fC" : "%01.01fF"), celsius2temperature(params.batModuleTempC[i]));
|
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "%01.00fC" : "%01.01fF"), celsius2temperature(params.batModuleTempC[i]));
|
||||||
tft.drawString(tmpStr1, posx+4, posy, 2);
|
tft.drawString(tmpStr1, posx + 4, posy, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
tft.setTextDatum(TL_DATUM); // Topleft
|
tft.setTextDatum(TL_DATUM); // Topleft
|
||||||
@@ -827,20 +829,36 @@ bool drawSceneChargingGraph(bool force) {
|
|||||||
tft.setTextColor((params.batModuleTempC[3] >= 15) ? ((params.batModuleTempC[3] >= 25) ? TFT_GREEN : TFT_BLUE) : TFT_RED, TFT_TEMP);
|
tft.setTextColor((params.batModuleTempC[3] >= 15) ? ((params.batModuleTempC[3] >= 25) ? TFT_GREEN : TFT_BLUE) : TFT_RED, TFT_TEMP);
|
||||||
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
||||||
posy++;
|
posy++;
|
||||||
if (params.coolingWaterTempC != 0) {
|
if (params.coolingWaterTempC != -1) {
|
||||||
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "W:%01.00fC" : "W:%01.00fF"), celsius2temperature(params.coolingWaterTempC));
|
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "W:%01.00fC" : "W:%01.00fF"), celsius2temperature(params.coolingWaterTempC));
|
||||||
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
||||||
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
||||||
posy++;
|
posy++;
|
||||||
}
|
}
|
||||||
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "C1:%01.00fC" : "C1:%01.00fF"), celsius2temperature(params.coolantTemp1C));
|
if (params.batFanFeedbackHz != -1) {
|
||||||
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
sprintf(tmpStr1, "FF:%01.00fHz", params.batFanFeedbackHz);
|
||||||
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
||||||
posy++;
|
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
||||||
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "C2:%01.00fC" : "C2:%01.00fF"), celsius2temperature(params.coolantTemp2C));
|
posy++;
|
||||||
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
}
|
||||||
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
if (params.batFanStatus != -1) {
|
||||||
posy++;
|
sprintf(tmpStr1, "FS:%01.00f", params.batFanStatus);
|
||||||
|
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
||||||
|
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
||||||
|
posy++;
|
||||||
|
}
|
||||||
|
if (params.coolantTemp1C != -1) {
|
||||||
|
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "C1:%01.00fC" : "C1:%01.00fF"), celsius2temperature(params.coolantTemp1C));
|
||||||
|
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
||||||
|
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
||||||
|
posy++;
|
||||||
|
}
|
||||||
|
if (params.coolantTemp2C != -1) {
|
||||||
|
sprintf(tmpStr1, ((settings.temperatureUnit == 'c') ? "C2:%01.00fC" : "C2:%01.00fF"), celsius2temperature(params.coolantTemp2C));
|
||||||
|
tft.setTextColor(TFT_CYAN, TFT_TEMP);
|
||||||
|
tft.drawString(tmpStr1, zeroX + (10 * 10 * mulX), zeroY - (maxKw * mulY) + (posy * 15), 2);
|
||||||
|
posy++;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1107,24 +1125,34 @@ bool redrawScreen(bool force) {
|
|||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Main screen
|
// 1. Auto mode = >20kpm Screen 3 - speed, other wise basic Screen2 - Main screen, if charging then Screen 5 Graph
|
||||||
if (displayScreen == 1) {
|
if (displayScreen == 1) {
|
||||||
|
if (params.speedKmh > 20) {
|
||||||
|
drawSceneSpeed(force);
|
||||||
|
} else if (params.batPowerKw > 1) {
|
||||||
|
drawSceneChargingGraph(force);
|
||||||
|
} else {
|
||||||
|
drawSceneMain(force);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 2. Main screen
|
||||||
|
if (displayScreen == 2) {
|
||||||
drawSceneMain(force);
|
drawSceneMain(force);
|
||||||
}
|
}
|
||||||
// 2. Big speed + kwh/100km
|
// 3. Big speed + kwh/100km
|
||||||
if (displayScreen == 2) {
|
if (displayScreen == 3) {
|
||||||
drawSceneSpeed(force);
|
drawSceneSpeed(force);
|
||||||
}
|
}
|
||||||
// 3. Battery cells
|
// 4. Battery cells
|
||||||
if (displayScreen == 3) {
|
if (displayScreen == 4) {
|
||||||
drawSceneBatteryCells(force);
|
drawSceneBatteryCells(force);
|
||||||
}
|
}
|
||||||
// 4. Charging graph
|
// 5. Charging graph
|
||||||
if (displayScreen == 4) {
|
if (displayScreen == 5) {
|
||||||
drawSceneChargingGraph(force);
|
drawSceneChargingGraph(force);
|
||||||
}
|
}
|
||||||
// 5. SOC10% table (CEC-CED)
|
// 6. SOC10% table (CEC-CED)
|
||||||
if (displayScreen == 5) {
|
if (displayScreen == 6) {
|
||||||
drawSceneSoc10Table(force);
|
drawSceneSoc10Table(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
struct.h
2
struct.h
@@ -37,6 +37,8 @@ typedef struct {
|
|||||||
float batTempC;
|
float batTempC;
|
||||||
float batHeaterC;
|
float batHeaterC;
|
||||||
float batInletC;
|
float batInletC;
|
||||||
|
float batFanStatus;
|
||||||
|
float batFanFeedbackHz;
|
||||||
float batMinC;
|
float batMinC;
|
||||||
float batMaxC;
|
float batMaxC;
|
||||||
uint16_t batModuleTempCount;
|
uint16_t batModuleTempCount;
|
||||||
|
|||||||
Reference in New Issue
Block a user