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
## 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
* fix message `ERR_DUPLICATE_INVERTER` #1705, #1700
* merge PR: Power limit command accelerated #1704

4
src/app.cpp

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

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 130
#define VERSION_PATCH 132
//-------------------------------------
typedef struct {
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) {
mNewPayload = true;
}
@ -190,7 +198,7 @@ class Display {
mEpaper.loop((totalPower), totalYieldDay, totalYieldTotal, nrprod);
mRefreshCycle++;
if (mRefreshCycle > 480) {
if (mRefreshCycle > 2880) { // 15 * 2280 = 44300s = 12h
mEpaper.fullRefresh();
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;
mSecondCnt = 0;
mLogoDisplayed = false;
if (DISP_TYPE_T10_EPAPER == type) {
Serial.begin(115200);
#if defined(SPI_HAL)
hal.init(_MOSI, _DC, _SCK, _CS, _RST, _BUSY);
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(&hal));
#else
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(_CS, _DC, _RST, _BUSY));
#if defined(USE_HSPI_FOR_EPD)
#if defined(SPI_HAL)
hal.init(_MOSI, _DC, _SCK, _CS, _RST, _BUSY);
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(&hal));
#else
_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);
_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);
#endif
#endif
_display->init(115200, true, 20, false);
#endif
#endif
_display->init(0, true, 20, false);
_display->setRotation(mDisplayRotation);
_display->setFullWindow();
_display->setTextColor(GxEPD_BLACK);
_display->firstPage();
_version = version;
}
}
@ -58,7 +59,8 @@ void DisplayEPaper::config(uint8_t rotation, bool enPowerSave) {
void DisplayEPaper::fullRefresh() {
if(RefreshStatus::DONE != mRefreshState)
return;
mSecondCnt = 2;
if(mLogoDisplayed)
return; // no refresh during logo display
mRefreshState = RefreshStatus::BLACK;
}
@ -66,40 +68,42 @@ void DisplayEPaper::fullRefresh() {
void DisplayEPaper::refreshLoop() {
switch(mRefreshState) {
case RefreshStatus::LOGO:
_display->fillScreen(GxEPD_BLACK);
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE);
mSecondCnt = 2;
mNextRefreshState = RefreshStatus::PARTITIALS;
mRefreshState = RefreshStatus::WAIT;
_display->fillScreen(GxEPD_WHITE);
_display->drawInvertedBitmap(0, 0, logo, 200, 200, GxEPD_BLACK);
if(_display->nextPage())
break;
mSecondCnt = 10;
_display->powerOff();
mRefreshState = RefreshStatus::LOGO_WAIT;
break;
case RefreshStatus::LOGO_WAIT:
if(0 != mSecondCnt)
break;
mRefreshState = RefreshStatus::WHITE;
_display->firstPage();
break;
case RefreshStatus::BLACK:
_display->fillScreen(GxEPD_BLACK);
mNextRefreshState = RefreshStatus::WHITE;
mRefreshState = RefreshStatus::WAIT;
if(_display->nextPage())
break;
mRefreshState = RefreshStatus::WHITE;
_display->firstPage();
break;
case RefreshStatus::WHITE:
if(0 != mSecondCnt)
break;
_display->fillScreen(GxEPD_WHITE);
mNextRefreshState = RefreshStatus::PARTITIALS;
mRefreshState = RefreshStatus::WAIT;
break;
case RefreshStatus::WAIT:
if(!_display->nextPage())
mRefreshState = mNextRefreshState;
if(_display->nextPage())
break;
mRefreshState = RefreshStatus::PARTITIALS;
_display->firstPage();
break;
case RefreshStatus::PARTITIALS:
if(0 != mSecondCnt)
break;
headlineIP();
versionFooter();
mSecondCnt = 4; // display Logo time during boot up
mNextRefreshState = RefreshStatus::DONE;
mRefreshState = RefreshStatus::WAIT;
mRefreshState = RefreshStatus::DONE;
break;
default: // RefreshStatus::DONE
@ -219,7 +223,12 @@ void DisplayEPaper::actualPowerPaged(float totalPower, float totalYieldDay, floa
if ((totalPower == 0) && (mEnPowerSave)) {
_display->fillRect(0, mHeadFootPadding, 200, 200, GxEPD_BLACK);
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE);
mLogoDisplayed = true;
} else {
if(mLogoDisplayed) {
mLogoDisplayed = false;
fullRefresh();
}
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
x = ((_display->width() - tbw) / 2) - tbx;
_display->setCursor(x, mHeadFootPadding + tbh + 10);
@ -306,8 +315,9 @@ void DisplayEPaper::loop(float totalPower, float totalYieldDay, float totalYield
//***************************************************************************
void DisplayEPaper::tickerSecond() {
if(mSecondCnt != 0)
mSecondCnt--;
refreshLoop();
if(RefreshStatus::LOGO_WAIT == mRefreshState) {
if(mSecondCnt > 0)
mSecondCnt--;
}
}
#endif // ESP32

8
src/plugins/Display/Display_ePaper.h

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

36
src/web/html/setup.html

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

Loading…
Cancel
Save