Logging improvements

This commit is contained in:
2026-01-28 20:17:22 +01:00
parent 564ed20720
commit 2eabe931d8
11 changed files with 162 additions and 107 deletions

View File

@@ -35,7 +35,7 @@ struct ConfigDef {
static const ConfigDef configdefs[] = {
{"systemName", ConfigType::STRING, String("OBPkp61")},
{"systemMode", ConfigType::CHAR, 'K'},
{"logLevel", ConfigType::BYTE, uint8_t(0)},
{"logLevel", ConfigType::BYTE, uint8_t(1)},
{"adminPassword", ConfigType::STRING, String("obpkp61")},
{"useAdminPass", ConfigType::BOOL, true},
{"apEnable", ConfigType::BOOL, true},
@@ -63,7 +63,7 @@ static const ConfigDef configdefs[] = {
{"n2kDestA", ConfigType::STRING, String("")},
{"n2kDestB", ConfigType::STRING, String("")},
{"n2kDestC", ConfigType::STRING, String("")},
{"envInterval", ConfigType::SHORT, int16_t(5000)},
{"envInterval", ConfigType::SHORT, int16_t(5)},
// no user access
{"LastNodeId", ConfigType::BYTE, uint8_t(N2K_DEFAULT_NODEID)}

View File

@@ -3,6 +3,22 @@
#include "Nmea2kTwai.h"
#include "N2kDeviceList.h"
#define LOGE(tag, fmt, ...) \
do { if (loglevel >= ESP_LOG_ERROR) ESP_LOGE(tag, fmt, ##__VA_ARGS__); } while(0)
#define LOGW(tag, fmt, ...) \
do { if (loglevel >= ESP_LOG_WARN) ESP_LOGW(tag, fmt, ##__VA_ARGS__); } while(0)
#define LOGI(tag, fmt, ...) \
do { if (loglevel >= ESP_LOG_INFO) ESP_LOGI(tag, fmt, ##__VA_ARGS__); } while(0)
#define LOGD(tag, fmt, ...) \
do { if (loglevel >= ESP_LOG_DEBUG) ESP_LOGD(tag, fmt, ##__VA_ARGS__); } while(0)
#define LOGV(tag, fmt, ...) \
do { if (loglevel >= ESP_LOG_VERBOSE) ESP_LOGV(tag, fmt, ##__VA_ARGS__); } while(0)
#define STRINGIFY_IMPL(x) #x
#define STRINGIFY(x) STRINGIFY_IMPL(x)
@@ -117,6 +133,7 @@ extern Nmea2kTwai &NMEA2000;
extern tN2kDeviceList *pN2kDeviceList;
extern char globalmode;
extern uint8_t loglevel;
extern uint64_t chipid;
extern int16_t led_brightness;