diff --git a/README.md b/README.md index b1854bc..1429e88 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,38 @@ # KIA ENIRO DASHBOARD -OBDII dashboard for TTGO-T4 module (ESP32) + OBD BLE4.0 adapter. Working on Kia e-NIRO (EV) and Hyundai Kona. +OBDII dashboard is now supporting 2 different hardware. +1. LILYGO TTGO T4 v1.3 +2. M5STACK CORE1 IOT Development Kit +Vgate iCar Pro Bluetooth 4.0 (BLE4) OBD2 adapter is required. + +Working with only with electric vehicles +- Kia e-NIRO (EV) +- Hyundai Kona EV +- Hyundai Ioniq EV + Use it at your own risk! Author: nick.n17@gmail.com (Lubos Petrovic / Slovakia) -## Hardware -- LILYGO TTGO T4 v1.3 - ~USD $30 https://www.banggood.com/LILYGO-TTGO-T-Watcher-BTC-Ticker-ESP32-For-Bitcoin-Price-Program-4M-SPI-Flash-Psram-LCD-Display-Module-p-1345292.html - I RECOMEND TO REMOVE LION BATTERY IF INCLUDED! But be very very carefull. I will make video when I get new TTGO -- OBD BLE4.0 adapter. - Officialy supported is only this model... - Vgate iCar Pro Bluetooth 4.0 (BLE) OBD2 ~USD $30 -- 3D printed case... +## Supporting me + +- Buy Me a Beer via paypal https://www.paypal.me/nickn17 +- EU companies can support me via IBAN/Invoice (my company is non-VAT payer in Slovakia). +Thank you for supporting me. Many thanks to Blas, Jens, Калин, Aleš Dokupil and others for help. + +## Required hardware +Board +- M5STACK CORE1 IOT Development Kit(~EUR 35) + https://rlx.sk/sk/m5stack/7285-esp32-basic-core-iot-development-kit-m5-k001-m5stack.html +or +- LILYGO TTGO T4 v1.3 (~USD $30) https://www.banggood.com/LILYGO-TTGO-T-Watcher-BTC-Ticker-ESP32-For-Bitcoin-Price-Program-4M-SPI-Flash-Psram-LCD-Display-Module-p-1345292.html +I RECOMMEND TO REMOVE LION BATTERY DUE TO HIGH SUMMER TEMPERATURES + +OBD2 adapter +- Officialy supported is only this model... + Vgate iCar Pro Bluetooth 4.0 (BLE4) OBD2 (~USD $30) + +Others +- 3D printed case for TTGO-T4 https://www.thingiverse.com/thing:3099913 ## Quick installation with ESP32 flash tool @@ -19,32 +40,30 @@ Author: nick.n17@gmail.com (Lubos Petrovic / Slovakia) Guide is here https://docs.google.com/document/d/1nEezrtXY-8X6mQ1hiZVWDjBVse1sXQg1SlnizaRmJwU/edit?usp=sharing -## Supporting me - -- Buy Me a Beer via paypal https://www.paypal.me/nickn17 -- EU companies can support me via IBAN/Invoice (my company is non-VAT payer in Slovakia). - -Thank you for supporting me. - -Many thanks to Blas, Jens, Калин and others for help. - ## Screens and shortcuts - Middle button - menu - Left button - toggle screens Screen list - no0. blank screen, lcd off -- no1. summary info (default) -- no2. speed kmh + kwh/100km (or kw for discharge) -- no3. battery cells + battery module temperatures -- no4. charging graph -- no5. consumption table. Can be used to measure available battery capacity! +- no1. auto mode (summary info / speed kmh / charging graph) +- no2. summary info (default) +- no3. speed kmh + kwh/100km (or kw for discharge) +- no4. battery cells + battery module temperatures +- no5. charging graph +- no6. consumption table. Can be used to measure available battery capacity! +- no7. debug screen (default off in the menu) + ![image](https://github.com/nickn17/enirodashboard/blob/master/screenshots/v1.jpg) [![Watch the video](https://github.com/nickn17/enirodashboard/blob/master/screenshots/v0.9.jpg)](https://www.youtube.com/watch?v=Jg5VP2P58Yg&) ## Release notes + +### v1.8.0 2020-11-20 +- Support for new device m5stack core1 iot development kit +- TTGO T4 is still supported device! ### v1.7.5 2020-11-17 - Settings: Debug screen off/on diff --git a/build.bat b/build.bat index eacecb8..adcc313 100644 --- a/build.bat +++ b/build.bat @@ -1,4 +1,11 @@ -arduino-cli compile --fqbn esp32:esp32:esp32 --build-properties build.extra_flags=-BOARD_TTGO_T4=1 -v enirodashboard.ino -arduino-cli compile -REM arduino-cli upload -b esp32:esp32:esp32 -v -p COM6 + +rem arduino-cli compile -v -b esp32:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,CPUFreq=80 --build-properties build.extra_flags=-BOARD_TTGO_T4=1 -v enirodashboard.ino +rem arduino-cli upload -b esp32:esp32:esp32 -v -p COM6 + +rem arduino-cli compile -v -b esp32:esp32:m5stack-core-esp32 --build-properties build.extra_flags=-BOARD_M5STACK=1 enirodashboard.ino +rem arduino-cli upload -v -b esp32:esp32:m5stack-core-esp32 -p COM9 + +rem arduino-cli compile -v -b esp32:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,CPUFreq=80 --build-properties build.extra_flags=-BOARD_M5STACK=1 -v enirodashboard.ino + arduino-cli upload -b esp32:esp32:esp32 -v -p COM9 + pause \ No newline at end of file diff --git a/config.h b/config.h index 89cbabe..0daa766 100644 --- a/config.h +++ b/config.h @@ -1,13 +1,21 @@ -#ifdef BOARD_TTGO_T4 +//////////////////////////////////////////////////////////// +// SELECT HARDWARE !!!! +//////////////////////////////////////////////////////////// + +//#define BOARD_TTGO_T4 +#define BOARD_M5STACK_CORE + +//////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// #define USER_SETUP_LOADED 1 #define SPI_FREQUENCY 27000000 -#define SPI_READ_FREQUENCY 20000000 #define SPI_TOUCH_FREQUENCY 2500000 -///////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// // BOARD LILYGO TTGO T4 v1.3 ///////////////////////////////////////////////////////////// +#ifdef BOARD_TTGO_T4 #define ILI9341_DRIVER #define TFT_MISO 12 #define TFT_MOSI 23 @@ -21,14 +29,14 @@ #define BUTTON_LEFT 38 #define BUTTON_MIDDLE 37 #define BUTTON_RIGHT 39 - #endif // BOARD_TTGO_T4 - ///////////////////////////////////////////////////////////// // BOARD M5STACK CORE IOT (M5-K001) ///////////////////////////////////////////////////////////// -/*#define ILI9341_DRIVER +#ifdef BOARD_M5STACK_CORE +#define USER_SETUP_LOADED 1 +#define ILI9341_DRIVER #define M5STACK #define TFT_MISO 19 #define TFT_MOSI 23 @@ -39,10 +47,13 @@ #define TFT_BL 32 // LED back-light #define SPI_FREQUENCY 27000000 #define SPI_READ_FREQUENCY 5000000 -#define BUTTON_LEFT 39 +#define BUTTON_LEFT 37 #define BUTTON_MIDDLE 38 -#define BUTTON_RIGHT 37 -#define SPEAKER 25*/ +#define BUTTON_RIGHT 39 +#define SPEAKER 25 +#define INVERT_DISPLAY +#endif // BOARD_M5STACK_CORE + ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// diff --git a/dist/boot_app0.bin b/dist/m5stack_core1/boot_app0.bin similarity index 100% rename from dist/boot_app0.bin rename to dist/m5stack_core1/boot_app0.bin diff --git a/dist/bootloader_qio_80m.bin b/dist/m5stack_core1/bootloader_qio_80m.bin similarity index 100% rename from dist/bootloader_qio_80m.bin rename to dist/m5stack_core1/bootloader_qio_80m.bin diff --git a/dist/m5stack_core1/enirodashboard.ino.bin b/dist/m5stack_core1/enirodashboard.ino.bin new file mode 100644 index 0000000..c24b07a Binary files /dev/null and b/dist/m5stack_core1/enirodashboard.ino.bin differ diff --git a/dist/m5stack_core1/enirodashboard.ino.partitions.bin b/dist/m5stack_core1/enirodashboard.ino.partitions.bin index 0e52b4c..eabbf0c 100644 Binary files a/dist/m5stack_core1/enirodashboard.ino.partitions.bin and b/dist/m5stack_core1/enirodashboard.ino.partitions.bin differ diff --git a/dist/ttgo_t4_v13/boot_app0.bin b/dist/ttgo_t4_v13/boot_app0.bin new file mode 100644 index 0000000..13562ca Binary files /dev/null and b/dist/ttgo_t4_v13/boot_app0.bin differ diff --git a/dist/ttgo_t4_v13/bootloader_qio_80m.bin b/dist/ttgo_t4_v13/bootloader_qio_80m.bin new file mode 100644 index 0000000..944f494 Binary files /dev/null and b/dist/ttgo_t4_v13/bootloader_qio_80m.bin differ diff --git a/enirodashboard.ino b/enirodashboard.ino index a91555f..3a20771 100644 --- a/enirodashboard.ino +++ b/enirodashboard.ino @@ -1,6 +1,6 @@ /* - KIA eNiro Dashboard 1.7.3, 2020-11-11 + KIA eNiro Dashboard 1.8.0, 2020-11-20 !! working only with OBD BLE 4.0 adapters !! Supported adapter is Vgate ICar Pro (must be BLE4.0 version) !! Not working with standard BLUETOOTH 3 adapters @@ -27,13 +27,15 @@ <= 0°C BMS allows max 40A */ -#include "config.h" +#define APP_VERSION "v1.8.0e" + #include "SPI.h" #include "TFT_eSPI.h" #include "BLEDevice.h" #include #include #include +#include "config.h" #include "struct.h" #include "menu.h" #include "car_kia_eniro.h" @@ -89,6 +91,21 @@ String debugTmpChargingLast06 = ""; String debugTmpChargingPrevious06 = ""; String debugTmpChargingRef06 = "620106FFFFFFFF--00--########################00--28EA00"; +/** + Clear screen a display two lines message +*/ +bool displayMessage(const char* row1, const char* row2) { + + tft.fillScreen(TFT_BLACK); + tft.setTextDatum(ML_DATUM); + tft.setTextColor(TFT_WHITE, TFT_BLACK); + tft.setFreeFont(&Roboto_Thin_24); + tft.setTextDatum(BL_DATUM); + tft.drawString(row1, 0, 240 / 2, GFXFF); + tft.drawString(row2, 0, (240 / 2) + 30, GFXFF); + return true; +} + /** Load settings from flash memory, upgrade structure if version differs */ @@ -310,21 +327,6 @@ float bar2pressure(float inBar) { return (settings.pressureUnit == 'b') ? inBar : inBar * 14.503773800722; } -/** - Clear screen a display two lines message -*/ -bool displayMessage(const char* row1, const char* row2) { - - tft.fillScreen(TFT_BLACK); - tft.setTextDatum(ML_DATUM); - tft.setTextColor(TFT_WHITE, TFT_BLACK); - tft.setFreeFont(&Roboto_Thin_24); - tft.setTextDatum(BL_DATUM); - tft.drawString(row1, 0, 240 / 2, GFXFF); - tft.drawString(row2, 0, (240 / 2) + 30, GFXFF); - return true; -} - /** Draw cell on dashboard */ @@ -661,7 +663,7 @@ bool drawSceneSpeed(bool force) { float capacity = params.batteryTotalAvailableKWh * (params.socPerc / 100); // calibration for Niro/Kona, real available capacity is ~66.5kWh, 0-10% ~6.2kWh, 90-100% ~7.2kWh if (settings.carType == CAR_KIA_ENIRO_2020_64 || settings.carType == CAR_HYUNDAI_KONA_2020_64) { - capacity = (params.socPerc*0.615)*(1+(params.socPerc*0.0008)); + capacity = (params.socPerc * 0.615) * (1 + (params.socPerc * 0.0008)); } sprintf(tmpStr3, " %01.01f", capacity); tft.drawString(tmpStr3, 320, 129, GFXFF); @@ -1323,8 +1325,10 @@ bool redrawScreen(bool force) { tft.setTextSize(1); tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setTextDatum(TL_DATUM); - tft.drawString(" BLE4 OBDII not connected... ", 0, 240 / 2, 2); - tft.drawString(" Press middle button to menu. ", 0, (240 / 2) + tft.fontHeight(), 2); + tft.drawString(" BLE4 OBDII not connected... ", 0, (240 / 2) - tft.fontHeight(), 2); + tft.drawString(" Press middle button to menu. ", 0, (240 / 2), 2); + tft.drawString(APP_VERSION, 0, (240 / 2) + tft.fontHeight(), 2); + } tft.endWrite(); @@ -1723,7 +1727,10 @@ void setup(void) { Serial.println("Init TFT display"); tft.begin(); - // tft.invertDisplay(false); // ONLY TTGO-TM +#ifdef INVERT_DISPLAY + tft.invertDisplay(true); +#endif // INVERT_DISPLAY + tft.setRotation(settings.displayRotation); analogWrite(TFT_BL, (settings.lcdBrightness == 0) ? 100 : settings.lcdBrightness); tft.fillScreen(TFT_BLACK);