From 4f161d28f031ad0627d9e86e35d6799cd795afac Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Fri, 6 May 2022 16:02:45 +0300 Subject: [PATCH 1/2] fix(hal.cpu) compiler warn about printf-format for pointers > warning was: ``` framework-arduinoespressif32/cores/esp32/esp32-hal-cpu.c:132:9: note: in expansion of macro 'log_e' log_e("not found func=%08X arg=%08X",cb,arg); ^~~~~ framework-arduinoespressif32/tools/sdk/esp32/include/log/include/esp_log.h:276:27: warning: format '%X' expects argument of type 'unsigned int', but argument 7 has type 'void *' [-Wformat=] ``` --- cores/esp32/esp32-hal-cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp32/esp32-hal-cpu.c b/cores/esp32/esp32-hal-cpu.c index d79803f6124..2939449c944 100644 --- a/cores/esp32/esp32-hal-cpu.c +++ b/cores/esp32/esp32-hal-cpu.c @@ -107,7 +107,7 @@ bool addApbChangeCallback(void * arg, apb_change_cb_t cb){ // look for duplicate callbacks while( (r != NULL ) && !((r->cb == cb) && ( r->arg == arg))) r = r->next; if (r) { - log_e("duplicate func=%08X arg=%08X",c->cb,c->arg); + log_e("duplicate func=%8p arg=%8p",c->cb,c->arg); free(c); xSemaphoreGive(apb_change_lock); return false; @@ -129,7 +129,7 @@ bool removeApbChangeCallback(void * arg, apb_change_cb_t cb){ // look for matching callback while( (r != NULL ) && !((r->cb == cb) && ( r->arg == arg))) r = r->next; if ( r == NULL ) { - log_e("not found func=%08X arg=%08X",cb,arg); + log_e("not found func=%8p arg=%8p",cb,arg); xSemaphoreGive(apb_change_lock); return false; } From c6ef73ba774e939127a7817171721cdf60946745 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Fri, 6 May 2022 20:28:05 +0300 Subject: [PATCH 2/2] fix(tone.cpp) compiler warn about printf-format for pointers > format-str expected plain uint while `duration` is long-uint. Warning was: ``` .../cores/esp32/esp32-hal-log.h:115:32: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' #define log_d(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, TAG, format, ##__VA_ARGS__);}while(0) ^~~~~~~~~~~~~~~~~~~ .../cores/esp32/Tone.cpp:31:9: note: in expansion of macro 'log_d' log_d("Task received from queue TONE_START: _pin=%d, frequency=%u Hz, duration=%u ms", tone_msg.pin, tone_msg.frequency, tone_msg.duration); ^~~~~ .../tools/sdk/esp32/include/log/include/esp_log.h:276:27: warning: format '%u' expects argument of type 'unsigned int', but argument 8 has type 'long unsigned int' [-Wformat=] ``` --- cores/esp32/Tone.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp32/Tone.cpp b/cores/esp32/Tone.cpp index ca69c10c13b..3bc96ab7034 100644 --- a/cores/esp32/Tone.cpp +++ b/cores/esp32/Tone.cpp @@ -28,7 +28,7 @@ static void tone_task(void*){ xQueueReceive(_tone_queue, &tone_msg, portMAX_DELAY); switch(tone_msg.tone_cmd){ case TONE_START: - log_d("Task received from queue TONE_START: _pin=%d, frequency=%u Hz, duration=%u ms", tone_msg.pin, tone_msg.frequency, tone_msg.duration); + log_d("Task received from queue TONE_START: _pin=%d, frequency=%u Hz, duration=%lu ms", tone_msg.pin, tone_msg.frequency, tone_msg.duration); log_d("Setup LED controll on channel %d", _channel); // ledcSetup(_channel, tone_msg.frequency, 11); @@ -118,7 +118,7 @@ void noTone(uint8_t _pin){ // duration - time in ms - how long will the signal be outputted. // If not provided, or 0 you must manually call noTone to end output void tone(uint8_t _pin, unsigned int frequency, unsigned long duration){ - log_d("_pin=%d, frequency=%u Hz, duration=%u ms", _pin, frequency, duration); + log_d("_pin=%d, frequency=%u Hz, duration=%lu ms", _pin, frequency, duration); if(tone_init()){ tone_msg_t tone_msg = { .tone_cmd = TONE_START,