Simply send SSD1306 off/on commands to keep I2C bus on Wire functioning correctly#1724
Simply send SSD1306 off/on commands to keep I2C bus on Wire functioning correctly#1724weebl2000 wants to merge 2 commits intomeshcore-dev:devfrom
Conversation
…ol (like Heltec v4) Call Wire.end() before cutting power to OLED to prevent parasitic current draw and restore the bus cleanly.
|
You may check this PR. And set back the value in MC 1.11 for vext. Please keep the GPIO 17,18 for all Meshcore roles on Heltec boards. |
|
@weebl2000 I believe when vext is on, it would comsume extra 26mA as in MeshCore 1.12. The minimum current change you see, I suspect not due to vext. The extra small current is OLED still consumes tiny current when off. |
The current increase when the screen turns off isn't from OLED sleep current (~10µA, unmeasurable on USB). It's from the inverted VEXT polarity — release() with ACTIVE=LOW drives GPIO36 HIGH, which turns VEXT ON (NPN Q6 + PMOS Q5 high-side switch). So the firmware turns on the Vext rail at the exact moment it intends to turn it off. Your fix (display(NULL) + ACTIVE=HIGH) correctly avoids this. |
|
I would love to have the root cause fixed. My PR may be a hint. I dont mind if any friends here can push a fix to dev. Thanks a lot for your finding about vext polarity. |
Following comment by @IoTThinks that the code killed the I2C bus. Even though pins 17/18 are mentioned to be dedicated to the OLED, you could still use the I2C bus on there for other things. I started out by stopping/restarting the Wire, but maybe it's easier to just put SSD11306 to sleep and avoid VEXT claim/release altogether? Power consumption should be very very minimal (< 10µA).
Confirmed that my BME280 works again when I comment out dedicated env pins:
Before this change with these lines commented out the BME280 would not be read because the bus would be broken.
I don't have a Heltec v4 with the TFT display, would be great if someone could test. I'd suspect the behavior is unchanged.
@Quency-D thoughts?
Tested this on a USB companion and v4 repeater, both working fine. No increased power consumption. Theoretically a 3500 mAh 18650 could power the SSD11306 display for 40 years if it's in the off state.
The only concern might be keeping VEXT on, but currently only the heltec boards have VEXT defined for the display and there's nothing else on there.
For anyone that can't build themselves easily but wants to try this: https://mcimages.weebl.me?commitId=fix-ssd1306display