removed debug screen, prevent sdcard freezing on ttgo (but still not working on ttgo)
This commit is contained in:
@@ -55,13 +55,13 @@ void Board320_240::afterSetup() {
|
|||||||
if (liveData->settings.wifiEnabled == 1) {
|
if (liveData->settings.wifiEnabled == 1) {
|
||||||
|
|
||||||
/*Serial.print("memReport(): MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM bytes free. ");
|
/*Serial.print("memReport(): MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM bytes free. ");
|
||||||
Serial.println(heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM));
|
Serial.println(heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM));
|
||||||
|
|
||||||
Serial.println("WiFi init...");
|
Serial.println("WiFi init...");
|
||||||
WiFi.enableSTA(true);
|
WiFi.enableSTA(true);
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(liveData->settings.wifiSsid, liveData->settings.wifiPassword);
|
WiFi.begin(liveData->settings.wifiSsid, liveData->settings.wifiPassword);
|
||||||
Serial.println("WiFi init completed...");*/
|
Serial.println("WiFi init completed...");*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init GPS
|
// Init GPS
|
||||||
@@ -814,41 +814,6 @@ void Board320_240::drawSceneSoc10Table() {
|
|||||||
spr.drawString(tmpStr1, 310, zeroY + (14 * 15), 2);
|
spr.drawString(tmpStr1, 310, zeroY + (14 * 15), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
DEBUG screen
|
|
||||||
*/
|
|
||||||
void Board320_240::drawSceneDebug() {
|
|
||||||
|
|
||||||
int32_t posx, posy;
|
|
||||||
String chHex, chHex2;
|
|
||||||
uint8_t chByte;
|
|
||||||
|
|
||||||
spr.setTextSize(1); // Size for small 5x7 font
|
|
||||||
spr.setTextColor(TFT_SILVER, TFT_TEMP);
|
|
||||||
spr.setTextDatum(TL_DATUM);
|
|
||||||
spr.drawString(debugAtshRequest, 0, 0, 2);
|
|
||||||
spr.drawString(debugCommandRequest, 128, 0, 2);
|
|
||||||
spr.drawString(liveData->commandRequest, 256, 0, 2);
|
|
||||||
spr.setTextDatum(TR_DATUM);
|
|
||||||
|
|
||||||
for (int i = 0; i < debugLastString.length() / 2; i++) {
|
|
||||||
chHex = debugLastString.substring(i * 2, (i * 2) + 2);
|
|
||||||
chHex2 = debugPreviousString.substring(i * 2, (i * 2) + 2);
|
|
||||||
spr.setTextColor(((chHex.equals(chHex2)) ? TFT_SILVER : TFT_GREEN), TFT_TEMP);
|
|
||||||
chByte = liveData->hexToDec(chHex.c_str(), 1, false);
|
|
||||||
posx = (((i) % 10) * 32) + 24;
|
|
||||||
posy = ((floor((i) / 10)) * 32) + 24;
|
|
||||||
sprintf(tmpStr1, "%03d", chByte);
|
|
||||||
spr.drawString(tmpStr1, posx + 4, posy, 2);
|
|
||||||
|
|
||||||
spr.setTextColor(TFT_YELLOW, TFT_TEMP);
|
|
||||||
sprintf(tmpStr1, "%c", (char)chByte);
|
|
||||||
spr.drawString(tmpStr1, posx + 4, posy + 13, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
debugPreviousString = debugLastString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Modify caption
|
Modify caption
|
||||||
*/
|
*/
|
||||||
@@ -1146,7 +1111,7 @@ void Board320_240::redrawScreen() {
|
|||||||
drawSceneMain();
|
drawSceneMain();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
displayScreenAutoMode = SCREEN_DASH;
|
displayScreenAutoMode = SCREEN_DASH;
|
||||||
}
|
}
|
||||||
// 2. Main screen
|
// 2. Main screen
|
||||||
if (displayScreen == SCREEN_DASH) {
|
if (displayScreen == SCREEN_DASH) {
|
||||||
@@ -1168,10 +1133,6 @@ void Board320_240::redrawScreen() {
|
|||||||
if (displayScreen == SCREEN_SOC10) {
|
if (displayScreen == SCREEN_SOC10) {
|
||||||
drawSceneSoc10Table();
|
drawSceneSoc10Table();
|
||||||
}
|
}
|
||||||
// 7. DEBUG SCREEN
|
|
||||||
if (displayScreen == SCREEN_DEBUG) {
|
|
||||||
drawSceneDebug();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!displayScreenSpeedHud) {
|
if (!displayScreenSpeedHud) {
|
||||||
|
|
||||||
@@ -1281,11 +1242,6 @@ void Board320_240::mainLoop() {
|
|||||||
displayScreenSpeedHud = !displayScreenSpeedHud;
|
displayScreenSpeedHud = !displayScreenSpeedHud;
|
||||||
redrawScreen();
|
redrawScreen();
|
||||||
}
|
}
|
||||||
if (liveData->settings.debugScreen == 1 && displayScreen == SCREEN_DEBUG) {
|
|
||||||
debugCommandIndex = (debugCommandIndex >= liveData->commandQueueCount) ? liveData->commandQueueLoopFrom : debugCommandIndex + 1;
|
|
||||||
redrawScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1312,7 +1268,7 @@ void Board320_240::mainLoop() {
|
|||||||
|
|
||||||
// SD card recording
|
// SD card recording
|
||||||
if (liveData->params.sdcardInit && liveData->params.sdcardRecording && liveData->params.sdcardCanNotify &&
|
if (liveData->params.sdcardInit && liveData->params.sdcardRecording && liveData->params.sdcardCanNotify &&
|
||||||
(liveData->params.odoKm != -1 && liveData->params.socPerc != -1)) {
|
(liveData->params.odoKm != -1 && liveData->params.socPerc != -1)) {
|
||||||
|
|
||||||
//Serial.println(&now, "%y%m%d%H%M");
|
//Serial.println(&now, "%y%m%d%H%M");
|
||||||
|
|
||||||
@@ -1371,10 +1327,20 @@ bool Board320_240::sdcardMount() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int8_t countdown = 3;
|
int8_t countdown = 3;
|
||||||
|
bool SdState;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
Serial.print("Initializing SD card...");
|
Serial.print("Initializing SD card...");
|
||||||
|
#ifdef BOARD_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
|
||||||
|
#ifdef BOARD_M5STACK_COREM5STACK
|
||||||
|
SdState = SD.begin(pinSdcardCs);
|
||||||
|
#endif // BOARD_M5STACK_CORE
|
||||||
|
|
||||||
if (SD.begin(pinSdcardCs)) {
|
if (SdState) {
|
||||||
|
|
||||||
uint8_t cardType = SD.cardType();
|
uint8_t cardType = SD.cardType();
|
||||||
if (cardType == CARD_NONE) {
|
if (cardType == CARD_NONE) {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include <TFT_eSPI.h>
|
#include <TFT_eSPI.h>
|
||||||
#include <TinyGPS++.h>
|
#include <TinyGPS++.h>
|
||||||
#include "BoardInterface.h"
|
#include "BoardInterface.h"
|
||||||
|
#include <SD.h>
|
||||||
|
#include <SPI.h>
|
||||||
|
|
||||||
class Board320_240 : public BoardInterface {
|
class Board320_240 : public BoardInterface {
|
||||||
|
|
||||||
@@ -23,7 +25,6 @@ class Board320_240 : public BoardInterface {
|
|||||||
// TFT, SD SPI
|
// 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);
|
|
||||||
HardwareSerial* gpsHwUart = NULL;
|
HardwareSerial* gpsHwUart = NULL;
|
||||||
TinyGPSPlus gps;
|
TinyGPSPlus gps;
|
||||||
char tmpStr1[20];
|
char tmpStr1[20];
|
||||||
|
|||||||
@@ -24,12 +24,6 @@ class BoardInterface {
|
|||||||
bool testDataMode = false;
|
bool testDataMode = false;
|
||||||
bool scanDevices = false;
|
bool scanDevices = false;
|
||||||
String sdcardRecordBuffer = "";
|
String sdcardRecordBuffer = "";
|
||||||
// Debug screen - next command with right button
|
|
||||||
uint16_t debugCommandIndex = 0;
|
|
||||||
String debugAtshRequest = "ATSH7E4";
|
|
||||||
String debugCommandRequest = "220101";
|
|
||||||
String debugLastString = "620101FFF7E7FF99000000000300B10EFE120F11100F12000018C438C30B00008400003864000035850000153A00001374000647010D017F0BDA0BDA03E8";
|
|
||||||
String debugPreviousString = "620101FFF7E7FFB3000000000300120F9B111011101011000014CC38CB3B00009100003A510000367C000015FB000013D3000690250D018E0000000003E8";
|
|
||||||
//
|
//
|
||||||
void setLiveData(LiveData* pLiveData);
|
void setLiveData(LiveData* pLiveData);
|
||||||
void attachCar(CarInterface* pCarInterface);
|
void attachCar(CarInterface* pCarInterface);
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#include "LiveData.h"
|
#include "LiveData.h"
|
||||||
#include "CarRenaultZoe.h"
|
#include "CarRenaultZoe.h"
|
||||||
|
|
||||||
#define commandQueueCountRenaultZoe 18
|
#define commandQueueCountRenaultZoe 28
|
||||||
#define commandQueueLoopFromRenaultZoe 11
|
#define commandQueueLoopFromRenaultZoe 9
|
||||||
|
|
||||||
/**
|
/**
|
||||||
activateCommandQueue
|
activateCommandQueue
|
||||||
@@ -32,6 +32,7 @@ void CarRenaultZoe::activateCommandQueue() {
|
|||||||
////"AT AT0", // disabled adaptive timing
|
////"AT AT0", // disabled adaptive timing
|
||||||
"AT DP",
|
"AT DP",
|
||||||
"AT ST16", // reduced timeout to 1, orig.16
|
"AT ST16", // reduced timeout to 1, orig.16
|
||||||
|
|
||||||
// Loop from (RENAULT ZOE)
|
// Loop from (RENAULT ZOE)
|
||||||
|
|
||||||
// LBC Lithium battery controller
|
// LBC Lithium battery controller
|
||||||
@@ -45,6 +46,18 @@ void CarRenaultZoe::activateCommandQueue() {
|
|||||||
"2141",
|
"2141",
|
||||||
"2142",
|
"2142",
|
||||||
"2161",
|
"2161",
|
||||||
|
|
||||||
|
// CLUSTER Instrument panel
|
||||||
|
"ATSH743",
|
||||||
|
"ATFCSH743",
|
||||||
|
"atfcsd300010",
|
||||||
|
"atfcsm1",
|
||||||
|
"220201",
|
||||||
|
"220202",
|
||||||
|
"220203",
|
||||||
|
"220204",
|
||||||
|
"220205",
|
||||||
|
"220206",
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#define SCREEN_CELLS 4
|
#define SCREEN_CELLS 4
|
||||||
#define SCREEN_CHARGING 5
|
#define SCREEN_CHARGING 5
|
||||||
#define SCREEN_SOC10 6
|
#define SCREEN_SOC10 6
|
||||||
#define SCREEN_DEBUG 7
|
|
||||||
|
|
||||||
// Structure with realtime values
|
// Structure with realtime values
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# evDash (old enirodashboard)
|
# evDash (old enirodashboard)
|
||||||
|
|
||||||
Supported devices
|
Supported devices
|
||||||
1. LILYGO TTGO T4 v1.3
|
1. M5STACK CORE1 IOT Development Kit (best option)
|
||||||
2. M5STACK CORE1 IOT Development Kit
|
2. LILYGO TTGO T4 v1.3 (!!! limited support, no SDcard/GSM/GPS/CAN module)
|
||||||
|
|
||||||
Working only with electric vehicles
|
Working only with electric vehicles
|
||||||
Kia e-NIRO (EV), Hyundai Kona EV, Hyundai Ioniq EV, Kia Niro Phev 8.9kWh
|
Kia e-NIRO (EV), Hyundai Kona EV, Hyundai Ioniq EV, Kia Niro Phev 8.9kWh
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# RELEASE NOTES
|
# RELEASE NOTES
|
||||||
|
|
||||||
### Next version
|
### Next version
|
||||||
|
- removed debug screen
|
||||||
|
- sdcard working only with m5stack
|
||||||
|
|
||||||
### v2.1.1 2020-12-14
|
### v2.1.1 2020-12-14
|
||||||
- tech refactoring: `hexToDecFromResponse`, `decFromResponse`
|
- tech refactoring: `hexToDecFromResponse`, `decFromResponse`
|
||||||
|
|||||||
BIN
dist/ttgo_t4_v13/evDash.ino.bin
vendored
BIN
dist/ttgo_t4_v13/evDash.ino.bin
vendored
Binary file not shown.
24
evDash.ino
24
evDash.ino
@@ -99,6 +99,7 @@ bool doNextAtCommand() {
|
|||||||
Serial.print(">>> ");
|
Serial.print(">>> ");
|
||||||
Serial.println(liveData->commandRequest);
|
Serial.println(liveData->commandRequest);
|
||||||
String tmpStr = liveData->commandRequest + "\r";
|
String tmpStr = liveData->commandRequest + "\r";
|
||||||
|
liveData->responseRowMerged = "";
|
||||||
liveData->pRemoteCharacteristicWrite->writeValue(tmpStr.c_str(), tmpStr.length());
|
liveData->pRemoteCharacteristicWrite->writeValue(tmpStr.c_str(), tmpStr.length());
|
||||||
liveData->commandQueueIndex++;
|
liveData->commandQueueIndex++;
|
||||||
|
|
||||||
@@ -116,9 +117,6 @@ bool parseRow() {
|
|||||||
|
|
||||||
// Merge 0:xxxx 1:yyyy 2:zzzz to single xxxxyyyyzzzz string
|
// Merge 0:xxxx 1:yyyy 2:zzzz to single xxxxyyyyzzzz string
|
||||||
if (liveData->responseRow.length() >= 2 && liveData->responseRow.charAt(1) == ':') {
|
if (liveData->responseRow.length() >= 2 && liveData->responseRow.charAt(1) == ':') {
|
||||||
if (liveData->responseRow.charAt(0) == '0') {
|
|
||||||
liveData->responseRowMerged = "";
|
|
||||||
}
|
|
||||||
liveData->responseRowMerged += liveData->responseRow.substring(2);
|
liveData->responseRowMerged += liveData->responseRow.substring(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,15 +131,6 @@ bool parseRowMerged() {
|
|||||||
Serial.print("merged:");
|
Serial.print("merged:");
|
||||||
Serial.println(liveData->responseRowMerged);
|
Serial.println(liveData->responseRowMerged);
|
||||||
|
|
||||||
// Catch output for debug screen
|
|
||||||
if (board->displayScreen == SCREEN_DEBUG) {
|
|
||||||
if (board->debugCommandIndex == liveData->commandQueueIndex) {
|
|
||||||
board->debugAtshRequest = liveData->currentAtshRequest;
|
|
||||||
board->debugCommandRequest = liveData->commandRequest;
|
|
||||||
board->debugLastString = liveData->responseRowMerged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse by selected car interface
|
// Parse by selected car interface
|
||||||
car->parseRowMerged();
|
car->parseRowMerged();
|
||||||
|
|
||||||
@@ -202,8 +191,8 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (advertisedDevice.getServiceDataUUID().toString() != "<NULL>") {
|
if (advertisedDevice.getServiceDataUUID().toString() != "<NULL>") {
|
||||||
Serial.print("ServiceDataUUID: ");
|
Serial.print("ServiceDataUUID: ");
|
||||||
Serial.println(advertisedDevice.getServiceDataUUID().toString().c_str());
|
Serial.println(advertisedDevice.getServiceDataUUID().toString().c_str());
|
||||||
if (advertisedDevice.getServiceUUID().toString() != "<NULL>") {
|
if (advertisedDevice.getServiceUUID().toString() != "<NULL>") {
|
||||||
Serial.print("ServiceUUID: ");
|
Serial.print("ServiceUUID: ");
|
||||||
Serial.println(advertisedDevice.getServiceUUID().toString().c_str());
|
Serial.println(advertisedDevice.getServiceUUID().toString().c_str());
|
||||||
@@ -436,7 +425,7 @@ bool sim800lSetup() {
|
|||||||
|
|
||||||
bool sim800l_gprs = sim800l->setupGPRS(liveData->settings.gprsApn);
|
bool sim800l_gprs = sim800l->setupGPRS(liveData->settings.gprsApn);
|
||||||
for (uint8_t i = 0; i < 5 && !sim800l_gprs; i++) {
|
for (uint8_t i = 0; i < 5 && !sim800l_gprs; i++) {
|
||||||
Serial.println("Problem to set GPRS APN, retry in 1 sec");
|
Serial.println("Problem to set GPRS APN, retry in 1 sec");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
sim800l_gprs = sim800l->setupGPRS(liveData->settings.gprsApn);
|
sim800l_gprs = sim800l->setupGPRS(liveData->settings.gprsApn);
|
||||||
}
|
}
|
||||||
@@ -466,7 +455,7 @@ bool sendDataViaGPRS() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!sim800l->isConnectedGPRS()) {
|
if (!sim800l->isConnectedGPRS()) {
|
||||||
Serial.println("GPRS not connected... Connecting");
|
Serial.println("GPRS not connected... Connecting");
|
||||||
bool connected = sim800l->connectGPRS();
|
bool connected = sim800l->connectGPRS();
|
||||||
for (uint8_t i = 0; i < 5 && !connected; i++) {
|
for (uint8_t i = 0; i < 5 && !connected; i++) {
|
||||||
@@ -474,7 +463,7 @@ bool sendDataViaGPRS() {
|
|||||||
delay(1000);
|
delay(1000);
|
||||||
connected = sim800l->connectGPRS();
|
connected = sim800l->connectGPRS();
|
||||||
}
|
}
|
||||||
if(connected) {
|
if (connected) {
|
||||||
Serial.println("GPRS connected!");
|
Serial.println("GPRS connected!");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("GPRS not connected! Reseting SIM800L module!");
|
Serial.println("GPRS not connected! Reseting SIM800L module!");
|
||||||
@@ -571,7 +560,6 @@ void setup(void) {
|
|||||||
car->setLiveData(liveData);
|
car->setLiveData(liveData);
|
||||||
car->activateCommandQueue();
|
car->activateCommandQueue();
|
||||||
board->attachCar(car);
|
board->attachCar(car);
|
||||||
board->debugCommandIndex = liveData->commandQueueLoopFrom;
|
|
||||||
|
|
||||||
// Redraw screen
|
// Redraw screen
|
||||||
board->redrawScreen();
|
board->redrawScreen();
|
||||||
|
|||||||
2
menu.h
2
menu.h
@@ -36,7 +36,7 @@ MENU_ITEM menuItemsSource[100] = {
|
|||||||
{MENU_SCREEN_BRIGHTNESS, 3, -1, "LCD brightness"},
|
{MENU_SCREEN_BRIGHTNESS, 3, -1, "LCD brightness"},
|
||||||
{MENU_PREDRAWN_GRAPHS, 3, -1, "Pre-drawn ch.graphs"},
|
{MENU_PREDRAWN_GRAPHS, 3, -1, "Pre-drawn ch.graphs"},
|
||||||
{MENU_HEADLIGHTS_REMINDER, 3, -1, "Headlight reminder"},
|
{MENU_HEADLIGHTS_REMINDER, 3, -1, "Headlight reminder"},
|
||||||
{MENU_DEBUG_SCREEN, 3, -1, "Debug screen"},
|
// {MENU_DEBUG_SCREEN, 3, -1, "Debug screen"},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// NTP
|
// NTP
|
||||||
|
|||||||
Reference in New Issue
Block a user