door status
This commit is contained in:
@@ -73,13 +73,13 @@ void Board320_240::afterSetup() {
|
||||
|
||||
// Init GPS
|
||||
if (liveData->settings.gpsHwSerialPort <= 2) {
|
||||
Serial.print("GPS initialization on hwUart: ");
|
||||
Serial.print("GPS initialization on hwUart: ");
|
||||
Serial.println(liveData->settings.gpsHwSerialPort);
|
||||
if (liveData->settings.gpsHwSerialPort == 0) {
|
||||
Serial.println("hwUart0 collision with serial console! Disabling serial console");
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
}
|
||||
}
|
||||
gpsHwUart = new HardwareSerial(liveData->settings.gpsHwSerialPort);
|
||||
gpsHwUart->begin(9600);
|
||||
}
|
||||
@@ -1063,7 +1063,24 @@ void Board320_240::menuItemClick() {
|
||||
// Save settings
|
||||
case 9: saveSettings(); break;
|
||||
// Version
|
||||
case 10: hideMenu(); return;
|
||||
case 10:
|
||||
/* commInterface->executeCommand("ATSH770");
|
||||
delay(50);
|
||||
commInterface->executeCommand("3E");
|
||||
delay(50);
|
||||
commInterface->executeCommand("1003");
|
||||
delay(50);
|
||||
commInterface->executeCommand("2FBC1003");
|
||||
delay(5000);
|
||||
commInterface->executeCommand("ATSH770");
|
||||
delay(50);
|
||||
commInterface->executeCommand("3E");
|
||||
delay(50);
|
||||
commInterface->executeCommand("1003");
|
||||
delay(50);
|
||||
commInterface->executeCommand("2FBC1103");
|
||||
delay(5000);*/
|
||||
hideMenu(); return;
|
||||
// Shutdown
|
||||
case 11: shutdownDevice(); return;
|
||||
default:
|
||||
@@ -1182,6 +1199,7 @@ void Board320_240::redrawScreen() {
|
||||
TFT_YELLOW /* failed to initialize sdcard */
|
||||
);
|
||||
}
|
||||
// GPS state
|
||||
if (gpsHwUart != NULL && (displayScreen == SCREEN_SPEED || displayScreenAutoMode == SCREEN_SPEED)) {
|
||||
spr.drawCircle(160, 10, 5, (gps.location.isValid()) ? TFT_GREEN : TFT_RED);
|
||||
spr.setTextSize(1);
|
||||
@@ -1189,9 +1207,22 @@ void Board320_240::redrawScreen() {
|
||||
spr.setTextDatum(TL_DATUM);
|
||||
sprintf(tmpStr1, "%d", liveData->params.gpsSat);
|
||||
spr.drawString(tmpStr1, 174, 2, 2);
|
||||
|
||||
}
|
||||
|
||||
// Door status
|
||||
if (liveData->params.trunkDoorOpen)
|
||||
spr.fillRect(20, 0, 320 - 40, 20, TFT_YELLOW);
|
||||
if (liveData->params.leftFrontDoorOpen)
|
||||
spr.fillRect(0, 20, 20, 98, TFT_YELLOW);
|
||||
if (liveData->params.rightFrontDoorOpen)
|
||||
spr.fillRect(0, 122, 20, 98, TFT_YELLOW);
|
||||
if (liveData->params.leftRearDoorOpen)
|
||||
spr.fillRect(320 - 20, 20, 20, 98, TFT_YELLOW);
|
||||
if (liveData->params.rightRearDoorOpen)
|
||||
spr.fillRect(320 - 20, 122, 20, 98, TFT_YELLOW);
|
||||
if (liveData->params.hoodOpen)
|
||||
spr.fillRect(20, 240 - 20, 320 - 40, 20, TFT_YELLOW);
|
||||
|
||||
// BLE not connected
|
||||
if (!liveData->commConnected && liveData->bleConnect && liveData->tmpSettings.commType == COMM_TYPE_OBD2BLE4) {
|
||||
// Print message
|
||||
@@ -1213,7 +1244,7 @@ void Board320_240::redrawScreen() {
|
||||
void Board320_240::loadTestData() {
|
||||
|
||||
Serial.println("Loading test data");
|
||||
|
||||
|
||||
testDataMode = true; // skip lights off message
|
||||
carInterface->loadTestData();
|
||||
redrawScreen();
|
||||
@@ -1374,7 +1405,7 @@ bool Board320_240::sdcardMount() {
|
||||
|
||||
while (1) {
|
||||
Serial.print("Initializing SD card...");
|
||||
|
||||
|
||||
#ifdef BOARD_TTGO_T4
|
||||
Serial.print(" TTGO-T4 ");
|
||||
SPIClass * hspi = new SPIClass(HSPI);
|
||||
@@ -1490,7 +1521,7 @@ bool Board320_240::sim800lSetup() {
|
||||
// SIM800L DebugMode:
|
||||
//sim800l = new SIM800L((Stream *)gprsHwUart, SIM800L_RST, 512 , 512, (Stream *)&Serial);
|
||||
|
||||
bool sim800l_ready = sim800l->isReady();
|
||||
bool sim800l_ready = sim800l->isReady();
|
||||
for (uint8_t i = 0; i < 5 && !sim800l_ready; i++) {
|
||||
Serial.println("Problem to initialize SIM800L module, retry in 1 sec");
|
||||
delay(1000);
|
||||
|
||||
@@ -85,7 +85,7 @@ void CarHyundaiIoniq::activateCommandQueue() {
|
||||
*/
|
||||
void CarHyundaiIoniq::parseRowMerged() {
|
||||
|
||||
bool tempByte;
|
||||
uint8_t tempByte;
|
||||
float tempFloat;
|
||||
String tmpStr;
|
||||
|
||||
@@ -112,13 +112,13 @@ void CarHyundaiIoniq::parseRowMerged() {
|
||||
int32_t secDiff = liveData->params.currentTime - liveData->params.currentTime;
|
||||
if (liveData->commConnected && secDiff > 30 && secDiff < MONTH_SEC && !liveData->params.ignitionOn && !liveData->params.chargingOn)
|
||||
liveData->params.automaticShutdownTimer = liveData->params.currentTime;
|
||||
liveData->params.lightInfo = liveData->hexToDecFromResponse(18, 20, 1, false);
|
||||
liveData->params.headLights = (bitRead(liveData->params.lightInfo, 5) == 1);
|
||||
liveData->params.dayLights = (bitRead(liveData->params.lightInfo, 3) == 1);
|
||||
tempByte = liveData->hexToDecFromResponse(18, 20, 1, false);
|
||||
liveData->params.headLights = (bitRead(tempByte, 5) == 1);
|
||||
liveData->params.dayLights = (bitRead(tempByte, 3) == 1);
|
||||
}
|
||||
if (liveData->commandRequest.equals("22BC06")) {
|
||||
liveData->params.brakeLightInfo = liveData->hexToDecFromResponse(14, 16, 1, false);
|
||||
liveData->params.brakeLights = (bitRead(liveData->params.brakeLightInfo, 5) == 1);
|
||||
tempByte = liveData->hexToDecFromResponse(14, 16, 1, false);
|
||||
liveData->params.brakeLights = (bitRead(tempByte, 5) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* eNiro/Kona chargings limits depending on battery temperature (min.value of 01-04 battery module)
|
||||
/*
|
||||
eNiro/Kona chargings limits depending on battery temperature (min.value of 01-04 battery module)
|
||||
>= 35°C BMS allows max 180A
|
||||
>= 25°C without limit (200A)
|
||||
>= 15°C BMS allows max 120A
|
||||
>= 5°C BMS allows max 90A
|
||||
>= 1°C BMS allows max 60A
|
||||
<= 0°C BMS allows max 40A
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <stdint.h>
|
||||
@@ -20,8 +20,8 @@
|
||||
#define commandQueueLoopFromKiaENiro 8
|
||||
|
||||
/**
|
||||
* activateCommandQueue
|
||||
*/
|
||||
activateCommandQueue
|
||||
*/
|
||||
void CarKiaEniro::activateCommandQueue() {
|
||||
|
||||
String commandQueueKiaENiro[commandQueueCountKiaENiro] = {
|
||||
@@ -102,11 +102,11 @@ void CarKiaEniro::activateCommandQueue() {
|
||||
}
|
||||
|
||||
/**
|
||||
* parseRowMerged
|
||||
*/
|
||||
parseRowMerged
|
||||
*/
|
||||
void CarKiaEniro::parseRowMerged() {
|
||||
|
||||
bool tempByte;
|
||||
uint8_t tempByte;
|
||||
float tempFloat;
|
||||
String tmpStr;
|
||||
|
||||
@@ -123,21 +123,31 @@ void CarKiaEniro::parseRowMerged() {
|
||||
// IGPM
|
||||
if (liveData->currentAtshRequest.equals("ATSH770")) {
|
||||
if (liveData->commandRequest.equals("22BC03")) {
|
||||
//
|
||||
tempByte = liveData->hexToDecFromResponse(14, 16, 1, false);
|
||||
liveData->params.trunkDoorOpen = (bitRead(tempByte, 7) == 1);
|
||||
liveData->params.leftFrontDoorOpen = (bitRead(tempByte, 5) == 1);
|
||||
liveData->params.rightFrontDoorOpen = (bitRead(tempByte, 4) == 1);
|
||||
liveData->params.rightRearDoorOpen = (bitRead(tempByte, 2) == 1);
|
||||
liveData->params.leftRearDoorOpen = (bitRead(tempByte, 0) == 1);
|
||||
//
|
||||
tempByte = liveData->hexToDecFromResponse(16, 18, 1, false);
|
||||
liveData->params.ignitionOn = (bitRead(tempByte, 5) == 1);
|
||||
liveData->params.hoodOpen = (bitRead(tempByte, 0) == 1);
|
||||
if (liveData->params.ignitionOn) {
|
||||
liveData->params.lastIgnitionOnTime = liveData->params.currentTime;
|
||||
}
|
||||
|
||||
int32_t secDiff = liveData->params.currentTime - liveData->params.currentTime;
|
||||
if (liveData->commConnected && secDiff > 30 && secDiff < MONTH_SEC && !liveData->params.ignitionOn && !liveData->params.chargingOn)
|
||||
liveData->params.automaticShutdownTimer = liveData->params.currentTime;
|
||||
liveData->params.lightInfo = liveData->hexToDecFromResponse(18, 20, 1, false);
|
||||
liveData->params.headLights = (bitRead(liveData->params.lightInfo, 5) == 1);
|
||||
liveData->params.dayLights = (bitRead(liveData->params.lightInfo, 3) == 1);
|
||||
tempByte = liveData->hexToDecFromResponse(18, 20, 1, false);
|
||||
liveData->params.headLights = (bitRead(tempByte, 5) == 1);
|
||||
liveData->params.dayLights = (bitRead(tempByte, 3) == 1);
|
||||
}
|
||||
if (liveData->commandRequest.equals("22BC06")) {
|
||||
liveData->params.brakeLightInfo = liveData->hexToDecFromResponse(14, 16, 1, false);
|
||||
liveData->params.brakeLights = (bitRead(liveData->params.brakeLightInfo, 5) == 1);
|
||||
tempByte = liveData->hexToDecFromResponse(14, 16, 1, false);
|
||||
liveData->params.brakeLights = (bitRead(tempByte, 5) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,8 +315,8 @@ void CarKiaEniro::parseRowMerged() {
|
||||
}
|
||||
|
||||
/**
|
||||
* loadTestData
|
||||
*/
|
||||
loadTestData
|
||||
*/
|
||||
void CarKiaEniro::loadTestData() {
|
||||
|
||||
// IGPM
|
||||
|
||||
@@ -28,15 +28,18 @@ void LiveData::initParams() {
|
||||
params.operationTimeSec = 0;
|
||||
params.chargingStartTime = params.currentTime = 0;
|
||||
params.chargingOn = false;
|
||||
params.lightInfo = 0;
|
||||
params.headLights = false;
|
||||
params.dayLights = false;
|
||||
params.brakeLights = false;
|
||||
params.brakeLightInfo = 0;
|
||||
params.trunkDoorOpen = false;
|
||||
params.leftFrontDoorOpen = false;
|
||||
params.rightFrontDoorOpen = false;
|
||||
params.leftRearDoorOpen = false;
|
||||
params.rightRearDoorOpen = false;
|
||||
params.hoodOpen = false;
|
||||
params.forwardDriveMode = false;
|
||||
params.reverseDriveMode = false;
|
||||
params.parkModeOrNeutral = false;
|
||||
params.espState = 0;
|
||||
params.speedKmh = -1;
|
||||
params.motorRpm = -1;
|
||||
params.odoKm = -1;
|
||||
|
||||
10
LiveData.h
10
LiveData.h
@@ -68,9 +68,15 @@ typedef struct {
|
||||
bool headLights;
|
||||
bool dayLights;
|
||||
bool brakeLights;
|
||||
uint8_t lightInfo;
|
||||
bool trunkDoorOpen;
|
||||
bool leftFrontDoorOpen;
|
||||
bool rightFrontDoorOpen;
|
||||
bool leftRearDoorOpen;
|
||||
bool rightRearDoorOpen;
|
||||
bool hoodOpen;
|
||||
/* uint8_t lightInfo;
|
||||
uint8_t brakeLightInfo;
|
||||
uint8_t espState;
|
||||
uint8_t espState;*/
|
||||
float batteryTotalAvailableKWh;
|
||||
float speedKmh;
|
||||
float motorRpm;
|
||||
|
||||
Reference in New Issue
Block a user