diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-15 13:35:35 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-15 13:35:35 +0200 |
commit | 7b5fb81fc7927809db90c1b093a0de939a54ecd9 (patch) | |
tree | 4e6bd0a249899a8de6997de656fe4f058600a0ce /sensor | |
parent | f4a1116eb76656cdf1152ce34533cc56ea4487af (diff) |
avoid need for external file mylog.h
Diffstat (limited to 'sensor')
-rw-r--r-- | sensor/mylog.h | 37 | ||||
-rw-r--r-- | sensor/sensor.ino | 14 |
2 files changed, 11 insertions, 40 deletions
diff --git a/sensor/mylog.h b/sensor/mylog.h deleted file mode 100644 index 43e3c91..0000000 --- a/sensor/mylog.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Origin: https://forum.arduino.cc/t/esp-log-level-set-is-not-working/1298369/5 - -Changes 2025-04-15 by Jonas Smedegaard <dr@jones.dk>: - * adjust ARDUHAL_LOG_FORMAT to include letter and newline -*/ - -#ifndef MYLOG_H -#define MYLOG_H - -// Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-632e0c2a/esp32/include/log/include/ -#include <esp_log.h> -// Library/Arduino15/packages/esp32/hardware/esp32/3.0.7/cores/esp32/esp32-hal-log.h -#include <esp32-hal-log.h> - - -#undef CONFIG_LOG_MAXIMUM_LEVEL -#define CONFIG_LOG_MAXIMUM_LEVEL CORE_DEBUG_LEVEL - -#undef ESP_LOGE -#undef ESP_LOGW -#undef ESP_LOGI -#undef ESP_LOGD -#undef ESP_LOGV - -#define ESP_LOGE( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, tag, ARDUHAL_LOG_FORMAT(E, format) __VA_OPT__(,) __VA_ARGS__) -#define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, ARDUHAL_LOG_FORMAT(W, format) __VA_OPT__(,) __VA_ARGS__) -#define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, ARDUHAL_LOG_FORMAT(I, format) __VA_OPT__(,) __VA_ARGS__) -#define ESP_LOGD( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, tag, ARDUHAL_LOG_FORMAT(D, format) __VA_OPT__(,) __VA_ARGS__) -#define ESP_LOGV( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_VERBOSE, tag, ARDUHAL_LOG_FORMAT(V, format) __VA_OPT__(,) __VA_ARGS__) - -#undef ARDUHAL_LOG_FORMAT -#define ARDUHAL_LOG_FORMAT(letter, format) \ - ARDUHAL_LOG_COLOR_##letter "[" #letter "] %s(): " format ARDUHAL_LOG_RESET_COLOR "\r\n", \ - __FUNCTION__ - -#endif // MYLOG_H diff --git a/sensor/sensor.ino b/sensor/sensor.ino index 019ff23..5a1f075 100644 --- a/sensor/sensor.ino +++ b/sensor/sensor.ino @@ -22,7 +22,16 @@ /// @see <https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z2tFBF4gN7ziG9oXtUytVQNYe3VhQ/tree/Mussel/README.md> /// @see <https://moodle.ruc.dk/course/view.php?id=23504> -#include "mylog.h" +// include and refine ESP32 Logging system +// activate in Arduino IDE: Tools -> Core Debug Level +#define CONFIG_ARDUHAL_ESP_LOG 1 +#define LOG_LOCAL_LEVEL CORE_DEBUG_LEVEL +#include <esp32-hal-log.h> +#undef ARDUHAL_LOG_FORMAT +#define ARDUHAL_LOG_FORMAT(letter, format) \ + ARDUHAL_LOG_COLOR_##letter "[" #letter "] %s(): " format \ + ARDUHAL_LOG_RESET_COLOR "\r\n", __FUNCTION__ + #include "BLEDevice.h" #include "BLEBeacon.h" #include "BLEAdvertising.h" @@ -160,11 +169,10 @@ void setBeacon(int angle) { void setup() { - // enable logging (when also raised in IDE: Tools -> Core Debug Level) + // enable logging to serial Serial.begin(115200); esp_log_level_set("*", ESP_LOG_DEBUG); - Serial.begin(115200); beginPace(); beginTouchDetection(); |