Skip to content

Conversation

@IoTThinks
Copy link
Contributor

Hi friends,
This is to fix RefCountedDigitalPin.h to release claim correctly and to ensure no negative "claims" number.

Without this, Heltec v4 comsumes extra 26mA in normal mode and in power saving mode when the power to OLED does not cut off in turnOff correctly.
Tested working fine on Heltec v3 and v4.

It should be fine for other boards too.

@Quency-D
Copy link
Contributor

Quency-D commented Feb 2, 2026

Hi @IoTThinks ,Thank you for your hard work, but we believe that #1570 is the correct reason.

@IoTThinks
Copy link
Contributor Author

IoTThinks commented Feb 2, 2026

Ok, let me try yours.

If your PR works then I will close this PR as you have clearer picture than I.

@JDat
Copy link

JDat commented Feb 2, 2026

Ho this is working? Will this code stay on on Heltec v3 +v4 platforms or this code also will impact my PicoW variant? I don't have OLED display and possibly use this GPIO pin for things...

@IoTThinks
Copy link
Contributor Author

IoTThinks commented Feb 3, 2026

Ho this is working? Will this code stay on on Heltec v3 +v4 platforms or this code also will impact my PicoW variant? I don't have OLED display and possibly use this GPIO pin for things...

@JDat If you don't have OLED, this issue will not happen to you.
RefCountedDigitalPin is intended to control the shared vEXT (external power to OLED and sensors).
It should ensure that vExt will be on if there is at least one OLED/sensor is using vext.
And vExt will be off if no OLED/sensor uses vext.

However, the OLED and sensors need to use claim() and release().
So far, only OLEDs are using it.

So no impact for you.
I would like to fix this so the OLED can off correctly and sensors in future can on/off correctly.

@IoTThinks
Copy link
Contributor Author

IoTThinks commented Feb 3, 2026

I will keep this PR for review.
I believe this fix is good for not only OLEDs but also for sensors to activate/deactivate vExt correctly.

The release() function should work correctly on its own.
Thanks a lot.

@Socalix
Copy link

Socalix commented Feb 3, 2026

LGTM. Nice and clean and a generic fix for other use cases as well.

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.

4 participants