|
@ -26,25 +26,26 @@ void DisplayEPaper::init(uint8_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, u |
|
|
|
|
|
|
|
|
mRefreshState = RefreshStatus::LOGO; |
|
|
mRefreshState = RefreshStatus::LOGO; |
|
|
mSecondCnt = 0; |
|
|
mSecondCnt = 0; |
|
|
|
|
|
mLogoDisplayed = false; |
|
|
|
|
|
|
|
|
if (DISP_TYPE_T10_EPAPER == type) { |
|
|
if (DISP_TYPE_T10_EPAPER == type) { |
|
|
Serial.begin(115200); |
|
|
#if defined(SPI_HAL) |
|
|
|
|
|
hal.init(_MOSI, _DC, _SCK, _CS, _RST, _BUSY); |
|
|
#if defined(SPI_HAL) |
|
|
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(&hal)); |
|
|
hal.init(_MOSI, _DC, _SCK, _CS, _RST, _BUSY); |
|
|
#else |
|
|
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(&hal)); |
|
|
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(_CS, _DC, _RST, _BUSY)); |
|
|
#else |
|
|
#if defined(USE_HSPI_FOR_EPD) |
|
|
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(_CS, _DC, _RST, _BUSY)); |
|
|
|
|
|
#if defined(USE_HSPI_FOR_EPD) |
|
|
|
|
|
hspi.begin(_SCK, _BUSY, _MOSI, _CS); |
|
|
hspi.begin(_SCK, _BUSY, _MOSI, _CS); |
|
|
_display->epd2.selectSPI(hspi, SPISettings(spiClk, MSBFIRST, SPI_MODE0)); |
|
|
_display->epd2.selectSPI(hspi, SPISettings(spiClk, MSBFIRST, SPI_MODE0)); |
|
|
#elif defined(PLUGIN_DISPLAY) |
|
|
#elif defined(PLUGIN_DISPLAY) |
|
|
_display->epd2.init(_SCK, _MOSI, 115200, true, 20, false); |
|
|
_display->epd2.init(_SCK, _MOSI, 115200, true, 20, false); |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
_display->init(115200, true, 20, false); |
|
|
_display->init(0, true, 20, false); |
|
|
_display->setRotation(mDisplayRotation); |
|
|
_display->setRotation(mDisplayRotation); |
|
|
_display->setFullWindow(); |
|
|
_display->setFullWindow(); |
|
|
|
|
|
_display->setTextColor(GxEPD_BLACK); |
|
|
|
|
|
_display->firstPage(); |
|
|
_version = version; |
|
|
_version = version; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -58,7 +59,8 @@ void DisplayEPaper::config(uint8_t rotation, bool enPowerSave) { |
|
|
void DisplayEPaper::fullRefresh() { |
|
|
void DisplayEPaper::fullRefresh() { |
|
|
if(RefreshStatus::DONE != mRefreshState) |
|
|
if(RefreshStatus::DONE != mRefreshState) |
|
|
return; |
|
|
return; |
|
|
mSecondCnt = 2; |
|
|
if(mLogoDisplayed) |
|
|
|
|
|
return; // no refresh during logo display
|
|
|
mRefreshState = RefreshStatus::BLACK; |
|
|
mRefreshState = RefreshStatus::BLACK; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -66,40 +68,42 @@ void DisplayEPaper::fullRefresh() { |
|
|
void DisplayEPaper::refreshLoop() { |
|
|
void DisplayEPaper::refreshLoop() { |
|
|
switch(mRefreshState) { |
|
|
switch(mRefreshState) { |
|
|
case RefreshStatus::LOGO: |
|
|
case RefreshStatus::LOGO: |
|
|
_display->fillScreen(GxEPD_BLACK); |
|
|
_display->fillScreen(GxEPD_WHITE); |
|
|
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE); |
|
|
_display->drawInvertedBitmap(0, 0, logo, 200, 200, GxEPD_BLACK); |
|
|
mSecondCnt = 2; |
|
|
if(_display->nextPage()) |
|
|
mNextRefreshState = RefreshStatus::PARTITIALS; |
|
|
break; |
|
|
mRefreshState = RefreshStatus::WAIT; |
|
|
mSecondCnt = 10; |
|
|
|
|
|
_display->powerOff(); |
|
|
|
|
|
mRefreshState = RefreshStatus::LOGO_WAIT; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case RefreshStatus::LOGO_WAIT: |
|
|
|
|
|
if(0 != mSecondCnt) |
|
|
|
|
|
break; |
|
|
|
|
|
mRefreshState = RefreshStatus::WHITE; |
|
|
|
|
|
_display->firstPage(); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case RefreshStatus::BLACK: |
|
|
case RefreshStatus::BLACK: |
|
|
_display->fillScreen(GxEPD_BLACK); |
|
|
_display->fillScreen(GxEPD_BLACK); |
|
|
mNextRefreshState = RefreshStatus::WHITE; |
|
|
if(_display->nextPage()) |
|
|
mRefreshState = RefreshStatus::WAIT; |
|
|
break; |
|
|
|
|
|
mRefreshState = RefreshStatus::WHITE; |
|
|
|
|
|
_display->firstPage(); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case RefreshStatus::WHITE: |
|
|
case RefreshStatus::WHITE: |
|
|
if(0 != mSecondCnt) |
|
|
|
|
|
break; |
|
|
|
|
|
_display->fillScreen(GxEPD_WHITE); |
|
|
_display->fillScreen(GxEPD_WHITE); |
|
|
mNextRefreshState = RefreshStatus::PARTITIALS; |
|
|
if(_display->nextPage()) |
|
|
mRefreshState = RefreshStatus::WAIT; |
|
|
break; |
|
|
break; |
|
|
mRefreshState = RefreshStatus::PARTITIALS; |
|
|
|
|
|
_display->firstPage(); |
|
|
case RefreshStatus::WAIT: |
|
|
|
|
|
if(!_display->nextPage()) |
|
|
|
|
|
mRefreshState = mNextRefreshState; |
|
|
|
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case RefreshStatus::PARTITIALS: |
|
|
case RefreshStatus::PARTITIALS: |
|
|
if(0 != mSecondCnt) |
|
|
|
|
|
break; |
|
|
|
|
|
headlineIP(); |
|
|
headlineIP(); |
|
|
versionFooter(); |
|
|
versionFooter(); |
|
|
mSecondCnt = 4; // display Logo time during boot up
|
|
|
mRefreshState = RefreshStatus::DONE; |
|
|
mNextRefreshState = RefreshStatus::DONE; |
|
|
|
|
|
mRefreshState = RefreshStatus::WAIT; |
|
|
|
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
default: // RefreshStatus::DONE
|
|
|
default: // RefreshStatus::DONE
|
|
@ -219,7 +223,12 @@ void DisplayEPaper::actualPowerPaged(float totalPower, float totalYieldDay, floa |
|
|
if ((totalPower == 0) && (mEnPowerSave)) { |
|
|
if ((totalPower == 0) && (mEnPowerSave)) { |
|
|
_display->fillRect(0, mHeadFootPadding, 200, 200, GxEPD_BLACK); |
|
|
_display->fillRect(0, mHeadFootPadding, 200, 200, GxEPD_BLACK); |
|
|
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE); |
|
|
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE); |
|
|
|
|
|
mLogoDisplayed = true; |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if(mLogoDisplayed) { |
|
|
|
|
|
mLogoDisplayed = false; |
|
|
|
|
|
fullRefresh(); |
|
|
|
|
|
} |
|
|
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); |
|
|
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); |
|
|
x = ((_display->width() - tbw) / 2) - tbx; |
|
|
x = ((_display->width() - tbw) / 2) - tbx; |
|
|
_display->setCursor(x, mHeadFootPadding + tbh + 10); |
|
|
_display->setCursor(x, mHeadFootPadding + tbh + 10); |
|
@ -306,8 +315,9 @@ void DisplayEPaper::loop(float totalPower, float totalYieldDay, float totalYield |
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
//***************************************************************************
|
|
|
void DisplayEPaper::tickerSecond() { |
|
|
void DisplayEPaper::tickerSecond() { |
|
|
if(mSecondCnt != 0) |
|
|
if(RefreshStatus::LOGO_WAIT == mRefreshState) { |
|
|
mSecondCnt--; |
|
|
if(mSecondCnt > 0) |
|
|
refreshLoop(); |
|
|
mSecondCnt--; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
#endif // ESP32
|
|
|
#endif // ESP32
|
|
|