diff --git a/src/NimBLECharacteristic.cpp b/src/NimBLECharacteristic.cpp index e27690f..d6e25ac 100644 --- a/src/NimBLECharacteristic.cpp +++ b/src/NimBLECharacteristic.cpp @@ -520,7 +520,7 @@ NimBLECharacteristicCallbacks* NimBLECharacteristic::getCallbacks() { * @param [in] length The length of the data in bytes. */ void NimBLECharacteristic::setValue(const uint8_t* data, size_t length) { -#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && CORE_DEBUG_LEVEL >= 4) +#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4 char* pHex = NimBLEUtils::buildHexData(nullptr, data, length); NIMBLE_LOGD(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s", length, pHex, getUUID().toString().c_str()); free(pHex); diff --git a/src/NimBLELog.h b/src/NimBLELog.h index 0cedca9..a64e40c 100644 --- a/src/NimBLELog.h +++ b/src/NimBLELog.h @@ -31,33 +31,33 @@ // Note: because CONFIG_LOG_DEFAULT_LEVEL is set at ERROR in Arduino we must use MODLOG_DFLT(ERROR // otherwise no messages will be printed above that level. -#ifndef NIMBLE_CPP_DEBUG_LEVEL +#ifndef CONFIG_NIMBLE_CPP_DEBUG_LEVEL #if defined(ARDUINO_ARCH_ESP32) && defined(CORE_DEBUG_LEVEL) - #define NIMBLE_CPP_DEBUG_LEVEL CORE_DEBUG_LEVEL + #define CONFIG_NIMBLE_CPP_DEBUG_LEVEL CORE_DEBUG_LEVEL #else - #define NIMBLE_CPP_DEBUG_LEVEL 0 + #define CONFIG_NIMBLE_CPP_DEBUG_LEVEL 0 #endif #endif -#if NIMBLE_CPP_DEBUG_LEVEL >= 4 +#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4 #define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: "#format"\n",tag,##__VA_ARGS__) #else #define NIMBLE_LOGD( tag, format, ... ) (void)tag #endif -#if NIMBLE_CPP_DEBUG_LEVEL >= 3 +#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 3 #define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: "#format"\n",tag,##__VA_ARGS__) #else #define NIMBLE_LOGI( tag, format, ... ) (void)tag #endif -#if NIMBLE_CPP_DEBUG_LEVEL >= 2 +#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 2 #define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: "#format"\n",tag,##__VA_ARGS__) #else #define NIMBLE_LOGW( tag, format, ... ) (void)tag #endif -#if NIMBLE_CPP_DEBUG_LEVEL >= 1 +#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 1 #define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: "#format"\n",tag,##__VA_ARGS__) #define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: "#format"\n",tag,##__VA_ARGS__) #else diff --git a/src/NimBLEServer.cpp b/src/NimBLEServer.cpp index e31c81b..18593d7 100644 --- a/src/NimBLEServer.cpp +++ b/src/NimBLEServer.cpp @@ -181,7 +181,7 @@ void NimBLEServer::start() { abort(); } -#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && CORE_DEBUG_LEVEL >= 4) +#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4 ble_gatts_show_local(); #endif /*** Future use *** diff --git a/src/nimconfig.h b/src/nimconfig.h index c5c1dda..f73efed 100644 --- a/src/nimconfig.h +++ b/src/nimconfig.h @@ -44,6 +44,12 @@ */ #define CONFIG_BT_NIMBLE_LOG_LEVEL 5 +/** @brief Un-comment to set the debug log messages level from the NimBLE CPP Wrapper.\n + * Values: 0 = NONE, 1 = ERROR, 2 = WARNING, 3 = INFO, 4+ = DEBUG\n + * Uses approx. 32kB of flash memory. + */ +#define CONFIG_NIMBLE_CPP_DEBUG_LEVEL 0 + /** @brief Un-comment to see NimBLE host return codes as text debug log messages. * Uses approx. 7kB of flash memory. */