Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP-IDF: Format string fixes #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mbronk
Copy link

@mbronk mbronk commented Dec 27, 2024

Just a small fix for printf-like format strings for 32-bit integers.
W/o this, when compiling using esp-idf framework on Windows (amd64), I got a series of warnings (treated as errors) similar to the one below:

In file included from src/esphome/components/miot/miot_dump.cpp:1:
src/esphome/components/miot/miot_dump.cpp: In function 'void esphome::miot::dump(const char*, const MiBeacon&)':
src/esphome/components/miot/miot_dump.cpp:51:19: error: format '%X' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' [-Werror=format=]
   51 |     ESP_LOGD(TAG, "  RND: %06X", mib.random_number >> 8);
      |                   ^~~~~~~~~~~~~
src/esphome/core/log.h:72:36: note: in definition of macro 'ESPHOME_LOG_FORMAT'
   72 | #define ESPHOME_LOG_FORMAT(format) format
      |                                    ^~~~~~
src/esphome/core/log.h:152:28: note: in expansion of macro 'esph_log_d'
  152 | #define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__)
      |                            ^~~~~~~~~~
src/esphome/components/miot/miot_dump.cpp:51:5: note: in expansion of macro 'ESP_LOGD'
   51 |     ESP_LOGD(TAG, "  RND: %06X", mib.random_number >> 8);
      |     ^~~~~~~~
src/esphome/components/miot/miot_dump.cpp:51:30: note: format string is defined here
   51 |     ESP_LOGD(TAG, "  RND: %06X", mib.random_number >> 8);
      |                           ~~~^
      |                              |
      |                              unsigned int
      |                           %06lX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant