diff --git a/Board320_240.cpp b/Board320_240.cpp index 749abe2..d04a2a3 100644 --- a/Board320_240.cpp +++ b/Board320_240.cpp @@ -22,6 +22,15 @@ void Board320_240::initBoard() { pinMode(pinButtonLeft, INPUT); pinMode(pinButtonRight, INPUT); + // Init time library + struct timeval tv; + tv.tv_sec = 1589011873; + settimeofday(&tv, NULL); + struct tm now; + getLocalTime(&now, 0); + liveData->params.chargingStartTime = liveData->params.currentTime = mktime(&now); + + // Init display Serial.println("Init tft display"); tft.begin(); diff --git a/evDash.ino b/evDash.ino index bf37865..f0908fa 100644 --- a/evDash.ino +++ b/evDash.ino @@ -47,7 +47,6 @@ #include "BoardM5stackCore.h" #endif // BOARD_M5STACK_CORE -#include #include "config.h" #include "LiveData.h" #include "CarInterface.h" @@ -204,10 +203,11 @@ void setup(void) { Serial.println(""); Serial.println("Booting device..."); - // Init settings/params, board library + // Init settings/params liveData = new LiveData(); liveData->initParams(); + // Init board #ifdef BOARD_TTGO_T4 board = new BoardTtgoT4v13(); #endif // BOARD_TTGO_T4 @@ -218,7 +218,7 @@ void setup(void) { board->loadSettings(); board->initBoard(); - // Car interface + // Init selected car interface switch (liveData->settings.carType) { case CAR_KIA_ENIRO_2020_39: case CAR_KIA_ENIRO_2020_64: @@ -249,14 +249,6 @@ void setup(void) { // Redraw screen board->redrawScreen(); - // Init time library - struct timeval tv; - tv.tv_sec = 1589011873; - settimeofday(&tv, NULL); - struct tm now; - getLocalTime(&now, 0); - liveData->params.chargingStartTime = liveData->params.currentTime = mktime(&now); - #ifdef SIM800L_ENABLED sim800lSetup(); #endif //SIM800L_ENABLED