From c4024f49fbeedd9fc3bac77203352c4086585287 Mon Sep 17 00:00:00 2001 From: Dmitry Pustovit Date: Fri, 20 Sep 2024 00:36:34 -0700 Subject: [PATCH] Added support clearing display at 0 brightness for DIY Boards to AgOledDisplay. Currently, the only affect the brightness setting has with the DIY boards is an attempt to set the contrast. Setting the contrast to 0 does not have any effect. This appears to be a know limitation for these display boards. --- src/AgOledDisplay.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/AgOledDisplay.cpp b/src/AgOledDisplay.cpp index 8250407..8396e33 100644 --- a/src/AgOledDisplay.cpp +++ b/src/AgOledDisplay.cpp @@ -424,7 +424,17 @@ void OledDisplay::setBrightness(int percent) { DISP()->setContrast((127 * percent) / 100); } } else if (ag->isBasic()) { - ag->display.setContrast((255 * percent) / 100); + if (percent == 0) { + isDisplayOff = true; + + // Clear display. + ag->display.clear(); + ag->display.show(); + } + else { + isDisplayOff = false; + ag->display.setContrast((255 * percent) / 100); + } } }