This commit is contained in:
Lubos Petrovic
2020-12-26 09:23:07 +01:00
parent 59b05486c6
commit f68ee0ed86
3 changed files with 19 additions and 5 deletions

View File

@@ -1,6 +1,13 @@
#include "LiveData.h" #include "LiveData.h"
#include "menu.h" #include "menu.h"
/**
* Debug level
*/
void debug(String msg, uint8_t debugLevel) {
Serial.println(msg);
}
/** /**
Init params with default values Init params with default values
*/ */

View File

@@ -20,7 +20,7 @@
#define CAR_BMW_I3_2014 7 #define CAR_BMW_I3_2014 7
#define CAR_DEBUG_OBD2_KIA 999 #define CAR_DEBUG_OBD2_KIA 999
// // COMM TYPE
#define COMM_TYPE_OBD2BLE4 0 #define COMM_TYPE_OBD2BLE4 0
#define COMM_TYPE_OBD2CAN 1 #define COMM_TYPE_OBD2CAN 1
#define COMM_TYPE_OBD2BT3 2 #define COMM_TYPE_OBD2BT3 2
@@ -34,6 +34,12 @@
#define SCREEN_CHARGING 5 #define SCREEN_CHARGING 5
#define SCREEN_SOC10 6 #define SCREEN_SOC10 6
// DEBUG LEVEL
#define DEBUG_INFO 0
#define DEBUG_COMM 1
#define DEBUG_GPS 2
#define DEBUG_SDCARD 3
// //
#define MONTH_SEC 2678400 #define MONTH_SEC 2678400
@@ -209,8 +215,10 @@ typedef struct {
// //
} SETTINGS_STRUC; } SETTINGS_STRUC;
// Debug functions
void debug(String msg, uint8_t debugLevel = DEBUG_INFO);
// // LiveData class
class LiveData { class LiveData {
protected: protected:
public: public:

View File

@@ -65,8 +65,7 @@ void setup(void) {
// Serial console, init structures // Serial console, init structures
Serial.begin(115200); Serial.begin(115200);
Serial.println(""); debug("\nBooting device...");
Serial.println("Booting device...");
// Init settings/params // Init settings/params
liveData = new LiveData(); liveData = new LiveData();
@@ -74,7 +73,7 @@ void setup(void) {
// Turn off serial console // Turn off serial console
if (liveData->settings.serialConsolePort = 255) { if (liveData->settings.serialConsolePort = 255) {
Serial.println("Serial console disabled..."); debug("Serial console disabled...");
Serial.flush(); Serial.flush();
Serial.end(); Serial.end();
} }