Skip to content

Commit a6b902e

Browse files
committed
(fix) REMAP_SPI boards need previous init sequence.
1 parent 53c4002 commit a6b902e

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/display.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -396,16 +396,25 @@ void init()
396396
display.setTextColor(GxEPD_BLACK); // black font
397397
}
398398

399-
void clear()
399+
void powerOnAndInit()
400400
{
401-
Logger::log<Logger::Level::DEBUG, Logger::Topic::DISP>("Clearing display...\n");
402-
403-
// Enable power supply for ePaper
401+
// For REMAP_SPI boards: init SPI first
402+
#ifdef REMAP_SPI
403+
init();
404+
Board::setEPaperPowerOn(true);
405+
delay(500);
406+
#else
404407
Board::setEPaperPowerOn(true);
405408
delay(500);
406-
407409
init();
410+
#endif
411+
}
408412

413+
void clear()
414+
{
415+
Logger::log<Logger::Level::DEBUG, Logger::Topic::DISP>("Clearing display...\n");
416+
417+
powerOnAndInit();
409418
setToFullWindow();
410419
setToFirstPage();
411420
do
@@ -694,12 +703,7 @@ void refreshDisplay() { display.epd2.refresh(false); }
694703

695704
void showNoWiFiError(uint64_t sleepSeconds, const String &wikiUrl)
696705
{
697-
// Enable power supply for ePaper
698-
Board::setEPaperPowerOn(true);
699-
delay(500);
700-
701-
init();
702-
706+
powerOnAndInit();
703707
setToFullWindow();
704708
setToFirstPage();
705709
do
@@ -730,12 +734,7 @@ void showWiFiError(const String &hostname, const String &password, const String
730734
const String qrString = "WIFI:S:" + hostname + ";T:WPA;P:" + password + ";;";
731735
// Logger::log<Logger::Level::DEBUG, Logger::Topic::WIFI>("Generated string: {}\n", qrString);
732736

733-
// Enable power supply for ePaper
734-
Board::setEPaperPowerOn(true);
735-
delay(500);
736-
737-
init();
738-
737+
powerOnAndInit();
739738
setToFullWindow();
740739
setToFirstPage();
741740
do

src/display.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static constexpr const char DISPLAY_TYPE_STRING[] = XSTR(DISPLAY_TYPE);
195195
namespace Display
196196
{
197197
void init();
198+
void powerOnAndInit();
198199
void clear();
199200
void setRotation(uint8_t rotation);
200201

0 commit comments

Comments
 (0)