refactoring

This commit is contained in:
Lubos Petrovic
2020-12-20 15:44:49 +01:00
parent d5fc88fb7b
commit e8b0b10be0
2 changed files with 12 additions and 11 deletions

View File

@@ -22,6 +22,15 @@ void Board320_240::initBoard() {
pinMode(pinButtonLeft, INPUT); pinMode(pinButtonLeft, INPUT);
pinMode(pinButtonRight, 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 // Init display
Serial.println("Init tft display"); Serial.println("Init tft display");
tft.begin(); tft.begin();

View File

@@ -47,7 +47,6 @@
#include "BoardM5stackCore.h" #include "BoardM5stackCore.h"
#endif // BOARD_M5STACK_CORE #endif // BOARD_M5STACK_CORE
#include <sys/time.h>
#include "config.h" #include "config.h"
#include "LiveData.h" #include "LiveData.h"
#include "CarInterface.h" #include "CarInterface.h"
@@ -204,10 +203,11 @@ void setup(void) {
Serial.println(""); Serial.println("");
Serial.println("Booting device..."); Serial.println("Booting device...");
// Init settings/params, board library // Init settings/params
liveData = new LiveData(); liveData = new LiveData();
liveData->initParams(); liveData->initParams();
// Init board
#ifdef BOARD_TTGO_T4 #ifdef BOARD_TTGO_T4
board = new BoardTtgoT4v13(); board = new BoardTtgoT4v13();
#endif // BOARD_TTGO_T4 #endif // BOARD_TTGO_T4
@@ -218,7 +218,7 @@ void setup(void) {
board->loadSettings(); board->loadSettings();
board->initBoard(); board->initBoard();
// Car interface // Init selected car interface
switch (liveData->settings.carType) { switch (liveData->settings.carType) {
case CAR_KIA_ENIRO_2020_39: case CAR_KIA_ENIRO_2020_39:
case CAR_KIA_ENIRO_2020_64: case CAR_KIA_ENIRO_2020_64:
@@ -249,14 +249,6 @@ void setup(void) {
// Redraw screen // Redraw screen
board->redrawScreen(); 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 #ifdef SIM800L_ENABLED
sim800lSetup(); sim800lSetup();
#endif //SIM800L_ENABLED #endif //SIM800L_ENABLED