Cleaning, for m5stack

This commit is contained in:
Lubos Petrovic
2020-11-20 09:11:06 +01:00
parent 11aff9d6b6
commit 4ac79cdd23
8 changed files with 103 additions and 47 deletions

4
build.bat Normal file
View File

@@ -0,0 +1,4 @@
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
pause

View File

@@ -16,10 +16,14 @@ String commandQueueKiaENiro[commandQueueCountKiaENiro] = {
//"AT CAF0", // Automatic formatting off //"AT CAF0", // Automatic formatting off
////"AT AT0", // disabled adaptive timing ////"AT AT0", // disabled adaptive timing
"AT DP", "AT DP",
"AT ST10", // reduced timeout to 1, orig.16 "AT ST16", // reduced timeout to 1, orig.16
// Loop from (KIA ENIRO) // Loop from (KIA ENIRO)
// ABS / ESP + AHB
"ATSH7D1",
"22C101", // brake, park/drive mode
// IGPM // IGPM
"ATSH770", "ATSH770",
"22BC03", // low beam "22BC03", // low beam
@@ -39,10 +43,6 @@ String commandQueueKiaENiro[commandQueueCountKiaENiro] = {
"220105", // soh, soc, .. "220105", // soh, soc, ..
"220106", // cooling water temp "220106", // cooling water temp
// ABS / ESP + AHB
"ATSH7D1",
"22C101", // brake, park/drive mode
// Aircondition // Aircondition
"ATSH7B3", "ATSH7B3",
"220100", // in/out temp "220100", // in/out temp
@@ -55,6 +55,7 @@ String commandQueueKiaENiro[commandQueueCountKiaENiro] = {
// CLUSTER MODULE // CLUSTER MODULE
"ATSH7C6", "ATSH7C6",
"22B002", // odo "22B002", // odo
}; };
/** /**

89
config.h Normal file
View File

@@ -0,0 +1,89 @@
#ifdef BOARD_TTGO_T4
#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
/////////////////////////////////////////////////////////////
#define ILI9341_DRIVER
#define TFT_MISO 12
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 27
#define TFT_DC 26
#define TFT_RST 5
#define TFT_BL 4
#define USE_HSPI_PORT
#define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V
#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
#define M5STACK
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 14 // Chip select control pin
#define TFT_DC 27 // Data Command control pin
#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL 32 // LED back-light
#define SPI_FREQUENCY 27000000
#define SPI_READ_FREQUENCY 5000000
#define BUTTON_LEFT 39
#define BUTTON_MIDDLE 38
#define BUTTON_RIGHT 37
#define SPEAKER 25*/
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// TFT COMMON
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define GFXFF 1 // TFT FOnts
// TFT COLORS FOR TTGO
#define TFT_BLACK 0x0000 /* 0, 0, 0 */
#define TFT_NAVY 0x000F /* 0, 0, 128 */
#define TFT_DARKGREEN 0x03E0 /* 0, 128, 0 */
#define TFT_DARKCYAN 0x03EF /* 0, 128, 128 */
#define TFT_MAROON 0x7800 /* 128, 0, 0 */
#define TFT_PURPLE 0x780F /* 128, 0, 128 */
#define TFT_OLIVE 0x7BE0 /* 128, 128, 0 */
#define TFT_LIGHTGREY 0xD69A /* 211, 211, 211 */
#define TFT_DARKGREY 0x7BEF /* 128, 128, 128 */
#define TFT_BLUE 0x001F /* 0, 0, 255 */
#define TFT_GREEN 0x07E0 /* 0, 255, 0 */
#define TFT_CYAN 0x07FF /* 0, 255, 255 */
#define TFT_RED 0xF800 /* 255, 0, 0 */
#define TFT_MAGENTA 0xF81F /* 255, 0, 255 */
#define TFT_YELLOW 0xFFE0 /* 255, 255, 0 */
#define TFT_WHITE 0xFFFF /* 255, 255, 255 */
#define TFT_ORANGE 0xFDA0 /* 255, 180, 0 */
#define TFT_GREENYELLOW 0xB7E0 /* 180, 255, 0 */
#define TFT_PINK 0xFE19 /* 255, 192, 203 */ //Lighter pink, was 0xFC9F
#define TFT_BROWN 0x9A60 /* 150, 75, 0 */
#define TFT_GOLD 0xFEA0 /* 255, 215, 0 */
#define TFT_SILVER 0xC618 /* 192, 192, 192 */
#define TFT_SKYBLUE 0x867D /* 135, 206, 235 */
#define TFT_VIOLET 0x915C /* 180, 46, 226 */
#define TFT_DEFAULT_BK 0x0000 // 0x38E0
#define TFT_TEMP 0x0000 // NAVY
#define TFT_GREENYELLOW 0xB7E0
#define TFT_DARKRED 0x3800 /* 128, 0, 0 */
#define TFT_DARKGREEN2 0x01E0 /* 128, 0, 0 */

Binary file not shown.

View File

@@ -27,6 +27,7 @@
<= 0°C BMS allows max 40A <= 0°C BMS allows max 40A
*/ */
#include "config.h"
#include "SPI.h" #include "SPI.h"
#include "TFT_eSPI.h" #include "TFT_eSPI.h"
#include "BLEDevice.h" #include "BLEDevice.h"
@@ -43,47 +44,7 @@
// PLEASE CHANGE THIS SETTING for your BLE4 // PLEASE CHANGE THIS SETTING for your BLE4
uint32_t PIN = 1234; uint32_t PIN = 1234;
// LILYGO TTGO T4 v1.3 BUTTONS // TFT
#define BUTTON_MIDDLE 37
#define BUTTON_LEFT 38
#define BUTTON_RIGHT 39
#define TFT_BL 4
// TFT COLORS FOR TTGO
#define TFT_BLACK 0x0000 /* 0, 0, 0 */
#define TFT_NAVY 0x000F /* 0, 0, 128 */
#define TFT_DARKGREEN 0x03E0 /* 0, 128, 0 */
#define TFT_DARKCYAN 0x03EF /* 0, 128, 128 */
#define TFT_MAROON 0x7800 /* 128, 0, 0 */
#define TFT_PURPLE 0x780F /* 128, 0, 128 */
#define TFT_OLIVE 0x7BE0 /* 128, 128, 0 */
#define TFT_LIGHTGREY 0xD69A /* 211, 211, 211 */
#define TFT_DARKGREY 0x7BEF /* 128, 128, 128 */
#define TFT_BLUE 0x001F /* 0, 0, 255 */
#define TFT_GREEN 0x07E0 /* 0, 255, 0 */
#define TFT_CYAN 0x07FF /* 0, 255, 255 */
#define TFT_RED 0xF800 /* 255, 0, 0 */
#define TFT_MAGENTA 0xF81F /* 255, 0, 255 */
#define TFT_YELLOW 0xFFE0 /* 255, 255, 0 */
#define TFT_WHITE 0xFFFF /* 255, 255, 255 */
#define TFT_ORANGE 0xFDA0 /* 255, 180, 0 */
#define TFT_GREENYELLOW 0xB7E0 /* 180, 255, 0 */
#define TFT_PINK 0xFE19 /* 255, 192, 203 */ //Lighter pink, was 0xFC9F
#define TFT_BROWN 0x9A60 /* 150, 75, 0 */
#define TFT_GOLD 0xFEA0 /* 255, 215, 0 */
#define TFT_SILVER 0xC618 /* 192, 192, 192 */
#define TFT_SKYBLUE 0x867D /* 135, 206, 235 */
#define TFT_VIOLET 0x915C /* 180, 46, 226 */
#define TFT_DEFAULT_BK 0x0000 // 0x38E0
#define TFT_TEMP 0x0000 // NAVY
#define TFT_GREENYELLOW 0xB7E0
#define TFT_DARKRED 0x3800 /* 128, 0, 0 */
#define TFT_DARKGREEN2 0x01E0 /* 128, 0, 0 */
// TTGO FONTS
#define GFXFF 1 // TFT FOnts
TFT_eSPI tft = TFT_eSPI(); TFT_eSPI tft = TFT_eSPI();
// BLUETOOTH4 // BLUETOOTH4
@@ -688,7 +649,7 @@ bool drawSceneSpeed(bool force) {
sprintf(tmpStr3, "%01.00f", celsius2temperature(params.batTempC)); sprintf(tmpStr3, "%01.00f", celsius2temperature(params.batTempC));
tft.drawString(tmpStr3, 290, 60, GFXFF); tft.drawString(tmpStr3, 290, 60, GFXFF);
// Brake lights // Brake lights
tft.fillRect(210, 30, 40, 40, (params.brakeLights) ? TFT_RED : TFT_BLACK); tft.fillRect(210, 40, 40, 40, (params.brakeLights) ? TFT_RED : TFT_BLACK);
// Soc%, bat.kWh // Soc%, bat.kWh
tft.setFreeFont(&Orbitron_Light_32); tft.setFreeFont(&Orbitron_Light_32);

View File

@@ -1,4 +1,5 @@
// SUPPORTED CARS
#define CAR_KIA_ENIRO_2020_64 0 #define CAR_KIA_ENIRO_2020_64 0
#define CAR_HYUNDAI_KONA_2020_64 1 #define CAR_HYUNDAI_KONA_2020_64 1
#define CAR_HYUNDAI_IONIQ_2018 2 #define CAR_HYUNDAI_IONIQ_2018 2