#include #include #include #include extern SemaphoreHandle_t serial_mutex; extern void THREAD_SAFE_PRINTLN(String data); enum debugLevel{ none = 0, error = 1, warn = 2, info = 3, verbose = 4 //only use as a last resort, it makes things go real bad on the serial port }; #define DEBUGLEVEL debugLevel::info #define LOG_ERROR(x) do { if (DEBUGLEVEL >= debugLevel::error) { THREAD_SAFE_PRINTLN(x); } } while (0) #define LOG_WARN(x) do { if (DEBUGLEVEL >= debugLevel::warn) { THREAD_SAFE_PRINTLN(x); } } while (0) #define LOG_INFO(x) do { if (DEBUGLEVEL >= debugLevel::info) { THREAD_SAFE_PRINTLN(x); }} while (0) #define LOG_VERBOSE(x) do { if (DEBUGLEVEL >= debugLevel::verbose) { THREAD_SAFE_PRINTLN(x); }} while (0)