Skip to content

Commit c6ef73b

Browse files
committed
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=] ```
1 parent 4f161d2 commit c6ef73b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: cores/esp32/Tone.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void tone_task(void*){
2828
xQueueReceive(_tone_queue, &tone_msg, portMAX_DELAY);
2929
switch(tone_msg.tone_cmd){
3030
case TONE_START:
31-
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);
31+
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);
3232

3333
log_d("Setup LED controll on channel %d", _channel);
3434
// ledcSetup(_channel, tone_msg.frequency, 11);
@@ -118,7 +118,7 @@ void noTone(uint8_t _pin){
118118
// duration - time in ms - how long will the signal be outputted.
119119
// If not provided, or 0 you must manually call noTone to end output
120120
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration){
121-
log_d("_pin=%d, frequency=%u Hz, duration=%u ms", _pin, frequency, duration);
121+
log_d("_pin=%d, frequency=%u Hz, duration=%lu ms", _pin, frequency, duration);
122122
if(tone_init()){
123123
tone_msg_t tone_msg = {
124124
.tone_cmd = TONE_START,

0 commit comments

Comments
 (0)