removed debug screen, prevent sdcard freezing on ttgo (but still not working on ttgo)

This commit is contained in:
Lubos Petrovic
2020-12-16 08:05:53 +01:00
parent 9695b68609
commit 4532105adb
10 changed files with 50 additions and 87 deletions

View File

@@ -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
*/ */
@@ -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();
}
} }
} }
} }
@@ -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) {

View File

@@ -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];

View File

@@ -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);

View File

@@ -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",
}; };
// //

View File

@@ -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 {

View File

@@ -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

View File

@@ -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`

Binary file not shown.

View File

@@ -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();
@@ -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
View File

@@ -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