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&)
## Release notes
- Fixed menu
### v1.8.3 2020-11-28
- Automatic shutdown when car goes off
- Fixed M5stack speaker noise
- Fixed menu, added scroll support
### v1.8.2 2020-11-25
- Removed screen flickering. (via Sprites, esp32 with SRAM is now required!)

View File

@@ -2,43 +2,52 @@
// SELECT HARDWARE !!!!
////////////////////////////////////////////////////////////
//#define BOARD_TTGO_T4
#define BOARD_M5STACK_CORE
#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
#define TFT_SCLK 18
#define TFT_CS 27
#define TFT_DC 26
#define TFT_DC 32
#define TFT_RST 5
//#define TFT_BACKLIGHT_ON HIGH
#define TFT_BL 4
#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 SD_CS 13
#define SD_MOSI 15
#define SD_MISO 2
#define SD_SCLK 14
#define BUTTON_LEFT 38
#define BUTTON_MIDDLE 37
#define BUTTON_RIGHT 39
#define SDCARD_CS 13
#define SDCARD_MOSI 15
#define SDCARD_MISO 2
#define SDCARD_SCK 14
#endif // BOARD_TTGO_T4
/////////////////////////////////////////////////////////////
// BOARD M5STACK CORE IOT (M5-K001)
/////////////////////////////////////////////////////////////
#ifdef BOARD_M5STACK_CORE
#define USER_SETUP_LOADED 1
#define ILI9341_DRIVER
#define M5STACK
@@ -51,15 +60,18 @@
#define TFT_BL 32 // LED back-light
#define SPI_FREQUENCY 27000000
#define SPI_READ_FREQUENCY 5000000
#define SPEAKER_PIN 25
#define INVERT_DISPLAY
#define BUTTON_LEFT 37
#define BUTTON_MIDDLE 38
#define BUTTON_RIGHT 39
#define SPEAKER 25
#define INVERT_DISPLAY
#define SDCARD_CS 4
#define SDCARD_MOSI 23
#define SDCARD_MISO 19
#define SDCARD_SCK 18
#define SD_CS 4
#define SD_MOSI 23
#define SD_MISO 19
#define SD_SCLK 18
#endif // BOARD_M5STACK_CORE
/////////////////////////////////////////////////////////////

Binary file not shown.

Binary file not shown.

View File

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