Skip to content

Commit 9fa83c8

Browse files
ThorstenBrmarcelstoer
authored andcommitted
Add support for resuming from deep sleep (#259)
* Add support for resuming from deep sleep Adapted patch from @ccantill to latest head revision. * Renamed new init method from "resume" to "allocateBuffer"
1 parent e71f750 commit 9fa83c8

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/OLEDDisplay.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ OLEDDisplay::~OLEDDisplay() {
5757
end();
5858
}
5959

60-
bool OLEDDisplay::init() {
60+
bool OLEDDisplay::allocateBuffer() {
6161

6262
logBufferSize = 0;
6363
logBufferFilled = 0;
@@ -93,6 +93,15 @@ bool OLEDDisplay::init() {
9393
}
9494
#endif
9595

96+
return true;
97+
}
98+
99+
bool OLEDDisplay::init() {
100+
101+
if(!allocateBuffer()) {
102+
return false;
103+
}
104+
96105
sendInitCommands();
97106
resetDisplay();
98107

src/OLEDDisplay.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@ class OLEDDisplay : public Stream {
160160
uint16_t width(void) const { return displayWidth; };
161161
uint16_t height(void) const { return displayHeight; };
162162

163-
// Initialize the display
163+
// Prepare the driver for resuming display usage after a deep sleep.
164+
// Returns true on success. Returns false on failure (no display detected etc).
165+
bool allocateBuffer();
166+
167+
// Initialize the driver and the display.
168+
// Returns true on success. Returns false on failure (no display detected etc).
164169
bool init();
165170

166171
// Free the memory used by the display

0 commit comments

Comments
 (0)