improved menu (added scroll support), m5stack speaker fix

This commit is contained in:
Lubos Petrovic
2020-11-28 20:47:42 +01:00
parent 22b1dfe2fc
commit 5ef1bde3fa
5 changed files with 60 additions and 39 deletions

View File

@@ -61,10 +61,10 @@ Screen list
[![Watch the video](https://github.com/nickn17/enirodashboard/blob/master/screenshots/v0.9.jpg)](https://www.youtube.com/watch?v=Jg5VP2P58Yg&) [![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.3 2020-11-28
- Fixed menu
- Automatic shutdown when car goes off - Automatic shutdown when car goes off
- Fixed M5stack speaker noise
- Fixed menu, added scroll support
### v1.8.2 2020-11-25 ### v1.8.2 2020-11-25
- Removed screen flickering. (via Sprites, esp32 with SRAM is now required!) - Removed screen flickering. (via Sprites, esp32 with SRAM is now required!)

View File

@@ -2,43 +2,52 @@
// SELECT HARDWARE !!!! // SELECT HARDWARE !!!!
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//#define BOARD_TTGO_T4 #define BOARD_TTGO_T4
#define BOARD_M5STACK_CORE //#define BOARD_M5STACK_CORE
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#define USER_SETUP_LOADED 1 #define USER_SETUP_LOADED 1
#define SPI_FREQUENCY 27000000 #define SPI_FREQUENCY 27000000
//#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000 #define SPI_TOUCH_FREQUENCY 2500000
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// BOARD LILYGO TTGO T4 v1.3 // BOARD LILYGO TTGO T4 v1.3
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
#ifdef BOARD_TTGO_T4 #ifdef BOARD_TTGO_T4
#define ILI9341_DRIVER #define ILI9341_DRIVER
#define TFT_MISO 12 #define TFT_MISO 12
#define TFT_MOSI 23 #define TFT_MOSI 23
#define TFT_SCLK 18 #define TFT_SCLK 18
#define TFT_CS 27 #define TFT_CS 27
#define TFT_DC 26 #define TFT_DC 32
#define TFT_RST 5 #define TFT_RST 5
//#define TFT_BACKLIGHT_ON HIGH
#define TFT_BL 4 #define TFT_BL 4
#define USE_HSPI_PORT #define USE_HSPI_PORT
//#define SPI_FREQUENCY 40000000 // Maximum for ILI9341
#define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V #define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V
#define SD_CS 13
#define SD_MOSI 15
#define SD_MISO 2
#define SD_SCLK 14
#define BUTTON_LEFT 38 #define BUTTON_LEFT 38
#define BUTTON_MIDDLE 37 #define BUTTON_MIDDLE 37
#define BUTTON_RIGHT 39 #define BUTTON_RIGHT 39
#define SDCARD_CS 13
#define SDCARD_MOSI 15
#define SDCARD_MISO 2
#define SDCARD_SCK 14
#endif // BOARD_TTGO_T4 #endif // BOARD_TTGO_T4
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// BOARD M5STACK CORE IOT (M5-K001) // BOARD M5STACK CORE IOT (M5-K001)
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
#ifdef BOARD_M5STACK_CORE #ifdef BOARD_M5STACK_CORE
#define USER_SETUP_LOADED 1 #define USER_SETUP_LOADED 1
#define ILI9341_DRIVER #define ILI9341_DRIVER
#define M5STACK #define M5STACK
@@ -51,15 +60,18 @@
#define TFT_BL 32 // LED back-light #define TFT_BL 32 // LED back-light
#define SPI_FREQUENCY 27000000 #define SPI_FREQUENCY 27000000
#define SPI_READ_FREQUENCY 5000000 #define SPI_READ_FREQUENCY 5000000
#define SPEAKER_PIN 25
#define INVERT_DISPLAY
#define BUTTON_LEFT 37 #define BUTTON_LEFT 37
#define BUTTON_MIDDLE 38 #define BUTTON_MIDDLE 38
#define BUTTON_RIGHT 39 #define BUTTON_RIGHT 39
#define SPEAKER 25
#define INVERT_DISPLAY #define SD_CS 4
#define SDCARD_CS 4 #define SD_MOSI 23
#define SDCARD_MOSI 23 #define SD_MISO 19
#define SDCARD_MISO 19 #define SD_SCLK 18
#define SDCARD_SCK 18
#endif // BOARD_M5STACK_CORE #endif // BOARD_M5STACK_CORE
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////

Binary file not shown.

Binary file not shown.

View File

@@ -27,24 +27,23 @@
<= 0°C BMS allows max 40A <= 0°C BMS allows max 40A
*/ */
#define APP_VERSION "v1.9.0" #define APP_VERSION "v1.8.3b"
#include "FS.h" #include <SPI.h>
#include "SD.h" #include <TFT_eSPI.h>
#include "SPI.h" #include <BLEDevice.h>
#include "TFT_eSPI.h" #include "./config.h"
#include "BLEDevice.h" #include <mySD.h>
//#include <SD.h>
#include <EEPROM.h> #include <EEPROM.h>
#include <sys/time.h> #include <sys/time.h>
#include <analogWrite.h> #include <analogWrite.h>
#include <WiFi.h> #include "./struct.h"
#include "config.h" #include "./menu.h"
#include "struct.h" #include "./car_kia_eniro.h"
#include "menu.h" #include "./car_hyundai_ioniq.h"
#include "car_kia_eniro.h" #include "./car_renault_zoe.h"
#include "car_hyundai_ioniq.h" #include "./car_debug_obd2_kia.h"
#include "car_renault_zoe.h"
#include "car_debug_obd2_kia.h"
// PLEASE CHANGE THIS SETTING for your BLE4 // PLEASE CHANGE THIS SETTING for your BLE4
uint32_t PIN = 1234; uint32_t PIN = 1234;
@@ -53,9 +52,10 @@ const char* password = "your-password";
long timezone = 1; long timezone = 1;
byte daysavetime = 1; byte daysavetime = 1;
// TFT // TFT, SD SPI
TFT_eSPI tft = TFT_eSPI(); TFT_eSPI tft = TFT_eSPI();
TFT_eSprite spr = TFT_eSprite(&tft); TFT_eSprite spr = TFT_eSprite(&tft);
//SPIClass spiSD(HSPI);
// BLUETOOTH4 // BLUETOOTH4
static boolean bleConnect = true; static boolean bleConnect = true;
@@ -183,7 +183,7 @@ bool loadSettings() {
// Init // Init
settings.initFlag = 183; settings.initFlag = 183;
settings.settingsVersion = 2; settings.settingsVersion = 3;
settings.carType = CAR_KIA_ENIRO_2020_64; settings.carType = CAR_KIA_ENIRO_2020_64;
// Default OBD adapter MAC and UUID's // Default OBD adapter MAC and UUID's
@@ -1845,6 +1845,7 @@ void setup(void) {
Serial.println(""); Serial.println("");
Serial.println("Booting device..."); Serial.println("Booting device...");
//
initStructure(); initStructure();
loadSettings(); loadSettings();
@@ -1855,9 +1856,9 @@ void setup(void) {
#ifdef BOARD_M5STACK_CORE #ifdef BOARD_M5STACK_CORE
// mute speaker // mute speaker
dacWrite(25, 0); Serial.println("Mute speaker for m5stack");
dacWrite(SPEAKER_PIN, 0);
#endif // BOARD_M5STACK_C #endif // BOARD_M5STACK_C
// Init display // Init display
Serial.println("Init TFT display"); Serial.println("Init TFT display");
tft.begin(); tft.begin();
@@ -1875,11 +1876,6 @@ void setup(void) {
if (psramFound()) if (psramFound())
psramUsed = true; psramUsed = true;
#endif #endif
// if (!psramUsed) {
// displayMessage("SRAM support required", "Compile with ESP32 Wrover CPU");
// delay(60000);
// ESP.restart();
// }
spr.setColorDepth((psramUsed) ? 16 : 8); spr.setColorDepth((psramUsed) ? 16 : 8);
spr.createSprite(320, 240); spr.createSprite(320, 240);
redrawScreen(); redrawScreen();
@@ -1921,6 +1917,19 @@ void setup(void) {
testData(); testData();
} }
// Init SDCARD
if (!SD.begin(SD_CS, SD_MOSI, SD_MISO, SD_SCLK)) {
Serial.println("SDCARD initialization failed!");
} else {
Serial.println("SDCARD initialization done.");
}
/*spiSD.begin(SD_SCLK,SD_MISO,SD_MOSI,SD_CS);
if(!SD.begin( SD_CS, spiSD, 27000000)){
Serial.println("SDCARD initialization failed!");
} else {
Serial.println("SDCARD initialization done.");
}*/
// Start BLE connection // Start BLE connection
line = ""; line = "";
Serial.println("Start BLE with PIN auth"); Serial.println("Start BLE with PIN auth");