Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/helpers/RefCountedDigitalPin.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ class RefCountedDigitalPin {
digitalWrite(_pin, _active);
}
}

void release() {
_claims--;
if (_claims == 0) {
digitalWrite(_pin, !_active);
} else {
_claims--;
Comment on lines +23 to +28
Copy link
Contributor

@oltaco oltaco Feb 5, 2026

Choose a reason for hiding this comment

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

Won't this mean that if claims == 1 and you call release(), claims is will end up as 0 but you the pin won't be deactivated until you call release an extra time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha, true.
Let me adjust.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@oltaco We can change to this.
This is fix for future vExt usage.
However, it won't fix the OLED. We may need to fix or revert the SSD1306Display as it does not use vExt at all.

See my comment below. #1569 (comment)

  void release() {
    if (_claims == 0) return; // avoid negative _claims

    _claims--;
    if (_claims == 0) {
      digitalWrite(_pin, !_active);
    }
  }

}
}
};