diff --git a/LiveData.cpp b/LiveData.cpp index a30570e..ca13483 100644 --- a/LiveData.cpp +++ b/LiveData.cpp @@ -1,6 +1,13 @@ #include "LiveData.h" #include "menu.h" +/** + * Debug level + */ +void debug(String msg, uint8_t debugLevel) { + Serial.println(msg); +} + /** Init params with default values */ diff --git a/LiveData.h b/LiveData.h index d416f5f..1f57de0 100644 --- a/LiveData.h +++ b/LiveData.h @@ -20,7 +20,7 @@ #define CAR_BMW_I3_2014 7 #define CAR_DEBUG_OBD2_KIA 999 -// +// COMM TYPE #define COMM_TYPE_OBD2BLE4 0 #define COMM_TYPE_OBD2CAN 1 #define COMM_TYPE_OBD2BT3 2 @@ -34,6 +34,12 @@ #define SCREEN_CHARGING 5 #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 @@ -209,8 +215,10 @@ typedef struct { // } SETTINGS_STRUC; +// Debug functions +void debug(String msg, uint8_t debugLevel = DEBUG_INFO); -// +// LiveData class class LiveData { protected: public: diff --git a/evDash.ino b/evDash.ino index 7298696..e2cdabf 100644 --- a/evDash.ino +++ b/evDash.ino @@ -65,8 +65,7 @@ void setup(void) { // Serial console, init structures Serial.begin(115200); - Serial.println(""); - Serial.println("Booting device..."); + debug("\nBooting device..."); // Init settings/params liveData = new LiveData(); @@ -74,7 +73,7 @@ void setup(void) { // Turn off serial console if (liveData->settings.serialConsolePort = 255) { - Serial.println("Serial console disabled..."); + debug("Serial console disabled..."); Serial.flush(); Serial.end(); }