Merge branch 'master' of https://github.com/nickn17/evDash
This commit is contained in:
176
Board320_240.cpp
176
Board320_240.cpp
@@ -30,7 +30,7 @@ void Board320_240::initBoard() {
|
||||
liveData->params.chargingStartTime = liveData->params.currentTime = mktime(&now);
|
||||
|
||||
// Init display
|
||||
Serial.println("Init tft display");
|
||||
syslog->println("Init tft display");
|
||||
tft.begin();
|
||||
tft.invertDisplay(invertDisplay);
|
||||
tft.setRotation(liveData->settings.displayRotation);
|
||||
@@ -61,24 +61,24 @@ void Board320_240::afterSetup() {
|
||||
// Starting Wifi after BLE prevents reboot loop
|
||||
if (liveData->settings.wifiEnabled == 1) {
|
||||
|
||||
/*Serial.print("memReport(): MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM bytes free. ");
|
||||
Serial.println(heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM));
|
||||
/*syslog->print("memReport(): MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM bytes free. ");
|
||||
syslog->println(heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM));
|
||||
|
||||
Serial.println("WiFi init...");
|
||||
syslog->println("WiFi init...");
|
||||
WiFi.enableSTA(true);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(liveData->settings.wifiSsid, liveData->settings.wifiPassword);
|
||||
Serial.println("WiFi init completed...");*/
|
||||
syslog->println("WiFi init completed...");*/
|
||||
}
|
||||
|
||||
// Init GPS
|
||||
if (liveData->settings.gpsHwSerialPort <= 2) {
|
||||
Serial.print("GPS initialization on hwUart: ");
|
||||
Serial.println(liveData->settings.gpsHwSerialPort);
|
||||
syslog->print("GPS initialization on hwUart: ");
|
||||
syslog->println(liveData->settings.gpsHwSerialPort);
|
||||
if (liveData->settings.gpsHwSerialPort == 0) {
|
||||
Serial.println("hwUart0 collision with serial console! Disabling serial console");
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
syslog->println("hwUart0 collision with serial console! Disabling serial console");
|
||||
syslog->flush();
|
||||
syslog->end();
|
||||
}
|
||||
gpsHwUart = new HardwareSerial(liveData->settings.gpsHwSerialPort);
|
||||
gpsHwUart->begin(9600);
|
||||
@@ -87,7 +87,7 @@ void Board320_240::afterSetup() {
|
||||
// SD card
|
||||
if (liveData->settings.sdcardEnabled == 1) {
|
||||
if (sdcardMount() && liveData->settings.sdcardAutstartLog == 1) {
|
||||
Serial.println("Toggle recording on SD card");
|
||||
syslog->println("Toggle recording on SD card");
|
||||
sdcardToggleRecording();
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ void Board320_240::afterSetup() {
|
||||
}
|
||||
|
||||
// Init from parent class
|
||||
Serial.println("BoardInterface::afterSetup");
|
||||
syslog->println("BoardInterface::afterSetup");
|
||||
BoardInterface::afterSetup();
|
||||
}
|
||||
|
||||
@@ -881,6 +881,15 @@ String Board320_240::menuItemCaption(int16_t menuItemId, String title) {
|
||||
break;*/
|
||||
case MENU_GPRS: sprintf(tmpStr1, "[HW UART=%d]", liveData->settings.gprsHwSerialPort); suffix = (liveData->settings.gprsHwSerialPort == 255) ? "[off]" : tmpStr1; break;
|
||||
case MENU_SDCARD: sprintf(tmpStr1, "[%d] %lluMB", SD.cardType(), SD.cardSize() / (1024 * 1024)); suffix = tmpStr1; break;
|
||||
case MENU_SERIAL_CONSOLE: suffix = (liveData->settings.serialConsolePort == 255) ? "[off]" : "[on]"; break;
|
||||
case MENU_DEBUG_LEVEL: switch (liveData->settings.debugLevel) {
|
||||
case 0: suffix = "[all]" ; break;
|
||||
case 1: suffix = "[comm]" ; break;
|
||||
case 2: suffix = "[gsm]" ; break;
|
||||
case 3: suffix = "[sdcard]" ; break;
|
||||
default: suffix = "[unknown]";
|
||||
}
|
||||
break;
|
||||
case MENU_SCREEN_ROTATION: suffix = (liveData->settings.displayRotation == 1) ? "[vertical]" : "[normal]"; break;
|
||||
case MENU_DEFAULT_SCREEN: sprintf(tmpStr1, "[%d]", liveData->settings.defaultScreen); suffix = tmpStr1; break;
|
||||
case MENU_SCREEN_BRIGHTNESS: sprintf(tmpStr1, "[%d%%]", liveData->settings.lcdBrightness); suffix = (liveData->settings.lcdBrightness == 0) ? "[auto]" : tmpStr1; break;
|
||||
@@ -895,6 +904,7 @@ String Board320_240::menuItemCaption(int16_t menuItemId, String title) {
|
||||
(strlen(liveData->params.sdcardFilename) != 0) ? liveData->params.sdcardFilename :
|
||||
(liveData->params.sdcardInit) ? "READY" : "MOUNT"); suffix = tmpStr1; break;
|
||||
case MENU_SDCARD_REC: sprintf(tmpStr1, "[%s]", (liveData->settings.sdcardEnabled == 0) ? "n/a" : (liveData->params.sdcardRecording) ? "STOP" : "START"); suffix = tmpStr1; break;
|
||||
case MENU_SDCARD_INTERVAL: sprintf(tmpStr1, "[%d]", liveData->settings.sdcardLogIntervalSec); suffix = tmpStr1; break;
|
||||
//
|
||||
case MENU_WIFI_ENABLED: suffix = (liveData->settings.wifiEnabled == 1) ? "[on]" : "[off]"; break;
|
||||
case MENU_WIFI_SSID: sprintf(tmpStr1, "%s", liveData->settings.wifiSsid); suffix = tmpStr1; break;
|
||||
@@ -1001,12 +1011,12 @@ void Board320_240::menuItemClick() {
|
||||
// Exit menu, parent level menu, open item
|
||||
bool showParentMenu = false;
|
||||
if (liveData->menuItemSelected > 0) {
|
||||
Serial.println(tmpMenuItem->id);
|
||||
syslog->println(tmpMenuItem->id);
|
||||
// Device list
|
||||
if (tmpMenuItem->id > 10000 && tmpMenuItem->id < 10100) {
|
||||
strlcpy((char*)liveData->settings.obdMacAddress, (char*)tmpMenuItem->obdMacAddress, 20);
|
||||
Serial.print("Selected adapter MAC address ");
|
||||
Serial.println(liveData->settings.obdMacAddress);
|
||||
syslog->print("Selected adapter MAC address ");
|
||||
syslog->println(liveData->settings.obdMacAddress);
|
||||
saveSettings();
|
||||
ESP.restart();
|
||||
}
|
||||
@@ -1043,6 +1053,8 @@ void Board320_240::menuItemClick() {
|
||||
case MENU_HEADLIGHTS_REMINDER: liveData->settings.headlightsReminder = (liveData->settings.headlightsReminder == 1) ? 0 : 1; showMenu(); return; break;
|
||||
case MENU_GPRS: liveData->settings.gprsHwSerialPort = (liveData->settings.gprsHwSerialPort == 2) ? 255 : liveData->settings.gprsHwSerialPort + 1; showMenu(); return; break;
|
||||
case MENU_GPS: liveData->settings.gpsHwSerialPort = (liveData->settings.gpsHwSerialPort == 2) ? 255 : liveData->settings.gpsHwSerialPort + 1; showMenu(); return; break;
|
||||
case MENU_SERIAL_CONSOLE: liveData->settings.serialConsolePort = (liveData->settings.serialConsolePort == 0) ? 255 : liveData->settings.serialConsolePort + 1; showMenu(); return; break;
|
||||
case MENU_DEBUG_LEVEL: liveData->settings.debugLevel = (liveData->settings.debugLevel == 3) ? 0 : liveData->settings.debugLevel + 1; syslog->setDebugLevel(liveData->settings.debugLevel); showMenu(); return; break;
|
||||
// Wifi menu
|
||||
case MENU_WIFI_ENABLED: liveData->settings.wifiEnabled = (liveData->settings.wifiEnabled == 1) ? 0 : 1; showMenu(); return; break;
|
||||
case MENU_WIFI_SSID: return; break;
|
||||
@@ -1069,22 +1081,22 @@ void Board320_240::menuItemClick() {
|
||||
case 9: saveSettings(); break;
|
||||
// Version
|
||||
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);*/
|
||||
/* 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;
|
||||
@@ -1113,7 +1125,7 @@ void Board320_240::menuItemClick() {
|
||||
}
|
||||
}
|
||||
liveData->menuCurrent = parentMenu;
|
||||
Serial.println(liveData->menuCurrent);
|
||||
syslog->println(liveData->menuCurrent);
|
||||
showMenu();
|
||||
}
|
||||
return;
|
||||
@@ -1248,7 +1260,7 @@ void Board320_240::redrawScreen() {
|
||||
*/
|
||||
void Board320_240::loadTestData() {
|
||||
|
||||
Serial.println("Loading test data");
|
||||
syslog->println("Loading test data");
|
||||
|
||||
testDataMode = true; // skip lights off message
|
||||
carInterface->loadTestData();
|
||||
@@ -1346,18 +1358,18 @@ void Board320_240::mainLoop() {
|
||||
if (liveData->params.sdcardInit && liveData->params.sdcardRecording && liveData->params.sdcardCanNotify &&
|
||||
(liveData->params.odoKm != -1 && liveData->params.socPerc != -1)) {
|
||||
|
||||
//Serial.println(&now, "%y%m%d%H%M");
|
||||
//syslog->println(&now, "%y%m%d%H%M");
|
||||
|
||||
// create filename
|
||||
if (liveData->params.operationTimeSec > 0 && strlen(liveData->params.sdcardFilename) == 0) {
|
||||
sprintf(liveData->params.sdcardFilename, "/%llu.json", uint64_t(liveData->params.operationTimeSec / 60));
|
||||
Serial.print("Log filename by opTimeSec: ");
|
||||
Serial.println(liveData->params.sdcardFilename);
|
||||
syslog->print("Log filename by opTimeSec: ");
|
||||
syslog->println(liveData->params.sdcardFilename);
|
||||
}
|
||||
if (liveData->params.currTimeSyncWithGps && strlen(liveData->params.sdcardFilename) < 15) {
|
||||
strftime(liveData->params.sdcardFilename, sizeof(liveData->params.sdcardFilename), "/%y%m%d%H%M.json", &now);
|
||||
Serial.print("Log filename by GPS: ");
|
||||
Serial.println(liveData->params.sdcardFilename);
|
||||
syslog->print("Log filename by GPS: ");
|
||||
syslog->println(liveData->params.sdcardFilename);
|
||||
}
|
||||
|
||||
// append buffer, clear buffer & notify state
|
||||
@@ -1365,14 +1377,14 @@ void Board320_240::mainLoop() {
|
||||
liveData->params.sdcardCanNotify = false;
|
||||
File file = SD.open(liveData->params.sdcardFilename, FILE_APPEND);
|
||||
if (!file) {
|
||||
Serial.println("Failed to open file for appending");
|
||||
syslog->println("Failed to open file for appending");
|
||||
File file = SD.open(liveData->params.sdcardFilename, FILE_WRITE);
|
||||
}
|
||||
if (!file) {
|
||||
Serial.println("Failed to create file");
|
||||
syslog->println("Failed to create file");
|
||||
}
|
||||
if (file) {
|
||||
Serial.println("Save buffer to SD card");
|
||||
syslog->println("Save buffer to SD card");
|
||||
serializeParamsToJson(file);
|
||||
file.print(",\n");
|
||||
file.close();
|
||||
@@ -1401,7 +1413,7 @@ bool Board320_240::skipAdapterScan() {
|
||||
bool Board320_240::sdcardMount() {
|
||||
|
||||
if (liveData->params.sdcardInit) {
|
||||
Serial.print("SD card already mounted...");
|
||||
syslog->print("SD card already mounted...");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1409,47 +1421,47 @@ bool Board320_240::sdcardMount() {
|
||||
bool SdState = false;
|
||||
|
||||
while (1) {
|
||||
Serial.print("Initializing SD card...");
|
||||
syslog->print("Initializing SD card...");
|
||||
|
||||
#ifdef BOARD_TTGO_T4
|
||||
Serial.print(" TTGO-T4 ");
|
||||
syslog->print(" TTGO-T4 ");
|
||||
SPIClass * hspi = new SPIClass(HSPI);
|
||||
spiSD.begin(pinSdcardSclk, pinSdcardMiso, pinSdcardMosi, pinSdcardCs); //SCK,MISO,MOSI,ss
|
||||
SdState = SD.begin(pinSdcardCs, *hspi, SPI_FREQUENCY);
|
||||
#endif BOARD_TTGO_T4
|
||||
|
||||
Serial.print(" M5STACK ");
|
||||
syslog->print(" M5STACK ");
|
||||
SdState = SD.begin(pinSdcardCs);
|
||||
|
||||
if (SdState) {
|
||||
|
||||
uint8_t cardType = SD.cardType();
|
||||
if (cardType == CARD_NONE) {
|
||||
Serial.println("No SD card attached");
|
||||
syslog->println("No SD card attached");
|
||||
return false;
|
||||
}
|
||||
|
||||
Serial.println("SD card found.");
|
||||
syslog->println("SD card found.");
|
||||
liveData->params.sdcardInit = true;
|
||||
|
||||
Serial.print("SD Card Type: ");
|
||||
syslog->print("SD Card Type: ");
|
||||
if (cardType == CARD_MMC) {
|
||||
Serial.println("MMC");
|
||||
syslog->println("MMC");
|
||||
} else if (cardType == CARD_SD) {
|
||||
Serial.println("SDSC");
|
||||
syslog->println("SDSC");
|
||||
} else if (cardType == CARD_SDHC) {
|
||||
Serial.println("SDHC");
|
||||
syslog->println("SDHC");
|
||||
} else {
|
||||
Serial.println("UNKNOWN");
|
||||
syslog->println("UNKNOWN");
|
||||
}
|
||||
|
||||
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
|
||||
Serial.printf("SD Card Size: %lluMB\n", cardSize);
|
||||
syslog->printf("SD Card Size: %lluMB\n", cardSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Serial.println("Initialization failed!");
|
||||
syslog->println("Initialization failed!");
|
||||
countdown--;
|
||||
if (countdown <= 0) {
|
||||
break;
|
||||
@@ -1468,7 +1480,7 @@ void Board320_240::sdcardToggleRecording() {
|
||||
if (!liveData->params.sdcardInit)
|
||||
return;
|
||||
|
||||
Serial.println("Toggle SD card recording...");
|
||||
syslog->println("Toggle SD card recording...");
|
||||
liveData->params.sdcardRecording = !liveData->params.sdcardRecording;
|
||||
if (liveData->params.sdcardRecording) {
|
||||
liveData->params.sdcardCanNotify = true;
|
||||
@@ -1491,8 +1503,8 @@ void Board320_240::syncGPS() {
|
||||
}
|
||||
if (gps.satellites.isValid()) {
|
||||
liveData->params.gpsSat = gps.satellites.value();
|
||||
//Serial.print("GPS satellites: ");
|
||||
//Serial.println(liveData->params.gpsSat);
|
||||
//syslog->print("GPS satellites: ");
|
||||
//syslog->println(liveData->params.gpsSat);
|
||||
}
|
||||
if (!liveData->params.currTimeSyncWithGps && gps.date.isValid() && gps.time.isValid()) {
|
||||
liveData->params.currTimeSyncWithGps = true;
|
||||
@@ -1516,8 +1528,8 @@ void Board320_240::syncGPS() {
|
||||
SIM800L
|
||||
*/
|
||||
bool Board320_240::sim800lSetup() {
|
||||
Serial.print("Setting SIM800L module. HW port: ");
|
||||
Serial.println(liveData->settings.gprsHwSerialPort);
|
||||
syslog->print("Setting SIM800L module. HW port: ");
|
||||
syslog->println(liveData->settings.gprsHwSerialPort);
|
||||
|
||||
gprsHwUart = new HardwareSerial(liveData->settings.gprsHwSerialPort);
|
||||
gprsHwUart->begin(9600);
|
||||
@@ -1528,31 +1540,31 @@ bool Board320_240::sim800lSetup() {
|
||||
|
||||
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");
|
||||
syslog->println("Problem to initialize SIM800L module, retry in 1 sec");
|
||||
delay(1000);
|
||||
sim800l_ready = sim800l->isReady();
|
||||
}
|
||||
|
||||
if (!sim800l_ready) {
|
||||
Serial.println("Problem to initialize SIM800L module");
|
||||
syslog->println("Problem to initialize SIM800L module");
|
||||
} else {
|
||||
Serial.println("SIM800L module initialized");
|
||||
syslog->println("SIM800L module initialized");
|
||||
|
||||
Serial.print("Setting GPRS APN to: ");
|
||||
Serial.println(liveData->settings.gprsApn);
|
||||
syslog->print("Setting GPRS APN to: ");
|
||||
syslog->println(liveData->settings.gprsApn);
|
||||
|
||||
bool sim800l_gprs = sim800l->setupGPRS(liveData->settings.gprsApn);
|
||||
for (uint8_t i = 0; i < 5 && !sim800l_gprs; i++) {
|
||||
Serial.println("Problem to set GPRS APN, retry in 1 sec");
|
||||
syslog->println("Problem to set GPRS APN, retry in 1 sec");
|
||||
delay(1000);
|
||||
sim800l_gprs = sim800l->setupGPRS(liveData->settings.gprsApn);
|
||||
}
|
||||
|
||||
if (sim800l_gprs) {
|
||||
liveData->params.sim800l_enabled = true;
|
||||
Serial.println("GPRS APN set OK");
|
||||
syslog->println("GPRS APN set OK");
|
||||
} else {
|
||||
Serial.println("Problem to set GPRS APN");
|
||||
syslog->println("Problem to set GPRS APN");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1560,31 +1572,31 @@ bool Board320_240::sim800lSetup() {
|
||||
}
|
||||
|
||||
bool Board320_240::sendDataViaGPRS() {
|
||||
Serial.println("Sending data via GPRS");
|
||||
syslog->println("Sending data via GPRS");
|
||||
|
||||
if (liveData->params.socPerc < 0) {
|
||||
Serial.println("No valid data, skipping data send");
|
||||
syslog->println("No valid data, skipping data send");
|
||||
return false;
|
||||
}
|
||||
|
||||
NetworkRegistration network = sim800l->getRegistrationStatus();
|
||||
if (network != REGISTERED_HOME && network != REGISTERED_ROAMING) {
|
||||
Serial.println("SIM800L module not connected to network, skipping data send");
|
||||
syslog->println("SIM800L module not connected to network, skipping data send");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sim800l->isConnectedGPRS()) {
|
||||
Serial.println("GPRS not connected... Connecting");
|
||||
syslog->println("GPRS not connected... Connecting");
|
||||
bool connected = sim800l->connectGPRS();
|
||||
for (uint8_t i = 0; i < 5 && !connected; i++) {
|
||||
Serial.println("Problem to connect GPRS, retry in 1 sec");
|
||||
syslog->println("Problem to connect GPRS, retry in 1 sec");
|
||||
delay(1000);
|
||||
connected = sim800l->connectGPRS();
|
||||
}
|
||||
if (connected) {
|
||||
Serial.println("GPRS connected!");
|
||||
syslog->println("GPRS connected!");
|
||||
} else {
|
||||
Serial.println("GPRS not connected! Reseting SIM800L module!");
|
||||
syslog->println("GPRS not connected! Reseting SIM800L module!");
|
||||
sim800l->reset();
|
||||
sim800lSetup();
|
||||
|
||||
@@ -1592,7 +1604,7 @@ bool Board320_240::sendDataViaGPRS() {
|
||||
}
|
||||
}
|
||||
|
||||
Serial.println("Start HTTP POST...");
|
||||
syslog->println("Start HTTP POST...");
|
||||
|
||||
StaticJsonDocument<512> jsonData;
|
||||
|
||||
@@ -1617,19 +1629,19 @@ bool Board320_240::sendDataViaGPRS() {
|
||||
char payload[512];
|
||||
serializeJson(jsonData, payload);
|
||||
|
||||
Serial.print("Sending payload: ");
|
||||
Serial.println(payload);
|
||||
syslog->print("Sending payload: ");
|
||||
syslog->println(payload);
|
||||
|
||||
Serial.print("Remote API server: ");
|
||||
Serial.println(liveData->settings.remoteApiUrl);
|
||||
syslog->print("Remote API server: ");
|
||||
syslog->println(liveData->settings.remoteApiUrl);
|
||||
|
||||
uint16_t rc = sim800l->doPost(liveData->settings.remoteApiUrl, "application/json", payload, 10000, 10000);
|
||||
if (rc == 200) {
|
||||
Serial.println("HTTP POST successful");
|
||||
syslog->println("HTTP POST successful");
|
||||
} else {
|
||||
// Failed...
|
||||
Serial.print("HTTP POST error: ");
|
||||
Serial.println(rc);
|
||||
syslog->print("HTTP POST error: ");
|
||||
syslog->println(rc);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -28,7 +28,7 @@ void BoardInterface::attachCar(CarInterface* pCarInterface) {
|
||||
*/
|
||||
void BoardInterface::shutdownDevice() {
|
||||
|
||||
Serial.println("Shutdown.");
|
||||
syslog->println("Shutdown.");
|
||||
|
||||
char msg[20];
|
||||
for (int i = 3; i >= 1; i--) {
|
||||
@@ -65,7 +65,7 @@ void BoardInterface::shutdownDevice() {
|
||||
void BoardInterface::saveSettings() {
|
||||
|
||||
// Flash to memory
|
||||
Serial.println("Settings saved to eeprom.");
|
||||
syslog->println("Settings saved to eeprom.");
|
||||
EEPROM.put(0, liveData->settings);
|
||||
EEPROM.commit();
|
||||
}
|
||||
@@ -76,7 +76,7 @@ void BoardInterface::saveSettings() {
|
||||
void BoardInterface::resetSettings() {
|
||||
|
||||
// Flash to memory
|
||||
Serial.println("Factory reset.");
|
||||
syslog->println("Factory reset.");
|
||||
liveData->settings.initFlag = 1;
|
||||
EEPROM.put(0, liveData->settings);
|
||||
EEPROM.commit();
|
||||
@@ -143,17 +143,17 @@ void BoardInterface::loadSettings() {
|
||||
liveData->settings.gprsLogIntervalSec = 60;
|
||||
|
||||
// Load settings and replace default values
|
||||
Serial.println("Reading settings from eeprom.");
|
||||
syslog->println("Reading settings from eeprom.");
|
||||
EEPROM.begin(sizeof(SETTINGS_STRUC));
|
||||
EEPROM.get(0, liveData->tmpSettings);
|
||||
|
||||
// Init flash with default settings
|
||||
if (liveData->tmpSettings.initFlag != 183) {
|
||||
Serial.println("Settings not found. Initialization.");
|
||||
syslog->println("Settings not found. Initialization.");
|
||||
saveSettings();
|
||||
} else {
|
||||
Serial.print("Loaded settings ver.: ");
|
||||
Serial.println(liveData->tmpSettings.settingsVersion);
|
||||
syslog->print("Loaded settings ver.: ");
|
||||
syslog->println(liveData->tmpSettings.settingsVersion);
|
||||
|
||||
// Upgrade structure
|
||||
if (liveData->settings.settingsVersion != liveData->tmpSettings.settingsVersion) {
|
||||
@@ -211,6 +211,8 @@ void BoardInterface::loadSettings() {
|
||||
// Apply settings from flash if needed
|
||||
liveData->settings = liveData->tmpSettings;
|
||||
}
|
||||
|
||||
syslog->setDebugLevel(liveData->settings.debugLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,8 +221,8 @@ void BoardInterface::loadSettings() {
|
||||
void BoardInterface::afterSetup() {
|
||||
|
||||
// Init Comm iterface
|
||||
Serial.print("Init communication device: ");
|
||||
Serial.println(liveData->settings.commType);
|
||||
syslog->print("Init communication device: ");
|
||||
syslog->println(liveData->settings.commType);
|
||||
|
||||
if (liveData->settings.commType == COMM_TYPE_OBD2BLE4) {
|
||||
commInterface = new CommObd2Ble4();
|
||||
@@ -228,7 +230,7 @@ void BoardInterface::afterSetup() {
|
||||
commInterface = new CommObd2Can();
|
||||
} else if (liveData->settings.commType == COMM_TYPE_OBD2BT3) {
|
||||
//commInterface = new CommObd2Bt3();
|
||||
Serial.println("BT3 not implemented");
|
||||
syslog->println("BT3 not implemented");
|
||||
}
|
||||
|
||||
commInterface->initComm(liveData, this);
|
||||
|
||||
24
CarBmwI3.cpp
24
CarBmwI3.cpp
@@ -87,15 +87,15 @@ void CarBmwI3::activateCommandQueue() {
|
||||
void CarBmwI3::parseRowMerged()
|
||||
{
|
||||
|
||||
// Serial.println("--Parsing row merged: ");
|
||||
// Serial.print("--responseRowMerged: "); Serial.println(liveData->responseRowMerged);
|
||||
// Serial.print("--currentAtshRequest: "); Serial.println(liveData->currentAtshRequest);
|
||||
// Serial.print("--commandRequest: "); Serial.println(liveData->commandRequest);
|
||||
// Serial.print("--mergedLength: "); Serial.println(liveData->responseRowMerged.length());
|
||||
Serial.print("--mergedVectorLength: "); Serial.println(liveData->vResponseRowMerged.size());
|
||||
// syslog->println("--Parsing row merged: ");
|
||||
// syslog->print("--responseRowMerged: "); syslog->println(liveData->responseRowMerged);
|
||||
// syslog->print("--currentAtshRequest: "); syslog->println(liveData->currentAtshRequest);
|
||||
// syslog->print("--commandRequest: "); syslog->println(liveData->commandRequest);
|
||||
// syslog->print("--mergedLength: "); syslog->println(liveData->responseRowMerged.length());
|
||||
syslog->print("--mergedVectorLength: "); syslog->println(liveData->vResponseRowMerged.size());
|
||||
|
||||
if (liveData->responseRowMerged.length() <= 6) {
|
||||
Serial.println("--too short data, skiping processing");
|
||||
syslog->println("--too short data, skiping processing");
|
||||
}
|
||||
|
||||
struct Header_t
|
||||
@@ -116,8 +116,8 @@ void CarBmwI3::parseRowMerged()
|
||||
std::vector<uint8_t> payloadReversed(pHeader->pData, pHeader->pData + payloadLength);
|
||||
std::reverse(payloadReversed.begin(), payloadReversed.end());
|
||||
|
||||
//Serial.print("--extracted PID: "); Serial.println(pHeader->getPid());
|
||||
//Serial.print("--payload length: "); Serial.println(payloadLength);
|
||||
//syslog->print("--extracted PID: "); syslog->println(pHeader->getPid());
|
||||
//syslog->print("--payload length: "); syslog->println(payloadLength);
|
||||
|
||||
|
||||
// BMS
|
||||
@@ -301,9 +301,9 @@ void CarBmwI3::parseRowMerged()
|
||||
liveData->params.batTempC = ptr->tempAvg / 100.0;
|
||||
liveData->params.batMaxC = ptr->tempMax / 100.0;
|
||||
|
||||
Serial.print("----batMinC: "); Serial.println(liveData->params.batMinC);
|
||||
Serial.print("----batTemp: "); Serial.println(liveData->params.batTempC);
|
||||
Serial.print("----batMaxC: "); Serial.println(liveData->params.batMaxC);
|
||||
syslog->print("----batMinC: "); syslog->println(liveData->params.batMinC);
|
||||
syslog->print("----batTemp: "); syslog->println(liveData->params.batTempC);
|
||||
syslog->print("----batMaxC: "); syslog->println(liveData->params.batMaxC);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CarHyundaiIoniq.h"
|
||||
|
||||
#define commandQueueCountHyundaiIoniq 28
|
||||
#define commandQueueCountHyundaiIoniq 27
|
||||
#define commandQueueLoopFromHyundaiIoniq 8
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,6 @@ void CarHyundaiIoniq::activateCommandQueue() {
|
||||
"2103", // cell voltages, screen 3 only
|
||||
"2104", // cell voltages, screen 3 only
|
||||
"2105", // soh, soc, ..
|
||||
"2106", // cooling water temp
|
||||
|
||||
// VMCU
|
||||
"ATSH7E2",
|
||||
@@ -156,11 +155,12 @@ void CarHyundaiIoniq::parseRowMerged() {
|
||||
liveData->params.batFanStatus = liveData->hexToDecFromResponse(58, 60, 2, true);
|
||||
liveData->params.batFanFeedbackHz = liveData->hexToDecFromResponse(60, 62, 2, true);
|
||||
liveData->params.auxVoltage = liveData->hexToDecFromResponse(62, 64, 2, true) / 10.0;
|
||||
|
||||
float tmpAuxPerc;
|
||||
if(liveData->params.ignitionOn) {
|
||||
tmpAuxPerc = map(liveData->params.auxVoltage * 10, 128, 148, 0, 1000) / 10;
|
||||
tmpAuxPerc = (float)(liveData->params.auxVoltage - 12.8) * 100 / (float)(14.8 - 12.8); //min: 12.8V; max: 14.8V
|
||||
} else {
|
||||
tmpAuxPerc = map(liveData->params.auxVoltage * 10, 116, 128, 0, 1000) / 10;
|
||||
tmpAuxPerc = (float)(liveData->params.auxVoltage - 11.6) * 100 / (float)(12.8 - 11.6); //min 11.6V; max: 12.8V
|
||||
}
|
||||
if(tmpAuxPerc > 100) {
|
||||
liveData->params.auxPerc = 100;
|
||||
@@ -188,7 +188,7 @@ void CarHyundaiIoniq::parseRowMerged() {
|
||||
//liveData->params.batMinC = liveData->hexToDecFromResponse(34, 36, 1, true);
|
||||
|
||||
tempByte = liveData->hexToDecFromResponse(104, 106, 1, false);
|
||||
liveData->params.chargingOn = (bitRead(tempByte, 2) == 1);
|
||||
liveData->params.chargingOn = (bitRead(tempByte, 2) == 0);
|
||||
|
||||
// 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)
|
||||
liveData->params.batInletC = liveData->hexToDecFromResponse(48, 50, 1, true);
|
||||
@@ -292,11 +292,11 @@ void CarHyundaiIoniq::loadTestData() {
|
||||
liveData->currentAtshRequest = "ATSH7E2";
|
||||
// 2101
|
||||
liveData->commandRequest = "2101";
|
||||
liveData->responseRowMerged = "6101FFE0000009211222062F03000000001D7734";
|
||||
liveData->responseRowMerged = "6101FFE0000009215A09061803000000000E773404200000000000";
|
||||
parseRowMerged();
|
||||
// 2102
|
||||
liveData->commandRequest = "2102";
|
||||
liveData->responseRowMerged = "6102FF80000001010000009315B2888D390B08618B683900000000";
|
||||
liveData->responseRowMerged = "6102FF80000001010000009522C570273A0F0D9199953900000000";
|
||||
parseRowMerged();
|
||||
|
||||
// "ATSH7DF",
|
||||
@@ -306,52 +306,57 @@ void CarHyundaiIoniq::loadTestData() {
|
||||
liveData->currentAtshRequest = "ATSH7B3";
|
||||
// 220100
|
||||
liveData->commandRequest = "220100";
|
||||
liveData->responseRowMerged = "6201007E5007C8FF8A876A011010FFFF10FF10FFFFFFFFFFFFFFFFFF2EEF767D00FFFF00FFFF000000";
|
||||
liveData->responseRowMerged = "6201007E5007C8FF7A665D00A981FFFF81FF10FFFFFFFFFFFFFFFFFF44CAA7AD00FFFF01FFFF000000";
|
||||
parseRowMerged();
|
||||
// 220102
|
||||
liveData->commandRequest = "220102";
|
||||
liveData->responseRowMerged = "620102FF800000A3950000000000002600000000";
|
||||
liveData->responseRowMerged = "620102FF800000CA5E0101000101005100000000";
|
||||
parseRowMerged();
|
||||
|
||||
// BMS ATSH7E4
|
||||
liveData->currentAtshRequest = "ATSH7E4";
|
||||
// 220101
|
||||
liveData->commandRequest = "2101";
|
||||
liveData->responseRowMerged = "6101FFFFFFFF5026482648A3FFC30D9E181717171718170019B50FB501000090000142230001425F0000771B00007486007815D809015C0000000003E800";
|
||||
liveData->responseRowMerged = "6101FFFFFFFFBD136826480300220F600B0B0B0B0B0B0B000CCD05CC0A00009100012C4A00012A1800006F37000069F700346CC30D01890000000003E800";
|
||||
parseRowMerged();
|
||||
// 220102
|
||||
liveData->commandRequest = "2102";
|
||||
liveData->responseRowMerged = "6102FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
||||
liveData->responseRowMerged = "6102FFFFFFFFCDCDCDCDCDCDCDCDCDCCCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCCCDCDCD000000";
|
||||
parseRowMerged();
|
||||
// 220103
|
||||
liveData->commandRequest = "2103";
|
||||
liveData->responseRowMerged = "6103FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
||||
liveData->responseRowMerged = "6103FFFFFFFFCDCDCDCDCDCDCCCDCDCDCDCDCDCDCDCDCCCDCDCCCDCDCDCDCDCDCDCCCDCDCDCC000000";
|
||||
parseRowMerged();
|
||||
// 220104
|
||||
liveData->commandRequest = "2104";
|
||||
liveData->responseRowMerged = "6104FFFFFFFFB5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5000000";
|
||||
liveData->responseRowMerged = "6104FFFFFFFFCDCDCDCDCDCDCDCDCDCDCCCCCDCDCCCDCDCDCDCDCDCDCDCDCDCDCDCCCCCCCDCD000000";
|
||||
parseRowMerged();
|
||||
// 220105
|
||||
liveData->commandRequest = "2105";
|
||||
liveData->responseRowMerged = "6105FFFFFFFF00000000001717171817171726482648000150181703E81A03E801520029000000000000000000000000";
|
||||
parseRowMerged();
|
||||
// 220106
|
||||
liveData->commandRequest = "2106";
|
||||
liveData->responseRowMerged = "7F2112"; // n/a on ioniq
|
||||
liveData->responseRowMerged = "6105FFFFFFFF00000000000B0B0B0B0B0B0B136826480001500B0B03E80203E831C60031000000000000000000000000";
|
||||
parseRowMerged();
|
||||
|
||||
// BCM / TPMS ATSH7A0
|
||||
liveData->currentAtshRequest = "ATSH7A0";
|
||||
// 22c00b
|
||||
liveData->commandRequest = "22c00b";
|
||||
liveData->responseRowMerged = "62C00BFFFF0000B9510100B9510100B84F0100B54F0100AAAAAAAA";
|
||||
liveData->responseRowMerged = "62C00BFFFF0000B73D0100B63D0100B43D0100B53C0100AAAAAAAA";
|
||||
parseRowMerged();
|
||||
|
||||
// ATSH7C6
|
||||
liveData->currentAtshRequest = "ATSH7C6";
|
||||
// 22b002
|
||||
liveData->commandRequest = "22b002";
|
||||
liveData->responseRowMerged = "62B002E000000000AD003D2D0000000000000000";
|
||||
liveData->responseRowMerged = "62B002E000000000AA003B0B0000000000000000";
|
||||
parseRowMerged();
|
||||
|
||||
//ATSH770
|
||||
liveData->currentAtshRequest = "ATSH770";
|
||||
liveData->commandRequest = "22BC03";
|
||||
liveData->responseRowMerged = "62BC03FDEE3C7300600000AAAA";
|
||||
parseRowMerged();
|
||||
liveData->commandRequest = "22BC06";
|
||||
liveData->responseRowMerged = "62BC06B480000000000000AAAA";
|
||||
parseRowMerged();
|
||||
|
||||
/* liveData->params.batModule01TempC = 28;
|
||||
|
||||
134
CarKiaEniro.cpp
134
CarKiaEniro.cpp
@@ -16,7 +16,7 @@
|
||||
#include "LiveData.h"
|
||||
#include "CarKiaEniro.h"
|
||||
|
||||
#define commandQueueCountKiaENiro 30
|
||||
#define commandQueueCountKiaENiro 29
|
||||
#define commandQueueLoopFromKiaENiro 8
|
||||
|
||||
/**
|
||||
@@ -42,19 +42,32 @@ void CarKiaEniro::activateCommandQueue() {
|
||||
|
||||
// Loop from (KIA ENIRO)
|
||||
|
||||
// VMCU
|
||||
"ATSH7E2",
|
||||
"2101", // speed, ...
|
||||
"2102", // aux, ...
|
||||
// IGPM
|
||||
"ATSH770",
|
||||
"22BC03", // low beam
|
||||
"22BC06", // brake light
|
||||
|
||||
// ABS / ESP + AHB
|
||||
"ATSH7D1",
|
||||
"22C101", // brake, park/drive mode
|
||||
|
||||
// IGPM
|
||||
"ATSH770",
|
||||
"22BC03", // low beam
|
||||
"22BC06", // brake light
|
||||
// BCM / TPMS
|
||||
"ATSH7A0",
|
||||
"22c00b", // tire pressure/temp
|
||||
|
||||
// Aircondition
|
||||
"ATSH7B3",
|
||||
"220100", // in/out temp
|
||||
"220102", // coolant temp1, 2
|
||||
|
||||
// CLUSTER MODULE
|
||||
"ATSH7C6",
|
||||
"22B002", // odo
|
||||
|
||||
// VMCU
|
||||
"ATSH7E2",
|
||||
// "2101", // speed, ...
|
||||
"2102", // aux, ...
|
||||
|
||||
// BMS
|
||||
"ATSH7E4",
|
||||
@@ -65,19 +78,6 @@ void CarKiaEniro::activateCommandQueue() {
|
||||
"220105", // soh, soc, ..
|
||||
"220106", // cooling water temp
|
||||
|
||||
// Aircondition
|
||||
"ATSH7B3",
|
||||
"220100", // in/out temp
|
||||
"220102", // coolant temp1, 2
|
||||
|
||||
// BCM / TPMS
|
||||
"ATSH7A0",
|
||||
"22c00b", // tire pressure/temp
|
||||
|
||||
// CLUSTER MODULE
|
||||
"ATSH7C6",
|
||||
"22B002", // odo
|
||||
|
||||
};
|
||||
|
||||
// 39 or 64 kWh model?
|
||||
@@ -110,17 +110,8 @@ void CarKiaEniro::parseRowMerged() {
|
||||
float tempFloat;
|
||||
String tmpStr;
|
||||
|
||||
// ABS / ESP + AHB 7D1
|
||||
if (liveData->currentAtshRequest.equals("ATSH7D1")) {
|
||||
if (liveData->commandRequest.equals("22C101")) {
|
||||
uint8_t driveMode = liveData->hexToDecFromResponse(22, 24, 1, false);
|
||||
liveData->params.forwardDriveMode = (driveMode == 4);
|
||||
liveData->params.reverseDriveMode = (driveMode == 2);
|
||||
liveData->params.parkModeOrNeutral = (driveMode == 1);
|
||||
}
|
||||
}
|
||||
|
||||
// IGPM
|
||||
// RESPONDING WHEN CAR IS OFF
|
||||
if (liveData->currentAtshRequest.equals("ATSH770")) {
|
||||
if (liveData->commandRequest.equals("22BC03")) {
|
||||
//
|
||||
@@ -151,29 +142,34 @@ void CarKiaEniro::parseRowMerged() {
|
||||
}
|
||||
}
|
||||
|
||||
// VMCU 7E2
|
||||
if (liveData->currentAtshRequest.equals("ATSH7E2")) {
|
||||
if (liveData->commandRequest.equals("2101")) {
|
||||
liveData->params.speedKmh = liveData->hexToDecFromResponse(32, 36, 2, false) * 0.0155; // / 100.0 *1.609 = real to gps is 1.750
|
||||
if (liveData->params.speedKmh < -99 || liveData->params.speedKmh > 200)
|
||||
liveData->params.speedKmh = 0;
|
||||
}
|
||||
if (liveData->commandRequest.equals("2102")) {
|
||||
liveData->params.auxPerc = liveData->hexToDecFromResponse(50, 52, 1, false);
|
||||
liveData->params.auxCurrentAmp = - liveData->hexToDecFromResponse(46, 50, 2, true) / 1000.0;
|
||||
// ABS / ESP + AHB 7D1
|
||||
// RESPONDING WHEN CAR IS OFF
|
||||
if (liveData->currentAtshRequest.equals("ATSH7D1")) {
|
||||
if (liveData->commandRequest.equals("22C101")) {
|
||||
uint8_t driveMode = liveData->hexToDecFromResponse(22, 24, 1, false);
|
||||
liveData->params.forwardDriveMode = (driveMode == 4);
|
||||
liveData->params.reverseDriveMode = (driveMode == 2);
|
||||
liveData->params.parkModeOrNeutral = (driveMode == 1);
|
||||
// Speed
|
||||
liveData->params.speedKmh = liveData->hexToDecFromResponse(18, 20, 2, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Cluster module 7c6
|
||||
if (liveData->currentAtshRequest.equals("ATSH7C6")) {
|
||||
if (liveData->commandRequest.equals("22B002")) {
|
||||
tempFloat = liveData->params.odoKm;
|
||||
liveData->params.odoKm = liveData->decFromResponse(18, 24);
|
||||
//if (tempFloat != liveData->params.odoKm) liveData->params.sdcardCanNotify = true;
|
||||
// TPMS 7A0
|
||||
if (liveData->currentAtshRequest.equals("ATSH7A0")) {
|
||||
if (liveData->commandRequest.equals("22c00b")) {
|
||||
liveData->params.tireFrontLeftPressureBar = liveData->hexToDecFromResponse(14, 16, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireFrontRightPressureBar = liveData->hexToDecFromResponse(22, 24, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireRearRightPressureBar = liveData->hexToDecFromResponse(30, 32, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireRearLeftPressureBar = liveData->hexToDecFromResponse(38, 40, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireFrontLeftTempC = liveData->hexToDecFromResponse(16, 18, 2, false) - 50; // === OK Valid
|
||||
liveData->params.tireFrontRightTempC = liveData->hexToDecFromResponse(24, 26, 2, false) - 50; // === OK Valid
|
||||
liveData->params.tireRearRightTempC = liveData->hexToDecFromResponse(32, 34, 2, false) - 50; // === OK Valid
|
||||
liveData->params.tireRearLeftTempC = liveData->hexToDecFromResponse(40, 42, 2, false) - 50; // === OK Valid
|
||||
}
|
||||
}
|
||||
|
||||
// Aircon 7b3
|
||||
// Aircon 7B3
|
||||
if (liveData->currentAtshRequest.equals("ATSH7B3")) {
|
||||
if (liveData->commandRequest.equals("220100")) {
|
||||
liveData->params.indoorTemperature = (liveData->hexToDecFromResponse(16, 18, 1, false) / 2) - 40;
|
||||
@@ -185,6 +181,29 @@ void CarKiaEniro::parseRowMerged() {
|
||||
}
|
||||
}
|
||||
|
||||
// Cluster module 7C6
|
||||
if (liveData->currentAtshRequest.equals("ATSH7C6")) {
|
||||
if (liveData->commandRequest.equals("22B002")) {
|
||||
tempFloat = liveData->params.odoKm;
|
||||
liveData->params.odoKm = liveData->decFromResponse(18, 24);
|
||||
//if (tempFloat != liveData->params.odoKm) liveData->params.sdcardCanNotify = true;
|
||||
}
|
||||
}
|
||||
|
||||
// VMCU 7E2
|
||||
if (liveData->currentAtshRequest.equals("ATSH7E2")) {
|
||||
/*if (liveData->commandRequest.equals("2101")) {
|
||||
liveData->params.speedKmh = liveData->hexToDecFromResponse(32, 36, 2, false) * 0.0155; // / 100.0 *1.609 = real to gps is 1.750
|
||||
if (liveData->params.speedKmh < -99 || liveData->params.speedKmh > 200)
|
||||
liveData->params.speedKmh = 0;
|
||||
}*/
|
||||
if (liveData->commandRequest.equals("2102")) {
|
||||
liveData->params.auxVoltage = liveData->hexToDecFromResponse(42, 46, 2, true) / 1000.0;
|
||||
liveData->params.auxCurrentAmp = - liveData->hexToDecFromResponse(46, 50, 2, true) / 1000.0;
|
||||
liveData->params.auxPerc = liveData->hexToDecFromResponse(50, 52, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
// BMS 7e4
|
||||
if (liveData->currentAtshRequest.equals("ATSH7E4")) {
|
||||
if (liveData->commandRequest.equals("220101")) {
|
||||
@@ -200,7 +219,6 @@ void CarKiaEniro::parseRowMerged() {
|
||||
//liveData->params.isolationResistanceKOhm = liveData->hexToDecFromResponse(118, 122, 2, true);
|
||||
liveData->params.batFanStatus = liveData->hexToDecFromResponse(60, 62, 2, true);
|
||||
liveData->params.batFanFeedbackHz = liveData->hexToDecFromResponse(62, 64, 2, true);
|
||||
liveData->params.auxVoltage = liveData->hexToDecFromResponse(64, 66, 2, true) / 10.0;
|
||||
liveData->params.batPowerAmp = - liveData->hexToDecFromResponse(26, 30, 2, true) / 10.0;
|
||||
liveData->params.batVoltage = liveData->hexToDecFromResponse(30, 34, 2, false) / 10.0;
|
||||
liveData->params.batPowerKw = (liveData->params.batPowerAmp * liveData->params.batVoltage) / 1000.0;
|
||||
@@ -290,7 +308,7 @@ void CarKiaEniro::parseRowMerged() {
|
||||
}
|
||||
// BMS 7e4
|
||||
if (liveData->commandRequest.equals("220106")) {
|
||||
liveData->params.coolingWaterTempC = liveData->hexToDecFromResponse(14, 16, 1, false);
|
||||
liveData->params.coolingWaterTempC = liveData->hexToDecFromResponse(14, 16, 1, true);
|
||||
liveData->params.bmsUnknownTempC = liveData->hexToDecFromResponse(18, 20, 1, true);
|
||||
liveData->params.bmsUnknownTempD = liveData->hexToDecFromResponse(46, 48, 1, true);
|
||||
// log 220106 to sdcard
|
||||
@@ -298,20 +316,6 @@ void CarKiaEniro::parseRowMerged() {
|
||||
tmpStr.toCharArray(liveData->params.debugData2, tmpStr.length() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// TPMS 7a0
|
||||
if (liveData->currentAtshRequest.equals("ATSH7A0")) {
|
||||
if (liveData->commandRequest.equals("22c00b")) {
|
||||
liveData->params.tireFrontLeftPressureBar = liveData->hexToDecFromResponse(14, 16, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireFrontRightPressureBar = liveData->hexToDecFromResponse(22, 24, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireRearRightPressureBar = liveData->hexToDecFromResponse(30, 32, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireRearLeftPressureBar = liveData->hexToDecFromResponse(38, 40, 2, false) / 72.51886900361; // === OK Valid *0.2 / 14.503773800722
|
||||
liveData->params.tireFrontLeftTempC = liveData->hexToDecFromResponse(16, 18, 2, false) - 50; // === OK Valid
|
||||
liveData->params.tireFrontRightTempC = liveData->hexToDecFromResponse(24, 26, 2, false) - 50; // === OK Valid
|
||||
liveData->params.tireRearRightTempC = liveData->hexToDecFromResponse(32, 34, 2, false) - 50; // === OK Valid
|
||||
liveData->params.tireRearLeftTempC = liveData->hexToDecFromResponse(40, 42, 2, false) - 50; // === OK Valid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,12 +19,12 @@ void CommInterface::initComm(LiveData* pLiveData, BoardInterface* pBoard) {
|
||||
void CommInterface::mainLoop() {
|
||||
|
||||
// Send command from TTY to OBD2
|
||||
if (Serial.available()) {
|
||||
ch = Serial.read();
|
||||
if (syslog->available()) {
|
||||
ch = syslog->read();
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
board->customConsoleCommand(response);
|
||||
response = response + ch;
|
||||
Serial.println(response);
|
||||
syslog->info(DEBUG_COMM, response);
|
||||
executeCommand(response);
|
||||
response = "";
|
||||
} else {
|
||||
@@ -59,8 +59,8 @@ bool CommInterface::doNextQueueCommand() {
|
||||
liveData->currentAtshRequest = liveData->commandRequest;
|
||||
}
|
||||
|
||||
Serial.print(">>> ");
|
||||
Serial.println(liveData->commandRequest);
|
||||
syslog->infoNolf(DEBUG_COMM, ">>> ");
|
||||
syslog->info(DEBUG_COMM, liveData->commandRequest);
|
||||
liveData->responseRowMerged = "";
|
||||
executeCommand(liveData->commandRequest);
|
||||
liveData->commandQueueIndex++;
|
||||
@@ -72,7 +72,7 @@ bool CommInterface::doNextQueueCommand() {
|
||||
bool CommInterface::parseResponse() {
|
||||
|
||||
// 1 frame data
|
||||
Serial.println(liveData->responseRow);
|
||||
syslog->info(DEBUG_COMM, liveData->responseRow);
|
||||
|
||||
// Merge frames 0:xxxx 1:yyyy 2:zzzz to single response xxxxyyyyzzzz string
|
||||
if (liveData->responseRow.length() >= 2 && liveData->responseRow.charAt(1) == ':') {
|
||||
|
||||
@@ -14,13 +14,13 @@ class MyClientCallback : public BLEClientCallbacks {
|
||||
|
||||
// On BLE connect
|
||||
void onConnect(BLEClient* pclient) {
|
||||
Serial.println("onConnect");
|
||||
syslog->println("onConnect");
|
||||
}
|
||||
|
||||
// On BLE disconnect
|
||||
void onDisconnect(BLEClient* pclient) {
|
||||
liveDataObj->commConnected = false;
|
||||
Serial.println("onDisconnect");
|
||||
syslog->println("onDisconnect");
|
||||
|
||||
boardObj->displayMessage("BLE disconnected", "");
|
||||
}
|
||||
@@ -34,9 +34,9 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
|
||||
// Called for each advertising BLE server.
|
||||
void onResult(BLEAdvertisedDevice advertisedDevice) {
|
||||
|
||||
Serial.print("BLE advertised device found: ");
|
||||
Serial.println(advertisedDevice.toString().c_str());
|
||||
Serial.println(advertisedDevice.getAddress().toString().c_str());
|
||||
syslog->print("BLE advertised device found: ");
|
||||
syslog->println(advertisedDevice.toString().c_str());
|
||||
syslog->println(advertisedDevice.getAddress().toString().c_str());
|
||||
|
||||
// Add to device list (max. 9 devices allowed yet)
|
||||
String tmpStr;
|
||||
@@ -56,17 +56,17 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
|
||||
}
|
||||
|
||||
// if (advertisedDevice.getServiceDataUUID().toString() != "<NULL>") {
|
||||
// Serial.print("ServiceDataUUID: ");
|
||||
// Serial.println(advertisedDevice.getServiceDataUUID().toString().c_str());
|
||||
// syslog->print("ServiceDataUUID: ");
|
||||
// syslog->println(advertisedDevice.getServiceDataUUID().toString().c_str());
|
||||
// if (advertisedDevice.getServiceUUID().toString() != "<NULL>") {
|
||||
// Serial.print("ServiceUUID: ");
|
||||
// Serial.println(advertisedDevice.getServiceUUID().toString().c_str());
|
||||
// syslog->print("ServiceUUID: ");
|
||||
// syslog->println(advertisedDevice.getServiceUUID().toString().c_str());
|
||||
// }
|
||||
// }
|
||||
|
||||
if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(BLEUUID(liveDataObj->settings.serviceUUID)) &&
|
||||
(strcmp(advertisedDevice.getAddress().toString().c_str(), liveDataObj->settings.obdMacAddress) == 0)) {
|
||||
Serial.println("Stop scanning. Found my BLE device.");
|
||||
syslog->println("Stop scanning. Found my BLE device.");
|
||||
BLEDevice::getScan()->stop();
|
||||
liveDataObj->foundMyBleDevice = new BLEAdvertisedDevice(advertisedDevice);
|
||||
}
|
||||
@@ -81,29 +81,29 @@ uint32_t PIN = 1234;
|
||||
class MySecurity : public BLESecurityCallbacks {
|
||||
|
||||
uint32_t onPassKeyRequest() {
|
||||
Serial.printf("Pairing password: %d \r\n", PIN);
|
||||
syslog->printf("Pairing password: %d \r\n", PIN);
|
||||
return PIN;
|
||||
}
|
||||
|
||||
void onPassKeyNotify(uint32_t pass_key) {
|
||||
Serial.printf("onPassKeyNotify\r\n");
|
||||
syslog->printf("onPassKeyNotify\r\n");
|
||||
}
|
||||
|
||||
bool onConfirmPIN(uint32_t pass_key) {
|
||||
Serial.printf("onConfirmPIN\r\n");
|
||||
syslog->printf("onConfirmPIN\r\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool onSecurityRequest() {
|
||||
Serial.printf("onSecurityRequest\r\n");
|
||||
syslog->printf("onSecurityRequest\r\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
void onAuthenticationComplete(esp_ble_auth_cmpl_t auth_cmpl) {
|
||||
if (auth_cmpl.success) {
|
||||
Serial.printf("onAuthenticationComplete\r\n");
|
||||
syslog->printf("onAuthenticationComplete\r\n");
|
||||
} else {
|
||||
Serial.println("Auth failure. Incorrect PIN?");
|
||||
syslog->println("Auth failure. Incorrect PIN?");
|
||||
liveDataObj->bleConnect = false;
|
||||
}
|
||||
}
|
||||
@@ -129,8 +129,8 @@ static void notifyCallback (BLERemoteCharacteristic * pBLERemoteCharacteristic,
|
||||
liveDataObj->responseRow += ch;
|
||||
if (liveDataObj->responseRow == ">") {
|
||||
if (liveDataObj->responseRowMerged != "") {
|
||||
Serial.print("merged:");
|
||||
Serial.println(liveDataObj->responseRowMerged);
|
||||
syslog->infoNolf(DEBUG_COMM, "merged:");
|
||||
syslog->info(DEBUG_COMM, liveDataObj->responseRowMerged);
|
||||
boardObj->parseRowMerged();
|
||||
}
|
||||
liveDataObj->responseRowMerged = "";
|
||||
@@ -149,7 +149,7 @@ void CommObd2Ble4::connectDevice() {
|
||||
liveDataObj = liveData;
|
||||
boardObj = board;
|
||||
|
||||
Serial.println("BLE4 connectDevice");
|
||||
syslog->println("BLE4 connectDevice");
|
||||
|
||||
// Start BLE connection
|
||||
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));
|
||||
@@ -157,7 +157,7 @@ void CommObd2Ble4::connectDevice() {
|
||||
|
||||
// Retrieve a Scanner and set the callback we want to use to be informed when we have detected a new device.
|
||||
// Specify that we want active scanning and start the scan to run for 10 seconds.
|
||||
Serial.println("Setup BLE scan");
|
||||
syslog->println("Setup BLE scan");
|
||||
liveData->pBLEScan = BLEDevice::getScan();
|
||||
liveData->pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
|
||||
liveData->pBLEScan->setInterval(1349);
|
||||
@@ -166,7 +166,7 @@ void CommObd2Ble4::connectDevice() {
|
||||
|
||||
// Skip BLE scan if middle button pressed
|
||||
if (strcmp(liveData->settings.obdMacAddress, "00:00:00:00:00:00") != 0 && !board->skipAdapterScan()) {
|
||||
Serial.println(liveData->settings.obdMacAddress);
|
||||
syslog->println(liveData->settings.obdMacAddress);
|
||||
startBleScan();
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ void CommObd2Ble4::connectDevice() {
|
||||
*/
|
||||
void CommObd2Ble4::disconnectDevice() {
|
||||
|
||||
Serial.println("COMM disconnectDevice");
|
||||
syslog->println("COMM disconnectDevice");
|
||||
btStop();
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ void CommObd2Ble4::disconnectDevice() {
|
||||
*/
|
||||
void CommObd2Ble4::scanDevices() {
|
||||
|
||||
Serial.println("COMM scanDevices");
|
||||
syslog->println("COMM scanDevices");
|
||||
startBleScan();
|
||||
}
|
||||
|
||||
@@ -201,13 +201,13 @@ void CommObd2Ble4::startBleScan() {
|
||||
board->displayMessage(" > Scanning BLE4 devices", "40sec.or hold middle&RST");
|
||||
|
||||
// Start scanning
|
||||
Serial.println("Scanning BLE devices...");
|
||||
Serial.print("Looking for ");
|
||||
Serial.println(liveData->settings.obdMacAddress);
|
||||
syslog->println("Scanning BLE devices...");
|
||||
syslog->print("Looking for ");
|
||||
syslog->println(liveData->settings.obdMacAddress);
|
||||
BLEScanResults foundDevices = liveData->pBLEScan->start(40, false);
|
||||
Serial.print("Devices found: ");
|
||||
Serial.println(foundDevices.getCount());
|
||||
Serial.println("Scan done!");
|
||||
syslog->print("Devices found: ");
|
||||
syslog->println(foundDevices.getCount());
|
||||
syslog->println("Scan done!");
|
||||
liveData->pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
||||
|
||||
char tmpStr1[20];
|
||||
@@ -216,7 +216,7 @@ void CommObd2Ble4::startBleScan() {
|
||||
|
||||
// Scan devices from menu, show list of devices
|
||||
if (liveData->menuCurrent == 9999) {
|
||||
Serial.println("Display menu with devices");
|
||||
syslog->println("Display menu with devices");
|
||||
liveData->menuVisible = true;
|
||||
//liveData->menuCurrent = 9999;
|
||||
liveData->menuItemSelected = 0;
|
||||
@@ -238,8 +238,8 @@ bool CommObd2Ble4::connectToServer(BLEAddress pAddress) {
|
||||
|
||||
board->displayMessage(" > Connecting device", "");
|
||||
|
||||
Serial.print("liveData->bleConnect ");
|
||||
Serial.println(pAddress.toString().c_str());
|
||||
syslog->print("liveData->bleConnect ");
|
||||
syslog->println(pAddress.toString().c_str());
|
||||
board->displayMessage(" > Connecting device - init", pAddress.toString().c_str());
|
||||
|
||||
BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT);
|
||||
@@ -253,49 +253,49 @@ bool CommObd2Ble4::connectToServer(BLEAddress pAddress) {
|
||||
board->displayMessage(" > Connecting device", pAddress.toString().c_str());
|
||||
liveData->pClient = BLEDevice::createClient();
|
||||
liveData->pClient->setClientCallbacks(new MyClientCallback());
|
||||
if (liveData->pClient->connect(pAddress, BLE_ADDR_TYPE_RANDOM) ) Serial.println("liveData->bleConnected");
|
||||
Serial.println(" - liveData->bleConnected to server");
|
||||
if (liveData->pClient->connect(pAddress, BLE_ADDR_TYPE_RANDOM) ) syslog->println("liveData->bleConnected");
|
||||
syslog->println(" - liveData->bleConnected to server");
|
||||
|
||||
// Remote service
|
||||
board->displayMessage(" > Connecting device", "Connecting service...");
|
||||
BLERemoteService* pRemoteService = liveData->pClient->getService(BLEUUID(liveData->settings.serviceUUID));
|
||||
if (pRemoteService == nullptr)
|
||||
{
|
||||
Serial.print("Failed to find our service UUID: ");
|
||||
Serial.println(liveData->settings.serviceUUID);
|
||||
syslog->print("Failed to find our service UUID: ");
|
||||
syslog->println(liveData->settings.serviceUUID);
|
||||
board->displayMessage(" > Connecting device", "Unable to find service");
|
||||
return false;
|
||||
}
|
||||
Serial.println(" - Found our service");
|
||||
syslog->println(" - Found our service");
|
||||
|
||||
// Get characteristics
|
||||
board->displayMessage(" > Connecting device", "Connecting TxUUID...");
|
||||
liveData->pRemoteCharacteristic = pRemoteService->getCharacteristic(BLEUUID(liveData->settings.charTxUUID));
|
||||
if (liveData->pRemoteCharacteristic == nullptr) {
|
||||
Serial.print("Failed to find our characteristic UUID: ");
|
||||
Serial.println(liveData->settings.charTxUUID);//.toString().c_str());
|
||||
syslog->print("Failed to find our characteristic UUID: ");
|
||||
syslog->println(liveData->settings.charTxUUID);//.toString().c_str());
|
||||
board->displayMessage(" > Connecting device", "Unable to find TxUUID");
|
||||
return false;
|
||||
}
|
||||
Serial.println(" - Found our characteristic");
|
||||
syslog->println(" - Found our characteristic");
|
||||
|
||||
// Get characteristics
|
||||
board->displayMessage(" > Connecting device", "Connecting RxUUID...");
|
||||
liveData->pRemoteCharacteristicWrite = pRemoteService->getCharacteristic(BLEUUID(liveData->settings.charRxUUID));
|
||||
if (liveData->pRemoteCharacteristicWrite == nullptr) {
|
||||
Serial.print("Failed to find our characteristic UUID: ");
|
||||
Serial.println(liveData->settings.charRxUUID);//.toString().c_str());
|
||||
syslog->print("Failed to find our characteristic UUID: ");
|
||||
syslog->println(liveData->settings.charRxUUID);//.toString().c_str());
|
||||
board->displayMessage(" > Connecting device", "Unable to find RxUUID");
|
||||
return false;
|
||||
}
|
||||
Serial.println(" - Found our characteristic write");
|
||||
syslog->println(" - Found our characteristic write");
|
||||
|
||||
board->displayMessage(" > Connecting device", "Register callbacks...");
|
||||
// Read the value of the characteristic.
|
||||
if (liveData->pRemoteCharacteristic->canNotify()) {
|
||||
Serial.println(" - canNotify");
|
||||
syslog->println(" - canNotify");
|
||||
if (liveData->pRemoteCharacteristic->canIndicate()) {
|
||||
Serial.println(" - canIndicate");
|
||||
syslog->println(" - canIndicate");
|
||||
const uint8_t indicationOn[] = {0x2, 0x0};
|
||||
//const uint8_t indicationOff[] = {0x0,0x0};
|
||||
liveData->pRemoteCharacteristic->getDescriptor(BLEUUID((uint16_t)0x2902))->writeValue((uint8_t*)indicationOn, 2, true);
|
||||
@@ -307,7 +307,7 @@ bool CommObd2Ble4::connectToServer(BLEAddress pAddress) {
|
||||
|
||||
board->displayMessage(" > Connecting device", "Done...");
|
||||
if (liveData->pRemoteCharacteristicWrite->canWrite()) {
|
||||
Serial.println(" - canWrite");
|
||||
syslog->println(" - canWrite");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -326,7 +326,7 @@ void CommObd2Ble4::mainLoop() {
|
||||
liveData->commConnected = true;
|
||||
liveData->bleConnect = false;
|
||||
|
||||
Serial.println("We are now connected to the BLE device.");
|
||||
syslog->println("We are now connected to the BLE device.");
|
||||
|
||||
// Print message
|
||||
board->displayMessage(" > Processing init AT cmds", "");
|
||||
@@ -335,7 +335,7 @@ void CommObd2Ble4::mainLoop() {
|
||||
doNextQueueCommand();
|
||||
|
||||
} else {
|
||||
Serial.println("We have failed to connect to the server; there is nothing more we will do.");
|
||||
syslog->println("We have failed to connect to the server; there is nothing more we will do.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
134
CommObd2Can.cpp
134
CommObd2Can.cpp
@@ -10,22 +10,22 @@
|
||||
*/
|
||||
void CommObd2Can::connectDevice() {
|
||||
|
||||
Serial.println("CAN connectDevice");
|
||||
syslog->println("CAN connectDevice");
|
||||
|
||||
//CAN = new MCP_CAN(pinCanCs); // todo: remove if smart pointer is ok
|
||||
CAN.reset(new MCP_CAN(pinCanCs)); // smart pointer so it's automatically cleaned when out of context and also free to re-init
|
||||
if (CAN == nullptr) {
|
||||
Serial.println("Error: Not enough memory to instantiate CAN class");
|
||||
Serial.println("init_can() failed");
|
||||
syslog->println("Error: Not enough memory to instantiate CAN class");
|
||||
syslog->println("init_can() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
|
||||
if (CAN->begin(MCP_STDEXT, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
|
||||
Serial.println("MCP2515 Initialized Successfully!");
|
||||
syslog->println("MCP2515 Initialized Successfully!");
|
||||
board->displayMessage(" > CAN init OK", "");
|
||||
} else {
|
||||
Serial.println("Error Initializing MCP2515...");
|
||||
syslog->println("Error Initializing MCP2515...");
|
||||
board->displayMessage(" > CAN init failed", "");
|
||||
return;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void CommObd2Can::connectDevice() {
|
||||
}
|
||||
|
||||
if (MCP2515_OK != CAN->setMode(MCP_NORMAL)) { // Set operation mode to normal so the MCP2515 sends acks to received data.
|
||||
Serial.println("Error: CAN->setMode(MCP_NORMAL) failed");
|
||||
syslog->println("Error: CAN->setMode(MCP_NORMAL) failed");
|
||||
board->displayMessage(" > CAN init failed", "");
|
||||
return;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ void CommObd2Can::connectDevice() {
|
||||
liveData->commConnected = true;
|
||||
doNextQueueCommand();
|
||||
|
||||
Serial.println("init_can() done");
|
||||
syslog->println("init_can() done");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ void CommObd2Can::connectDevice() {
|
||||
void CommObd2Can::disconnectDevice() {
|
||||
|
||||
liveData->commConnected = false;
|
||||
Serial.println("COMM disconnectDevice");
|
||||
syslog->println("COMM disconnectDevice");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ void CommObd2Can::disconnectDevice() {
|
||||
*/
|
||||
void CommObd2Can::scanDevices() {
|
||||
|
||||
Serial.println("COMM scanDevices");
|
||||
syslog->println("COMM scanDevices");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,15 +78,6 @@ void CommObd2Can::mainLoop() {
|
||||
|
||||
CommInterface::mainLoop();
|
||||
|
||||
// if delay between commands is defined, check if this delay is not expired
|
||||
if (liveData->delayBetweenCommandsMs != 0) {
|
||||
if (bResponseProcessed & (unsigned long)(millis() - lastDataSent) > liveData->delayBetweenCommandsMs) {
|
||||
bResponseProcessed = false;
|
||||
liveData->canSendNextAtCommand = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Read data
|
||||
const uint8_t firstByte = receivePID();
|
||||
if ((firstByte & 0xf0) == 0x10) { // First frame, request another
|
||||
@@ -98,8 +89,8 @@ void CommObd2Can::mainLoop() {
|
||||
break;
|
||||
delay(1);
|
||||
// apply timeout for next frames loop too
|
||||
if (lastDataSent != 0 && (unsigned long)(millis() - lastDataSent) > liveData->rxTimeoutMs) {
|
||||
Serial.print("CAN execution timeout (multiframe message).\n");
|
||||
if (lastDataSent != 0 && (unsigned long)(millis() - lastDataSent) > 100) {
|
||||
syslog->info(DEBUG_COMM, "CAN execution timeout (multiframe message).");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -109,9 +100,8 @@ void CommObd2Can::mainLoop() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (lastDataSent != 0 && (unsigned long)(millis() - lastDataSent) > liveData->rxTimeoutMs) {
|
||||
Serial.print("CAN execution timeout. Continue with next command.\n");
|
||||
if (lastDataSent != 0 && (unsigned long)(millis() - lastDataSent) > 100) {
|
||||
syslog->info(DEBUG_COMM, "CAN execution timeout. Continue with next command.");
|
||||
liveData->canSendNextAtCommand = true;
|
||||
return;
|
||||
}
|
||||
@@ -122,8 +112,8 @@ void CommObd2Can::mainLoop() {
|
||||
*/
|
||||
void CommObd2Can::executeCommand(String cmd) {
|
||||
|
||||
Serial.print("executeCommand ");
|
||||
Serial.println(cmd);
|
||||
syslog->infoNolf(DEBUG_COMM, "executeCommand ");
|
||||
syslog->info(DEBUG_COMM, cmd);
|
||||
|
||||
if (cmd.equals("") || cmd.startsWith("AT")) { // skip AT commands as not used by direct CAN connection
|
||||
lastDataSent = 0;
|
||||
@@ -162,8 +152,6 @@ void CommObd2Can::sendPID(const uint16_t pid, const String& cmd) {
|
||||
|
||||
if (cmd == "22402B" || cmd == "22F101") {
|
||||
pPacket->startChar = txStartChar = 0x12;
|
||||
} else if (cmd == "22D85C" || cmd == "22D96B") {
|
||||
pPacket->startChar = txStartChar = 0x78;
|
||||
} else {
|
||||
pPacket->startChar = txStartChar = 0x07;
|
||||
}
|
||||
@@ -193,22 +181,20 @@ void CommObd2Can::sendPID(const uint16_t pid, const String& cmd) {
|
||||
}
|
||||
|
||||
lastPid = pid;
|
||||
bResponseProcessed = false;
|
||||
const uint8_t sndStat = CAN->sendMsgBuf(pid, 0, 8, txBuf); // 11 bit
|
||||
// uint8_t sndStat = CAN->sendMsgBuf(0x7e4, 1, 8, tmp); // 29 bit extended frame
|
||||
if (sndStat == CAN_OK) {
|
||||
Serial.print("SENT ");
|
||||
syslog->infoNolf(DEBUG_COMM, "SENT ");
|
||||
lastDataSent = millis();
|
||||
} else {
|
||||
Serial.print("Error sending PID ");
|
||||
lastDataSent = millis();
|
||||
syslog->infoNolf(DEBUG_COMM, "Error sending PID ");
|
||||
}
|
||||
Serial.print(pid);
|
||||
syslog->infoNolf(DEBUG_COMM, pid);
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
sprintf(msgString, " 0x%.2X", txBuf[i]);
|
||||
Serial.print(msgString);
|
||||
syslog->infoNolf(DEBUG_COMM, msgString);
|
||||
}
|
||||
Serial.println("");
|
||||
syslog->info(DEBUG_COMM, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,16 +212,16 @@ void CommObd2Can::sendFlowControlFrame() {
|
||||
|
||||
const uint8_t sndStat = CAN->sendMsgBuf(lastPid, 0, 8, txBuf); // 11 bit
|
||||
if (sndStat == CAN_OK) {
|
||||
Serial.print("Flow control frame sent ");
|
||||
syslog->infoNolf(DEBUG_COMM, "Flow control frame sent ");
|
||||
} else {
|
||||
Serial.print("Error sending flow control frame ");
|
||||
syslog->infoNolf(DEBUG_COMM, "Error sending flow control frame ");
|
||||
}
|
||||
Serial.print(lastPid);
|
||||
syslog->infoNolf(DEBUG_COMM, lastPid);
|
||||
for (auto txByte : txBuf) {
|
||||
sprintf(msgString, " 0x%.2X", txByte);
|
||||
Serial.print(msgString);
|
||||
syslog->infoNolf(DEBUG_COMM, msgString);
|
||||
}
|
||||
Serial.println("");
|
||||
syslog->info(DEBUG_COMM, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,7 +232,7 @@ uint8_t CommObd2Can::receivePID() {
|
||||
if (!digitalRead(pinCanInt)) // If CAN0_INT pin is low, read receive buffer
|
||||
{
|
||||
lastDataSent = millis();
|
||||
Serial.print(" CAN READ ");
|
||||
syslog->infoNolf(DEBUG_COMM, " CAN READ ");
|
||||
CAN->readMsgBuf(&rxId, &rxLen, rxBuf); // Read data: len = data length, buf = data byte(s)
|
||||
// mockupReceiveCanBuf(&rxId, &rxLen, rxBuf);
|
||||
|
||||
@@ -255,22 +241,22 @@ uint8_t CommObd2Can::receivePID() {
|
||||
else
|
||||
sprintf(msgString, "Standard ID: 0x%.3lX DLC: %1d Data:", rxId, rxLen);
|
||||
|
||||
Serial.print(msgString);
|
||||
syslog->infoNolf(DEBUG_COMM, msgString);
|
||||
|
||||
if ((rxId & 0x40000000) == 0x40000000) { // Determine if message is a remote request frame.
|
||||
sprintf(msgString, " REMOTE REQUEST FRAME");
|
||||
Serial.print(msgString);
|
||||
syslog->infoNolf(DEBUG_COMM, msgString);
|
||||
} else {
|
||||
for (uint8_t i = 0; i < rxLen; i++) {
|
||||
sprintf(msgString, " 0x%.2X", rxBuf[i]);
|
||||
Serial.print(msgString);
|
||||
syslog->infoNolf(DEBUG_COMM, msgString);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this packet shall be discarded due to its length.
|
||||
// If liveData->expectedPacketLength is set to 0, accept any length.
|
||||
if(liveData->expectedMinimalPacketLength != 0 && rxLen < liveData->expectedMinimalPacketLength) {
|
||||
Serial.println(" [Ignored packet]");
|
||||
syslog->info(DEBUG_COMM, " [Ignored packet]");
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
@@ -279,16 +265,16 @@ uint8_t CommObd2Can::receivePID() {
|
||||
long unsigned int atsh_response = liveData->hexToDec(liveData->currentAtshRequest.substring(4), 2, false) + 8;
|
||||
|
||||
if(rxId != atsh_response) {
|
||||
Serial.println(" [Filtered packet]");
|
||||
syslog->info(DEBUG_COMM, " [Filtered packet]");
|
||||
return 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
Serial.println();
|
||||
syslog->info(DEBUG_COMM, "");
|
||||
processFrameBytes();
|
||||
//processFrame();
|
||||
} else {
|
||||
//Serial.println(" CAN NOT READ ");
|
||||
//syslog->println(" CAN NOT READ ");
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
@@ -301,11 +287,11 @@ static void printHexBuffer(uint8_t* pData, const uint16_t length, const bool bAd
|
||||
|
||||
for (uint8_t i = 0; i < length; i++) {
|
||||
sprintf(str, " 0x%.2X", pData[i]);
|
||||
Serial.print(str);
|
||||
syslog->infoNolf(DEBUG_COMM, str);
|
||||
}
|
||||
|
||||
if (bAddNewLine) {
|
||||
Serial.println();
|
||||
syslog->info(DEBUG_COMM, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +348,7 @@ bool CommObd2Can::processFrameBytes() {
|
||||
|
||||
rxRemaining = 0;
|
||||
|
||||
//Serial.print("----Processing SingleFrame payload: "); printHexBuffer(pSingleFrame->pData, pSingleFrame->size, true);
|
||||
//syslog->print("----Processing SingleFrame payload: "); printHexBuffer(pSingleFrame->pData, pSingleFrame->size, true);
|
||||
|
||||
// single frame - process directly
|
||||
buffer2string(liveData->responseRowMerged, mergedData.data(), mergedData.size());
|
||||
@@ -395,7 +381,7 @@ bool CommObd2Can::processFrameBytes() {
|
||||
dataRows[0].assign(pFirstFrame->pData, pFirstFrame->pData + framePayloadSize);
|
||||
rxRemaining -= framePayloadSize;
|
||||
|
||||
//Serial.print("----Processing FirstFrame payload: "); printHexBuffer(pFirstFrame->pData, framePayloadSize, true);
|
||||
//syslog->print("----Processing FirstFrame payload: "); printHexBuffer(pFirstFrame->pData, framePayloadSize, true);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -409,19 +395,20 @@ bool CommObd2Can::processFrameBytes() {
|
||||
};
|
||||
|
||||
const uint8_t structSize = sizeof(ConsecutiveFrame_t);
|
||||
//Serial.print("[debug] sizeof(ConsecutiveFrame_t) is expected to be 1 and it's "); Serial.println(structSize);
|
||||
//syslog->print("[debug] sizeof(ConsecutiveFrame_t) is expected to be 1 and it's "); syslog->println(structSize);
|
||||
|
||||
ConsecutiveFrame_t* pConseqFrame = (ConsecutiveFrame_t*)pDataStart;
|
||||
const uint8_t framePayloadSize = frameLenght - sizeof(ConsecutiveFrame_t); // remove one byte of header
|
||||
dataRows[pConseqFrame->index].assign(pConseqFrame->pData, pConseqFrame->pData + framePayloadSize);
|
||||
rxRemaining -= framePayloadSize;
|
||||
|
||||
//Serial.print("----Processing ConsecFrame payload: "); printHexBuffer(pConseqFrame->pData, framePayloadSize, true);
|
||||
//syslog->print("----Processing ConsecFrame payload: "); printHexBuffer(pConseqFrame->pData, framePayloadSize, true);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Serial.print("Unknown frame type within CommObd2Can::processFrameBytes(): "); Serial.println((uint8_t)frameType);
|
||||
syslog->infoNolf(DEBUG_COMM, "Unknown frame type within CommObd2Can::processFrameBytes(): ");
|
||||
syslog->info(DEBUG_COMM, (uint8_t)frameType);
|
||||
return false;
|
||||
break;
|
||||
} // \switch (frameType)
|
||||
@@ -430,10 +417,10 @@ bool CommObd2Can::processFrameBytes() {
|
||||
if (rxRemaining <= 0) {
|
||||
// multiple frames and no data remaining - merge everything to single packet
|
||||
for (int i = 0; i < dataRows.size(); i++) {
|
||||
//Serial.print("------merging packet index ");
|
||||
//Serial.print(i);
|
||||
//Serial.print(" with length ");
|
||||
//Serial.println(dataRows[i].size());
|
||||
//syslog->print("------merging packet index ");
|
||||
//syslog->print(i);
|
||||
//syslog->print(" with length ");
|
||||
//syslog->println(dataRows[i].size());
|
||||
|
||||
mergedData.insert(mergedData.end(), dataRows[i].begin(), dataRows[i].end());
|
||||
}
|
||||
@@ -481,11 +468,11 @@ bool CommObd2Can::processFrame() {
|
||||
break;
|
||||
}
|
||||
|
||||
Serial.print("> frametype:");
|
||||
Serial.print(frameType);
|
||||
Serial.print(", r: ");
|
||||
Serial.print(rxRemaining);
|
||||
Serial.print(" ");
|
||||
syslog->infoNolf(DEBUG_COMM, "> frametype:");
|
||||
syslog->infoNolf(DEBUG_COMM, frameType);
|
||||
syslog->infoNolf(DEBUG_COMM, ", r: ");
|
||||
syslog->infoNolf(DEBUG_COMM, rxRemaining);
|
||||
syslog->infoNolf(DEBUG_COMM, " ");
|
||||
|
||||
for (uint8_t i = start; i < rxLen; i++) {
|
||||
sprintf(msgString, "%.2X", rxBuf[i]);
|
||||
@@ -493,14 +480,14 @@ bool CommObd2Can::processFrame() {
|
||||
rxRemaining--;
|
||||
}
|
||||
|
||||
Serial.print(", r: ");
|
||||
Serial.print(rxRemaining);
|
||||
Serial.println(" ");
|
||||
syslog->infoNolf(DEBUG_COMM, ", r: ");
|
||||
syslog->infoNolf(DEBUG_COMM, rxRemaining);
|
||||
syslog->info(DEBUG_COMM, " ");
|
||||
|
||||
//parseResponse();
|
||||
// We need to sort frames
|
||||
// 1 frame data
|
||||
Serial.println(liveData->responseRow);
|
||||
syslog->info(DEBUG_COMM, liveData->responseRow);
|
||||
// Merge frames 0:xxxx 1:yyyy 2:zzzz to single response xxxxyyyyzzzz string
|
||||
if (liveData->responseRow.length() >= 2 && liveData->responseRow.charAt(1) == ':') {
|
||||
//liveData->responseRowMerged += liveData->responseRow.substring(2);
|
||||
@@ -508,7 +495,7 @@ bool CommObd2Can::processFrame() {
|
||||
uint16_t startPos = (rowNo * 14) - ((rowNo > 0) ? 2 : 0);
|
||||
uint16_t endPos = ((rowNo + 1) * 14) - ((rowNo > 0) ? 2 : 0);
|
||||
liveData->responseRowMerged = liveData->responseRowMerged.substring(0, startPos) + liveData->responseRow.substring(2) + liveData->responseRowMerged.substring(endPos);
|
||||
Serial.println(liveData->responseRowMerged);
|
||||
syslog->info(DEBUG_COMM, liveData->responseRowMerged);
|
||||
}
|
||||
|
||||
// Send response to board module
|
||||
@@ -524,14 +511,9 @@ bool CommObd2Can::processFrame() {
|
||||
processMergedResponse
|
||||
*/
|
||||
void CommObd2Can::processMergedResponse() {
|
||||
Serial.print("merged:");
|
||||
Serial.println(liveData->responseRowMerged);
|
||||
syslog->infoNolf(DEBUG_COMM, "merged:");
|
||||
syslog->info(DEBUG_COMM, liveData->responseRowMerged);
|
||||
board->parseRowMerged();
|
||||
liveData->responseRowMerged = "";
|
||||
liveData->vResponseRowMerged.clear();
|
||||
bResponseProcessed = true; // to allow delay untill next message
|
||||
|
||||
if (liveData->delayBetweenCommandsMs == 0) {
|
||||
liveData->canSendNextAtCommand = true; // allow next command immediately
|
||||
}
|
||||
liveData->canSendNextAtCommand = true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
#include "LiveData.h"
|
||||
#include "menu.h"
|
||||
|
||||
LogSerial* syslog;
|
||||
|
||||
/**
|
||||
* Debug level
|
||||
*/
|
||||
void debug(String msg, uint8_t debugLevel) {
|
||||
syslog->println(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
Init params with default values
|
||||
*/
|
||||
|
||||
12
LiveData.h
12
LiveData.h
@@ -7,6 +7,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <BLEDevice.h>
|
||||
#include "config.h"
|
||||
#include "LogSerial.h"
|
||||
#include <vector>
|
||||
|
||||
// SUPPORTED CARS
|
||||
@@ -20,7 +21,7 @@
|
||||
#define CAR_BMW_I3_2014 7
|
||||
#define CAR_DEBUG_OBD2_KIA 999
|
||||
|
||||
//
|
||||
// COMM TYPE
|
||||
#define COMM_TYPE_OBD2BLE4 0
|
||||
#define COMM_TYPE_OBD2CAN 1
|
||||
#define COMM_TYPE_OBD2BT3 2
|
||||
@@ -37,6 +38,8 @@
|
||||
//
|
||||
#define MONTH_SEC 2678400
|
||||
|
||||
extern LogSerial* syslog;
|
||||
|
||||
// Structure with realtime values
|
||||
typedef struct {
|
||||
// System
|
||||
@@ -204,16 +207,13 @@ typedef struct {
|
||||
// === settings version 6
|
||||
// =================================
|
||||
byte serialConsolePort; // 255-off, 0 - hw serial (std)
|
||||
byte debugLevel; // 0 - info only, 1 - debug communication (BLE/CAN), 2 - debug GSM, 3 - debug SDcard
|
||||
uint8_t debugLevel; // 0 - info only, 1 - debug communication (BLE/CAN), 2 - debug GSM, 3 - debug SDcard
|
||||
uint16_t sdcardLogIntervalSec; // every x seconds
|
||||
uint16_t gprsLogIntervalSec; // every x seconds
|
||||
|
||||
|
||||
//
|
||||
} SETTINGS_STRUC;
|
||||
|
||||
|
||||
//
|
||||
// LiveData class
|
||||
class LiveData {
|
||||
protected:
|
||||
public:
|
||||
|
||||
15
LogSerial.cpp
Normal file
15
LogSerial.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "LogSerial.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
LogSerial::LogSerial() : HardwareSerial(0) {
|
||||
HardwareSerial::begin(115200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set debug level
|
||||
*/
|
||||
void LogSerial::setDebugLevel(uint8_t aDebugLevel) {
|
||||
debugLevel = aDebugLevel;
|
||||
}
|
||||
58
LogSerial.h
Normal file
58
LogSerial.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
// DEBUG LEVEL
|
||||
#define DEBUG_NONE 0
|
||||
#define DEBUG_COMM 1 // filter comm
|
||||
#define DEBUG_GSM 2 // filter gsm messages
|
||||
#define DEBUG_SDCARD 3 // filter sdcard
|
||||
|
||||
//
|
||||
class LogSerial: public HardwareSerial {
|
||||
protected:
|
||||
uint8_t debugLevel;
|
||||
public:
|
||||
LogSerial();
|
||||
//
|
||||
void setDebugLevel(uint8_t aDebugLevel);
|
||||
// info
|
||||
template <class T, typename... Args> void info(uint8_t aDebugLevel, T msg) {
|
||||
if (debugLevel != DEBUG_NONE && aDebugLevel != DEBUG_NONE && aDebugLevel != debugLevel)
|
||||
return;
|
||||
println(msg);
|
||||
}
|
||||
template <class T, typename... Args> void infoNolf(uint8_t aDebugLevel, T msg) {
|
||||
if (debugLevel != DEBUG_NONE && aDebugLevel != DEBUG_NONE && aDebugLevel != debugLevel)
|
||||
return;
|
||||
print(msg);
|
||||
}
|
||||
// warning
|
||||
template <class T, typename... Args> void warn(uint8_t aDebugLevel, T msg) {
|
||||
if (debugLevel != DEBUG_NONE && aDebugLevel != DEBUG_NONE && aDebugLevel != debugLevel)
|
||||
return;
|
||||
print("WARN ");
|
||||
println(msg);
|
||||
}
|
||||
template <class T, typename... Args> void warnNolf(uint8_t aDebugLevel, T msg) {
|
||||
if (debugLevel != DEBUG_NONE && aDebugLevel != DEBUG_NONE && aDebugLevel != debugLevel)
|
||||
return;
|
||||
print("WARN ");
|
||||
print(msg);
|
||||
}
|
||||
|
||||
// error
|
||||
template <class T, typename... Args> void err(uint8_t aDebugLevel, T msg) {
|
||||
if (debugLevel != DEBUG_NONE && aDebugLevel != DEBUG_NONE && aDebugLevel != debugLevel)
|
||||
return;
|
||||
print("ERR ");
|
||||
println(msg);
|
||||
}
|
||||
template <class T, typename... Args> void errNolf(uint8_t aDebugLevel, T msg) {
|
||||
if (debugLevel != DEBUG_NONE && aDebugLevel != DEBUG_NONE && aDebugLevel != debugLevel)
|
||||
return;
|
||||
print("ERR ");
|
||||
print(msg);
|
||||
}
|
||||
|
||||
};
|
||||
3
config.h
3
config.h
@@ -81,6 +81,8 @@ typedef struct {
|
||||
#define MENU_HEADLIGHTS_REMINDER 310
|
||||
#define MENU_DEBUG_SCREEN 311
|
||||
#define MENU_GPS 312
|
||||
#define MENU_SERIAL_CONSOLE 313
|
||||
#define MENU_DEBUG_LEVEL 314
|
||||
//
|
||||
#define MENU_DISTANCE_UNIT 401
|
||||
#define MENU_TEMPERATURE_UNIT 402
|
||||
@@ -94,4 +96,5 @@ typedef struct {
|
||||
#define MENU_SDCARD_AUTOSTARTLOG 3042
|
||||
#define MENU_SDCARD_MOUNT_STATUS 3043
|
||||
#define MENU_SDCARD_REC 3044
|
||||
#define MENU_SDCARD_INTERVAL 3045
|
||||
//
|
||||
|
||||
34
evDash.ino
34
evDash.ino
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
/*
|
||||
Project renamed from eNiroDashboard to evDash
|
||||
|
||||
Serial console commands
|
||||
|
||||
serviceUUID=xxx
|
||||
charTxUUID=xxx
|
||||
charRxUUID=xxx
|
||||
wifiSsid=xxx
|
||||
wifiPassword=xxx
|
||||
gprsApn=xxx
|
||||
remoteApiUrl=xxx
|
||||
remoteApiKey=xxx
|
||||
serviceUUID=xxx
|
||||
charTxUUID=xxx
|
||||
charRxUUID=xxx
|
||||
wifiSsid=xxx
|
||||
wifiPassword=xxx
|
||||
gprsApn=xxx
|
||||
remoteApiUrl=xxx
|
||||
remoteApiKey=xxx
|
||||
|
||||
Required libraries
|
||||
- esp32 board support
|
||||
@@ -63,15 +63,21 @@ LiveData* liveData;
|
||||
*/
|
||||
void setup(void) {
|
||||
|
||||
// Serial console, init structures
|
||||
Serial.begin(115200);
|
||||
Serial.println("");
|
||||
Serial.println("Booting device...");
|
||||
// Serial console
|
||||
syslog = new LogSerial();
|
||||
syslog->println("\nBooting device...");
|
||||
|
||||
// Init settings/params
|
||||
liveData = new LiveData();
|
||||
liveData->initParams();
|
||||
|
||||
// Turn off serial console
|
||||
if (liveData->settings.serialConsolePort == 255) {
|
||||
syslog->println("Serial console disabled...");
|
||||
syslog->flush();
|
||||
syslog->end();
|
||||
}
|
||||
|
||||
// Init board
|
||||
#ifdef BOARD_TTGO_T4
|
||||
board = new BoardTtgoT4v13();
|
||||
@@ -118,7 +124,7 @@ void setup(void) {
|
||||
board->afterSetup();
|
||||
|
||||
// End
|
||||
Serial.println("Device setup completed");
|
||||
syslog->println("Device setup completed");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
13
menu.h
13
menu.h
@@ -36,6 +36,8 @@ MENU_ITEM menuItemsSource[100] = {
|
||||
{MENU_SDCARD, 3, -1, "SD card"},
|
||||
{MENU_GPS, 3, -1, "GPS"},
|
||||
{MENU_GPRS, 3, -1, "GSM/GPRS"},
|
||||
{MENU_SERIAL_CONSOLE, 3, -1, "Serial console"},
|
||||
{MENU_DEBUG_LEVEL, 3, -1, "Debug level"},
|
||||
//{MENU_REMOTE_UPLOAD, 3, -1, "[dev] Remote upload"},
|
||||
//{MENU_NTP, 3, -1, "[dev] NTP"},
|
||||
{MENU_SCREEN_ROTATION, 3, -1, "Screen rotation"},
|
||||
@@ -68,11 +70,12 @@ MENU_ITEM menuItemsSource[100] = {
|
||||
{MENU_WIFI_SSID, 301, -1, "SSID"},
|
||||
{MENU_WIFI_PASSWORD, 301, -1, "Password"},
|
||||
|
||||
{3040, 304, 3, "<- parent menu"},
|
||||
{MENU_SDCARD_ENABLED, 304, -1, "SD enabled"},
|
||||
{MENU_SDCARD_AUTOSTARTLOG, 304, -1, "Autostart log enabled"},
|
||||
{MENU_SDCARD_MOUNT_STATUS, 304, -1, "Status"},
|
||||
{MENU_SDCARD_REC, 304, -1, "Record"},
|
||||
{MENU_SDCARD*10, MENU_SDCARD, 3, "<- parent menu"},
|
||||
{MENU_SDCARD_ENABLED, MENU_SDCARD, -1, "SD enabled"},
|
||||
{MENU_SDCARD_AUTOSTARTLOG, MENU_SDCARD, -1, "Autostart log enabled"},
|
||||
{MENU_SDCARD_MOUNT_STATUS, MENU_SDCARD, -1, "Status"},
|
||||
{MENU_SDCARD_REC, MENU_SDCARD, -1, "Record"},
|
||||
{MENU_SDCARD_INTERVAL, MENU_SDCARD, -1, "Log interval sec."},
|
||||
|
||||
{3060, 306, 3, "<- parent menu"},
|
||||
{3061, 306, -1, "Auto mode"},
|
||||
|
||||
Reference in New Issue
Block a user