Add "storage mode" to protect EPDs (lowest button while booting)

This commit is contained in:
Djuri Baars 2024-03-18 17:17:04 +01:00
parent 37c57b7d97
commit 23ef2a64cc
2 changed files with 26 additions and 5 deletions

View File

@ -31,6 +31,16 @@ void setup()
}
}
{
if (mcp1.digitalRead(0) == LOW)
{
// Then loop forever to prevent anything else from writing to the screen
while (true) {
delay(1000);
}
}
}
tryImprovSetup();
setupWebserver();

View File

@ -155,7 +155,19 @@ void setupDisplays()
11, &tasks[i]); // create task
}
// Hold lower button to enable "storage mode" (prevents burn-in of ePaper displays)
if (mcp1.digitalRead(0) == LOW)
{
setFgColor(GxEPD_BLACK);
setBgColor(GxEPD_WHITE);
epdContent = {" ", " ", " ", " ", " ", " ", " "};
}
else
{
epdContent = {"B", "T", "C", "L", "O", "C", "K"};
}
setEpdContent(epdContent);
}
@ -247,7 +259,6 @@ void prepareDisplayUpdateTask(void *pvParameters)
showDigit(epdIndex, epdContent[epdIndex].c_str()[0], updatePartial,
&FONT_BIG);
}
}
@ -404,7 +415,7 @@ void showDigit(const uint dispNum, char chr, bool partial,
if (chr == '.')
{
displays[dispNum].fillRect(x,y,displays[dispNum].width(),round(displays[dispNum].height() * 0.9), getBgColor());
displays[dispNum].fillRect(x, y, displays[dispNum].width(), round(displays[dispNum].height() * 0.9), getBgColor());
}
// displays[dispNum].setCursor(10, 3);