update
This commit is contained in:
@@ -69,6 +69,8 @@ void Board320_240::afterSetup() {
|
||||
sdcardToggleRecording();
|
||||
}
|
||||
}
|
||||
|
||||
BoardInterface::afterSetup();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
class Board320_240 : public BoardInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
// TFT, SD SPI
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
TFT_eSprite spr = TFT_eSprite(&tft);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <EEPROM.h>
|
||||
#include <BLEDevice.h>
|
||||
#include "BoardInterface.h"
|
||||
#include "CommObd2Ble4.h";
|
||||
#include "CommObd2Can.h";
|
||||
#include "LiveData.h"
|
||||
|
||||
/**
|
||||
@@ -185,6 +187,23 @@ void BoardInterface::loadSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* After setup
|
||||
*/
|
||||
void BoardInterface::afterSetup() {
|
||||
|
||||
// Init Comm iterface
|
||||
if (liveData->settings.commType == COMM_TYPE_OBD2BLE4) {
|
||||
commInterface = new CommObd2Ble4();
|
||||
} else
|
||||
if (liveData->settings.commType == COMM_TYPE_OBD2CAN) {
|
||||
commInterface = new CommObd2Ble4();
|
||||
//commInterface = new CommObd2Can();
|
||||
}
|
||||
//commInterface->initComm(liveData, NULL);
|
||||
commInterface->connectDevice();
|
||||
}
|
||||
|
||||
/**
|
||||
Custom commands
|
||||
*/
|
||||
|
||||
@@ -4,10 +4,14 @@
|
||||
#include <FS.h>
|
||||
#include "LiveData.h"
|
||||
#include "CarInterface.h"
|
||||
#include "CommInterface.h"
|
||||
|
||||
class BoardInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
LiveData* liveData;
|
||||
CarInterface* carInterface;
|
||||
CommInterface* commInterface;
|
||||
public:
|
||||
// Screens, buttons
|
||||
byte displayScreen = SCREEN_AUTO;
|
||||
@@ -27,8 +31,6 @@ class BoardInterface {
|
||||
String debugLastString = "620101FFF7E7FF99000000000300B10EFE120F11100F12000018C438C30B00008400003864000035850000153A00001374000647010D017F0BDA0BDA03E8";
|
||||
String debugPreviousString = "620101FFF7E7FFB3000000000300120F9B111011101011000014CC38CB3B00009100003A510000367C000015FB000013D3000690250D018E0000000003E8";
|
||||
//
|
||||
LiveData* liveData;
|
||||
CarInterface* carInterface;
|
||||
void setLiveData(LiveData* pLiveData);
|
||||
void attachCar(CarInterface* pCarInterface);
|
||||
virtual void initBoard()=0;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
class BoardM5stackCore : public Board320_240 {
|
||||
|
||||
private:
|
||||
protected:
|
||||
public:
|
||||
void initBoard() override;
|
||||
void mainLoop() override;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
//
|
||||
class BoardTtgoT4v13 : public Board320_240 {
|
||||
|
||||
private:
|
||||
protected:
|
||||
public:
|
||||
void initBoard() override;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CarHyundaiIoniq : public CarInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
public:
|
||||
void activateCommandQueue() override;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CarInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
public:
|
||||
LiveData* liveData;
|
||||
void setLiveData(LiveData* pLiveData);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CarKiaDebugObd2 : public CarInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
public:
|
||||
void activateCommandQueue() override;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CarKiaEniro : public CarInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
public:
|
||||
void activateCommandQueue() override;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CarRenaultZoe : public CarInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
public:
|
||||
void activateCommandQueue() override;
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
#define COMMINTERFACE_CPP
|
||||
|
||||
#include "CommInterface.h"
|
||||
//#include "BoardInterface.h"
|
||||
#include "LiveData.h"
|
||||
|
||||
void CommInterface::initComm(LiveData* pLiveData/*, BoardInterface* pBoard*/) {
|
||||
liveData = pLiveData;
|
||||
//board = pBoard;
|
||||
}
|
||||
|
||||
#endif // COMMINTERFACE_CPP
|
||||
|
||||
@@ -2,11 +2,18 @@
|
||||
#define COMMINTERFACE_H
|
||||
|
||||
#include "LiveData.h"
|
||||
//#include "BoardInterface.h"
|
||||
|
||||
class CommInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
LiveData* liveData;
|
||||
//BoardInterface* board;
|
||||
public:
|
||||
void initComm(LiveData* pLiveData/*, BoardInterface* pBoard**/);
|
||||
virtual void connectDevice() = 0;
|
||||
virtual void disconnectDevice() = 0;
|
||||
virtual void scanDevices() = 0;
|
||||
};
|
||||
|
||||
#endif // COMMINTERFACE_H
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
#ifndef COMMOBD2BLE4_CPP
|
||||
#define COMMOBD2BLE4_CPP
|
||||
|
||||
#include "CommInterface.h"
|
||||
#include <BLEDevice.h>
|
||||
#include "CommObd2Ble4.h"
|
||||
#include "LiveData.h"
|
||||
|
||||
/**
|
||||
* Connect ble4 adapter
|
||||
*/
|
||||
void CommObd2Ble4::connectDevice() {
|
||||
Serial.println("COMM connectDevice");
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect device
|
||||
*/
|
||||
void CommObd2Ble4::disconnectDevice() {
|
||||
Serial.println("COMM disconnectDevice");
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan device list
|
||||
*/
|
||||
void CommObd2Ble4::scanDevices() {
|
||||
Serial.println("COMM scanDevices");
|
||||
}
|
||||
|
||||
#endif // COMMOBD2BLE4_CPP
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
#define COMMOBD2BLE4_H
|
||||
|
||||
#include "LiveData.h"
|
||||
#include "CommInterface.h"
|
||||
|
||||
class CommObd2Ble4 : public CommInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
uint32_t PIN = 1234;
|
||||
public:
|
||||
void connectDevice() override;
|
||||
void disconnectDevice() override;
|
||||
void scanDevices() override;
|
||||
};
|
||||
|
||||
#endif // COMMOBD2BLE4_H
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CommObd2Can : public CommInterface {
|
||||
|
||||
private:
|
||||
protected:
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
#define CAR_RENAULT_ZOE 5
|
||||
#define CAR_DEBUG_OBD2_KIA 999
|
||||
|
||||
//
|
||||
#define COMM_TYPE_OBD2BLE4 0
|
||||
#define COMM_TYPE_OBD2CAN 1
|
||||
|
||||
// SCREENS
|
||||
#define SCREEN_BLANK 0
|
||||
#define SCREEN_AUTO 1
|
||||
@@ -179,7 +183,7 @@ typedef struct {
|
||||
|
||||
//
|
||||
class LiveData {
|
||||
private:
|
||||
protected:
|
||||
public:
|
||||
// Command loop
|
||||
uint16_t commandQueueCount;
|
||||
|
||||
BIN
dist/m5stack_core1/evDash.ino.bin
vendored
BIN
dist/m5stack_core1/evDash.ino.bin
vendored
Binary file not shown.
17
evDash.ino
17
evDash.ino
@@ -39,7 +39,6 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SPI.h>
|
||||
#include <BLEDevice.h>
|
||||
#include "BoardInterface.h"
|
||||
|
||||
#ifdef BOARD_TTGO_T4
|
||||
@@ -49,6 +48,7 @@
|
||||
#include "BoardM5stackCore.h"
|
||||
#endif // BOARD_M5STACK_CORE
|
||||
|
||||
#include <BLEDevice.h>
|
||||
#include <sys/time.h>
|
||||
#include "config.h"
|
||||
#include "LiveData.h"
|
||||
@@ -66,9 +66,6 @@
|
||||
SIM800L* sim800l;
|
||||
#endif //SIM800L_ENABLED
|
||||
|
||||
// PLEASE CHANGE THIS SETTING for your BLE4
|
||||
uint32_t PIN = 1234;
|
||||
|
||||
// Temporary variables
|
||||
char ch;
|
||||
String line;
|
||||
@@ -218,6 +215,8 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
|
||||
}
|
||||
};
|
||||
|
||||
uint32_t PIN = 1234;
|
||||
|
||||
/**
|
||||
BLE Security
|
||||
*/
|
||||
@@ -637,11 +636,11 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
// Can send next command from queue to OBD
|
||||
if (liveData->canSendNextAtCommand) {
|
||||
liveData->canSendNextAtCommand = false;
|
||||
doNextAtCommand();
|
||||
}
|
||||
// Can send next command from queue to OBD
|
||||
if (liveData->canSendNextAtCommand) {
|
||||
liveData->canSendNextAtCommand = false;
|
||||
doNextAtCommand();
|
||||
}
|
||||
|
||||
#ifdef SIM800L_ENABLED
|
||||
if (liveData->params.lastDataSent + SIM800L_TIMER < liveData->params.currentTime && liveData->params.sim800l_enabled) {
|
||||
|
||||
Reference in New Issue
Block a user