Browse Source

0.6.15

* improved Prometheus Endpoint PR #958
* fix turn off ePaper only if setting was set #956
pull/961/head
lumapu 2 years ago
parent
commit
5b82d1aa8b
  1. 4
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 2
      src/plugins/Display/Display.h
  4. 23
      src/plugins/Display/Display_ePaper.cpp
  5. 3
      src/plugins/Display/Display_ePaper.h

4
src/CHANGES.md

@ -1,5 +1,9 @@
# Development Changes # Development Changes
## 0.6.15 - 2023-05-25
* improved Prometheus Endpoint PR #958
* fix turn off ePaper only if setting was set #956
## 0.6.14 - 2023-05-21 ## 0.6.14 - 2023-05-21
* merge PR #902 Mono-Display * merge PR #902 Mono-Display

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 6 #define VERSION_MINOR 6
#define VERSION_PATCH 14 #define VERSION_PATCH 15
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

2
src/plugins/Display/Display.h

@ -47,7 +47,7 @@ class Display {
} else if (mCfg->type >= 10) { } else if (mCfg->type >= 10) {
#if defined(ESP32) #if defined(ESP32)
mRefreshCycle = 0; mRefreshCycle = 0;
mEpaper.config(mCfg->rot); mEpaper.config(mCfg->rot, mCfg->pwrSaveAtIvOffline);
mEpaper.init(mCfg->type, mCfg->disp_cs, mCfg->disp_dc, mCfg->disp_reset, mCfg->disp_busy, mCfg->disp_clk, mCfg->disp_data, mUtcTs, mVersion); mEpaper.init(mCfg->type, mCfg->disp_cs, mCfg->disp_dc, mCfg->disp_reset, mCfg->disp_busy, mCfg->disp_clk, mCfg->disp_data, mUtcTs, mVersion);
#endif #endif
} }

23
src/plugins/Display/Display_ePaper.cpp

@ -57,8 +57,9 @@ void DisplayEPaper::init(uint8_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, u
} }
} }
void DisplayEPaper::config(uint8_t rotation) { void DisplayEPaper::config(uint8_t rotation, bool enPowerSafe) {
mDisplayRotation = rotation; mDisplayRotation = rotation;
mEnPowerSafe = enPowerSafe;
} }
//*************************************************************************** //***************************************************************************
@ -142,7 +143,7 @@ void DisplayEPaper::offlineFooter() {
} while (_display->nextPage()); } while (_display->nextPage());
} }
//*************************************************************************** //***************************************************************************
void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, float _totalYieldTotal, uint8_t _isprod) { void DisplayEPaper::actualPowerPaged(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod) {
int16_t tbx, tby; int16_t tbx, tby;
uint16_t tbw, tbh, x, y; uint16_t tbw, tbh, x, y;
@ -152,16 +153,16 @@ void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, fl
_display->setPartialWindow(0, mHeadFootPadding, _display->width(), _display->height() - (mHeadFootPadding * 2)); _display->setPartialWindow(0, mHeadFootPadding, _display->width(), _display->height() - (mHeadFootPadding * 2));
_display->fillScreen(GxEPD_WHITE); _display->fillScreen(GxEPD_WHITE);
do { do {
if (_totalPower > 9999) { if (totalPower > 9999) {
snprintf(_fmtText, sizeof(_fmtText), "%.1f kW", (_totalPower / 10000)); snprintf(_fmtText, sizeof(_fmtText), "%.1f kW", (totalPower / 10000));
_changed = true; _changed = true;
} else if ((_totalPower > 0) && (_totalPower <= 9999)) { } else if ((totalPower > 0) && (totalPower <= 9999)) {
snprintf(_fmtText, sizeof(_fmtText), "%.0f W", _totalPower); snprintf(_fmtText, sizeof(_fmtText), "%.0f W", totalPower);
_changed = true; _changed = true;
} else { } else {
snprintf(_fmtText, sizeof(_fmtText), "offline"); snprintf(_fmtText, sizeof(_fmtText), "offline");
} }
if (_totalPower == 0){ if (totalPower == 0){
_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);
} else { } else {
@ -174,7 +175,7 @@ void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, fl
y = _display->height() / 2; y = _display->height() / 2;
_display->setCursor(5, y); _display->setCursor(5, y);
_display->print("today:"); _display->print("today:");
snprintf(_fmtText, _display->width(), "%.0f", _totalYieldDay); snprintf(_fmtText, _display->width(), "%.0f", totalYieldDay);
_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, y); _display->setCursor(x, y);
@ -185,7 +186,7 @@ void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, fl
y = y + tbh + 7; y = y + tbh + 7;
_display->setCursor(5, y); _display->setCursor(5, y);
_display->print("total:"); _display->print("total:");
snprintf(_fmtText, _display->width(), "%.1f", _totalYieldTotal); snprintf(_fmtText, _display->width(), "%.1f", totalYieldTotal);
_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, y); _display->setCursor(x, y);
@ -194,7 +195,7 @@ void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, fl
_display->println("kWh"); _display->println("kWh");
_display->setCursor(10, _display->height() - (mHeadFootPadding + 10)); _display->setCursor(10, _display->height() - (mHeadFootPadding + 10));
snprintf(_fmtText, sizeof(_fmtText), "%d Inverter online", _isprod); snprintf(_fmtText, sizeof(_fmtText), "%d Inverter online", isprod);
_display->println(_fmtText); _display->println(_fmtText);
} }
@ -216,7 +217,7 @@ void DisplayEPaper::loop(float totalPower, float totalYieldDay, float totalYield
if ((isprod > 0) && (_changed)) { if ((isprod > 0) && (_changed)) {
_changed = false; _changed = false;
lastUpdatePaged(); lastUpdatePaged();
} else if(totalPower==0) } else if((0 == totalPower) && (mEnPowerSafe))
offlineFooter(); offlineFooter();
_display->powerOff(); _display->powerOff();

3
src/plugins/Display/Display_ePaper.h

@ -31,7 +31,7 @@ class DisplayEPaper {
DisplayEPaper(); DisplayEPaper();
void fullRefresh(); void fullRefresh();
void init(uint8_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, uint8_t _BUSY, uint8_t _SCK, uint8_t _MOSI, uint32_t *utcTs, const char* version); void init(uint8_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, uint8_t _BUSY, uint8_t _SCK, uint8_t _MOSI, uint32_t *utcTs, const char* version);
void config(uint8_t rotation); void config(uint8_t rotation, bool enPowerSafe);
void loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod); void loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod);
@ -48,6 +48,7 @@ class DisplayEPaper {
uint8_t mHeadFootPadding; uint8_t mHeadFootPadding;
GxEPD2_GFX* _display; GxEPD2_GFX* _display;
uint32_t *mUtcTs; uint32_t *mUtcTs;
bool mEnPowerSafe;
}; };
#endif // ESP32 #endif // ESP32

Loading…
Cancel
Save