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

Improve printf types to fix ESP32C6 compatibility #637

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

SupermotoJerry
Copy link

made some changes to fix issues I was having with ESP32C6
might be helpful to others
feel free to add comments or make edits (I'm new to GitHub)

ESP32-C6 Updates

Error Details:
Format specifier mismatch: You are passing a uint32_t (which is an unsigned 32-bit integer) but using format specifiers meant for int or unsigned int:
ESP_LOGD(TAG, "Time enter sleep: %u s", jk_get_32bit(238 + offset));
ESP_LOGI(TAG, " Uptime: %d s", jk_get_32bit(38));
ESP_LOGI(TAG, " Power on count: %d", jk_get_32bit(42));
Solution:
You should adjust the format specifiers to match the uint32_t type (which is the data type being returned by jk_get_32bit()).

For uint32_t (unsigned 32-bit integer), use %lu:
Change %u to %lu for unsigned 32-bit integers in the log messages.
Change %d to %ld for signed 32-bit integers if necessary.
Copy link
Owner

@syssi syssi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@syssi syssi changed the title made changes to support ESP32C6 Improve printf types to fix ESP32C6 compatibility Dec 11, 2024
Copy link
Author

@SupermotoJerry SupermotoJerry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@syssi
Copy link
Owner

syssi commented Dec 11, 2024

Are you sure these changes are required for your ESP32 model? Could you share your YAML configuration?

@SupermotoJerry
Copy link
Author

SupermotoJerry commented Dec 11, 2024

Are you sure these changes are required for your ESP32 model? Could you share your YAML configuration?

I couldn't get it working without them.

Sure:

configuration.yaml.txt

Copy link
Owner

@syssi syssi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this project doesn't compile anymore (without updating ESP-IDF). Furthermore you have introduced some more changes accidentally.

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.

2 participants