Unverified Commit 70902999 authored by Kostis Anagnostopoulos's avatar Kostis Anagnostopoulos Committed by GitHub

fix: compiler warnings about printf-format for pointers in `esp32-hal-cpu.c` (#6705)

* 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=]

```

* 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=]
```
parent bdeef89c
......@@ -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,
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment