How to gracefully handle failed i2c connection
How to gracefully handle failed i2c connection
I've implemented an OLED display over i2c, and I'm trying to figure out whether there is a graceful way to fail to initialize the display gracefully and continue executing the rest of the behavior without the display. Currently when the display is not connected, the ESP boot loops with an error when `i2c_master_cmd_begin` executes. Is there a way to simply handle this failure and move on?
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to gracefully handle failed i2c connection
You'd catch that error manually (I imagine at the moment it's caught by an ESP_ERROR_CHECK macro or something that causes the panic and reboot) and then set a flag so the rest of the program won't try to write to the non-existent display anymore.
Re: How to gracefully handle failed i2c connection
Ah OK, I think I understand what's going on. Thank you!
Who is online
Users browsing this forum: MicroController and 218 guests