Browse Source

Merge branch 'development03' into Ethernet+Wifi

main
lumapu 2 months ago
parent
commit
054683fe87
  1. 8
      src/CHANGES.md
  2. 4
      src/app.cpp
  3. 2
      src/defines.h
  4. 10
      src/plugins/Display/Display.h
  5. 84
      src/plugins/Display/Display_ePaper.cpp
  6. 8
      src/plugins/Display/Display_ePaper.h
  7. 36
      src/web/html/setup.html

8
src/CHANGES.md

@ -1,5 +1,13 @@
# Development Changes # Development Changes
## 0.8.132 - 2024-08-09
* fix boot loop once no ePaper is connected #1713, #1714
* improved refresh routine of ePeper
* added default pin seetings for opendtufusion board
## 0.8.131 - 2024-08-08
* improved refresh routine of ePaper, full refresh each 12h #1107 #1706
## 0.8.130 - 2024-08-04 ## 0.8.130 - 2024-08-04
* fix message `ERR_DUPLICATE_INVERTER` #1705, #1700 * fix message `ERR_DUPLICATE_INVERTER` #1705, #1700
* merge PR: Power limit command accelerated #1704 * merge PR: Power limit command accelerated #1704

4
src/app.cpp

@ -140,6 +140,10 @@ void app::loop(void) {
if (mMqttEnabled && mNetworkConnected) if (mMqttEnabled && mNetworkConnected)
mMqtt.loop(); mMqtt.loop();
#endif #endif
#if defined(PLUGIN_DISPLAY)
mDisplay.loop();
#endif
yield(); yield();
} }

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 130 #define VERSION_PATCH 132
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {
uint8_t ch; uint8_t ch;

10
src/plugins/Display/Display.h

@ -72,6 +72,14 @@ class Display {
} }
void loop() {
#if defined(ESP32) && !defined(ETHERNET)
if ((nullptr != mCfg) && (DISP_TYPE_T10_EPAPER == mCfg->type)) {
mEpaper.refreshLoop();
}
#endif
}
void payloadEventListener(uint8_t cmd) { void payloadEventListener(uint8_t cmd) {
mNewPayload = true; mNewPayload = true;
} }
@ -190,7 +198,7 @@ class Display {
mEpaper.loop((totalPower), totalYieldDay, totalYieldTotal, nrprod); mEpaper.loop((totalPower), totalYieldDay, totalYieldTotal, nrprod);
mRefreshCycle++; mRefreshCycle++;
if (mRefreshCycle > 480) { if (mRefreshCycle > 2880) { // 15 * 2280 = 44300s = 12h
mEpaper.fullRefresh(); mEpaper.fullRefresh();
mRefreshCycle = 0; mRefreshCycle = 0;
} }

84
src/plugins/Display/Display_ePaper.cpp

@ -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

8
src/plugins/Display/Display_ePaper.h

@ -48,9 +48,9 @@ class DisplayEPaper {
DONE, DONE,
BLACK, BLACK,
WHITE, WHITE,
WAIT,
PARTITIALS, PARTITIALS,
LOGO LOGO,
LOGO_WAIT
}; };
uint8_t mDisplayRotation; uint8_t mDisplayRotation;
@ -62,8 +62,10 @@ class DisplayEPaper {
uint32_t* mUtcTs; uint32_t* mUtcTs;
bool mEnPowerSave; bool mEnPowerSave;
const char* _version; const char* _version;
RefreshStatus mRefreshState, mNextRefreshState; RefreshStatus mRefreshState;
uint8_t mSecondCnt; uint8_t mSecondCnt;
bool mLogoDisplayed;
#if defined(SPI_HAL) #if defined(SPI_HAL)
epdHal hal; epdHal hal;
#endif #endif

36
src/web/html/setup.html

@ -462,12 +462,12 @@
[6, "GPIO6"], [6, "GPIO6"],
[7, "GPIO7"], [7, "GPIO7"],
[8, "GPIO8"], [8, "GPIO8"],
[9, "GPIO9"], [9, "GPIO9 (DATA display)"],
[10, "GPIO10"], [10, "GPIO10 (SCK display)"],
[11, "GPIO11"], [11, "GPIO11 (CS display)"],
[12, "GPIO12"], [12, "GPIO12 (DC display)"],
[13, "GPIO13"], [13, "GPIO13 (RST display)"],
[14, "GPIO14"], [14, "GPIO14 (BUSY display)"],
[15, "GPIO15"], [15, "GPIO15"],
[16, "GPIO16"], [16, "GPIO16"],
[17, "GPIO17"], [17, "GPIO17"],
@ -484,20 +484,20 @@
[32, "GPIO32 (FLASH - {#PIN_NOT_AVAIL})"], [32, "GPIO32 (FLASH - {#PIN_NOT_AVAIL})"],
[33, "GPIO33 (not exposed on S3-WROOM modules)"], [33, "GPIO33 (not exposed on S3-WROOM modules)"],
[34, "GPIO34 (not exposed on S3-WROOM modules)"], [34, "GPIO34 (not exposed on S3-WROOM modules)"],
[35, "GPIO35"], [35, "GPIO35 (MOSI NRF24)"],
[36, "GPIO36"], [36, "GPIO36 (SCK NRF24)"],
[37, "GPIO37"], [37, "GPIO37 (CSN NRF24)"],
[38, "GPIO38"], [38, "GPIO38 (CE NRF24)"],
[39, "GPIO39"], [39, "GPIO39 (SCK ETH)"],
[40, "GPIO40"], [40, "GPIO40 (MOSI ETH)"],
[41, "GPIO41"], [41, "GPIO41 (MISO ETH)"],
[42, "GPIO42"], [42, "GPIO42 (CS ETH)"],
[43, "GPIO43"], [43, "GPIO43 (RST ETH)"],
[44, "GPIO44"], [44, "GPIO44 (INT ETH)"],
[45, "GPIO45 ({#PIN_DONT_USE} - STRAPPING PIN)"], [45, "GPIO45 ({#PIN_DONT_USE} - STRAPPING PIN)"],
[46, "GPIO46 ({#PIN_DONT_USE} - STRAPPING PIN)"], [46, "GPIO46 ({#PIN_DONT_USE} - STRAPPING PIN)"],
[47, "GPIO47"], [47, "GPIO47 (IRQ NRF24)"],
[48, "GPIO48"], [48, "GPIO48 (MISO NRF24)"],
]; ];
/*ENDIF_ESP32-S3*/ /*ENDIF_ESP32-S3*/
/*IF_ESP32-C3*/ /*IF_ESP32-C3*/

Loading…
Cancel
Save