|
@ -120,6 +120,28 @@ void DisplayEPaper::lastUpdatePaged() { |
|
|
} while (_display->nextPage()); |
|
|
} while (_display->nextPage()); |
|
|
} |
|
|
} |
|
|
//***************************************************************************
|
|
|
//***************************************************************************
|
|
|
|
|
|
void DisplayEPaper::offlineFooter() { |
|
|
|
|
|
int16_t tbx, tby; |
|
|
|
|
|
uint16_t tbw, tbh; |
|
|
|
|
|
|
|
|
|
|
|
_display->setFont(&FreeSans9pt7b); |
|
|
|
|
|
_display->setTextColor(GxEPD_WHITE); |
|
|
|
|
|
|
|
|
|
|
|
_display->setPartialWindow(0, _display->height() - mHeadFootPadding, _display->width(), mHeadFootPadding); |
|
|
|
|
|
_display->fillScreen(GxEPD_BLACK); |
|
|
|
|
|
do { |
|
|
|
|
|
if (NULL != mUtcTs) { |
|
|
|
|
|
snprintf(_fmtText, sizeof(_fmtText), "offline"); |
|
|
|
|
|
|
|
|
|
|
|
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); |
|
|
|
|
|
uint16_t x = ((_display->width() - tbw) / 2) - tbx; |
|
|
|
|
|
|
|
|
|
|
|
_display->setCursor(x, (_display->height() - 3)); |
|
|
|
|
|
_display->println(_fmtText); |
|
|
|
|
|
} |
|
|
|
|
|
} 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; |
|
@ -139,6 +161,10 @@ void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, fl |
|
|
} else { |
|
|
} else { |
|
|
snprintf(_fmtText, sizeof(_fmtText), "offline"); |
|
|
snprintf(_fmtText, sizeof(_fmtText), "offline"); |
|
|
} |
|
|
} |
|
|
|
|
|
if (_totalPower == 0){ |
|
|
|
|
|
_display->fillRect(0, mHeadFootPadding, 200,200, GxEPD_BLACK); |
|
|
|
|
|
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE); |
|
|
|
|
|
} else { |
|
|
_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); |
|
@ -171,6 +197,8 @@ void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, fl |
|
|
snprintf(_fmtText, sizeof(_fmtText), "%d Inverter online", _isprod); |
|
|
snprintf(_fmtText, sizeof(_fmtText), "%d Inverter online", _isprod); |
|
|
_display->println(_fmtText); |
|
|
_display->println(_fmtText); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} while (_display->nextPage()); |
|
|
} while (_display->nextPage()); |
|
|
} |
|
|
} |
|
|
//***************************************************************************
|
|
|
//***************************************************************************
|
|
@ -185,10 +213,12 @@ void DisplayEPaper::loop(float totalPower, float totalYieldDay, float totalYield |
|
|
// call the PowerPage to change the PV Power Values
|
|
|
// call the PowerPage to change the PV Power Values
|
|
|
actualPowerPaged(totalPower, totalYieldDay, totalYieldTotal, isprod); |
|
|
actualPowerPaged(totalPower, totalYieldDay, totalYieldTotal, isprod); |
|
|
|
|
|
|
|
|
// if there was an change and the Inverter is producing set a new Timestam in the footline
|
|
|
// if there was an change and the Inverter is producing set a new Timestamp in the footline
|
|
|
if ((isprod > 0) && (_changed)) { |
|
|
if ((isprod > 0) && (_changed)) { |
|
|
_changed = false; |
|
|
_changed = false; |
|
|
lastUpdatePaged(); |
|
|
lastUpdatePaged(); |
|
|
|
|
|
} else if(totalPower==0) { |
|
|
|
|
|
offlineFooter(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_display->powerOff(); |
|
|
_display->powerOff(); |
|
|