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

Gracefully fail when I2C device not present in u8g2_esp32_hal init #1197

Open
amaschas opened this issue Jul 12, 2024 · 0 comments
Open

Gracefully fail when I2C device not present in u8g2_esp32_hal init #1197

amaschas opened this issue Jul 12, 2024 · 0 comments

Comments

@amaschas
Copy link

I'm using u8g2_esp32_hal to interface with an I2C OLED device, and whenever the OLED screen is not connected the program aborts, causing a restart. The reason this happens is because ESP_ERROR_CHECK macros are used in several places, which simply abort the thread if they fail. I'm wondering if instead of using ESP_ERROR_CHECK, the relevant functions could print a message and return an error code that users could handle themselves.

Alternatively, maybe provide a function that can test the I2C connection without aborting?

This line is the one that generally causes the abort for me:

ESP_ERROR_CHECK(i2c_master_cmd_begin(I2C_MASTER_NUM, handle_i2c, I2C_TIMEOUT_MS / portTICK_RATE_MS));

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

No branches or pull requests

1 participant