Skip to content

Conversation

nicop4
Copy link
Contributor

@nicop4 nicop4 commented Aug 23, 2025

Fixes the issue #419 & #370 when using the library targeting an ESP32C3 which has only one i2c interface.

The original code has a compilation directive for ESP32 to allow using Wire or Wire1 interface but Wire1 is not present in the SDK of the ESP32C3, resulting in a compilation error.

In the issue #419 it was suggested to adapt the constructor by passing the bus as argument but I could not find a way to pass it and setting a specific geometry.

This solution uses the constant CONFIG_IDF_TARGET_ESP32C3 to prevent the use of Wire1.

Tested on y program on which the build failed, now build and runs perfectly.

I implemented the fix for SSD1306 class because I use this kind of display, but I did the same for SH1106 class, without being able to test it.

@lucasmontec
Copy link

I was just going to submit the same PR. Glad to see you made this!
I can confirm this issue does occur with ESP32C3

Copy link

@lucasmontec lucasmontec left a comment

Choose a reason for hiding this comment

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

I tested the same exact fix in my setup and this compiles correctly.

@marcelstoer
Copy link
Member

I am ok with this fix.

However, I just wish there was a more generic flag we could rely on. It would be more future-proof if we could say "if has one I2C interface then this, else that". Having to rely on chip names likely means that we'll have to extend the condition to other chips in the future.

I'll need to look into the CI build failures.

@marcelstoer marcelstoer merged commit aa10104 into ThingPulse:master Sep 11, 2025
6 checks passed
@marcelstoer
Copy link
Member

Having to rely on chip names likely means that we'll have to extend the condition to other chips in the future.

Indeed, it appears it's same for the C6: meshtastic#16

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.

3 participants