fix i2c scann stalling on ESP32* boards - #538
Conversation
unlogisch04
commented
Jul 28, 2026
- Move Wire.end() to the correct position
- ESP32-C6 Pin 0 and 9 Report all addresses
- Fix wrong numbers/names in output
|
Still has some flaws in it. |
|
Done changing stuff.
I decided to leave my comments and "debug" prints in. Tested with:
@gorbit99 can you take a look at it For later, we should move that code, so it uses the https://github.com/SlimeVR/SlimeVR-Tracker-ESP/blob/main/src/sensorinterface/I2CPCAInterface.h if possible. |
|
|
||
| currentSCL = 0; | ||
| currentSDA++; | ||
| void incvalidPortsIndex(uint8_t &index) { |
There was a problem hiding this comment.
I'd personally write out "inc" as "increment"ú, admittedly I read "invalid" here and got very confused by the implementation
There was a problem hiding this comment.
Ah ok will change.
| } | ||
|
|
||
| if (currentSDA >= validPorts.size()) { | ||
| bool incSDA(){ |
| // Debug | ||
| // Serial.printf("CCCC currentSDAPortIndex: %d currentSCLPortIndex: %d validPortsIndex.size: %d\r\n", | ||
| // currentSDAPortIndex, currentSCLPortIndex, validPortsIndex.size()); |
There was a problem hiding this comment.
I would love to leave it in. For normal use it is not needed. But if you need to debug the code it is already here.
| // Debug | ||
| // for (const auto& portsIndex : validPortsIndex) { | ||
| // Serial.printf("Pin Index: %2d PinNum: %2d PinName: %s\r\n", portsIndex, portArray[portsIndex], portMap[portsIndex].c_str()); | ||
| // } | ||
| // Serial.printf("startSDAPortIndex: %2d startSCLPortIndex: %2d\r\n", startSDAPortIndex, startSCLPortIndex); |
There was a problem hiding this comment.
I would love to leave it in. For normal use it is not needed. But if you need to debug the code it is already here.
| } | ||
| } | ||
|
|
||
| // Serial.printf_P(PSTR("[ERROR] [I2CSCAN] Default I2C Ports SDA: %d SCL: %d\r\n"), defaultSDAPin, defaultSCLPin); |
There was a problem hiding this comment.
I would love to leave it in. For normal use it is not needed. But if you need to debug the code it is already here.
| // Debug | ||
| // Serial.printf("AAAA currentSDAPortIndex: %d currentSCLPortIndex: %d validPortsIndex.size: %d\r\n", | ||
| // currentSDAPortIndex, currentSCLPortIndex, validPortsIndex.size()); |
There was a problem hiding this comment.
I would love to leave it in. For normal use it is not needed. But if you need to debug the code it is already here.
- Move Wire.end() to the correct position - ESP32-C6 Pin 0 and 9 Report all addresses - Fix wrong numbers/names in output
Co-Authored-By: gorbit99 <5338164+gorbit99@users.noreply.github.com>
b4e916a to
3b12918
Compare
|
@gorbit99 can you recheck? |