Browse Source

bug fixes

pull/1131/head
dAjaY85 2 years ago
parent
commit
b12effd59e
  1. 140
      src/plugins/Display/Display_ePaper.cpp

140
src/plugins/Display/Display_ePaper.cpp

@ -165,75 +165,81 @@ void DisplayEPaper::actualPowerPaged(float totalPower, float totalYieldDay, floa
} else { } else {
snprintf(_fmtText, sizeof(_fmtText), "offline"); snprintf(_fmtText, sizeof(_fmtText), "offline");
} }
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
x = ((_display->width() - tbw) / 2) - tbx; if ((totalPower == 0) && (mEnPowerSafe)) {
_display->setCursor(x, mHeadFootPadding + tbh + 10); _display->fillRect(0, mHeadFootPadding, 200, 200, GxEPD_BLACK);
_display->print(_fmtText); _display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE);
} else {
if ((totalYieldDay > 0) && (totalYieldTotal > 0)) { _display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
// Today Production x = ((_display->width() - tbw) / 2) - tbx;
_display->setFont(&FreeSans18pt7b); _display->setCursor(x, mHeadFootPadding + tbh + 10);
y = _display->height() / 2; _display->print(_fmtText);
_display->setCursor(5, y);
if ((totalYieldDay > 0) && (totalYieldTotal > 0)) {
if (totalYieldDay > 9999) { // Today Production
snprintf(_fmtText, _display->width(), "%.1f", (totalYieldDay / 1000)); _display->setFont(&FreeSans18pt7b);
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); y = _display->height() / 2;
_display->drawInvertedBitmap(5, y - ((tbh + 30) / 2), myToday, 30, 30, GxEPD_BLACK); _display->setCursor(5, y);
x = ((_display->width() - tbw - 20) / 2) - tbx;
_display->setCursor(x, y); if (totalYieldDay > 9999) {
_display->print(_fmtText); snprintf(_fmtText, _display->width(), "%.1f", (totalYieldDay / 1000));
_display->setCursor(_display->width() - 50, y); _display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
_display->setFont(&FreeSans12pt7b); _display->drawInvertedBitmap(5, y - ((tbh + 30) / 2), myToday, 30, 30, GxEPD_BLACK);
_display->println("kWh"); x = ((_display->width() - tbw - 20) / 2) - tbx;
} else if (totalYieldDay <= 9999) { _display->setCursor(x, y);
snprintf(_fmtText, _display->width(), "%.0f", (totalYieldDay)); _display->print(_fmtText);
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); _display->setCursor(_display->width() - 50, y);
_display->drawInvertedBitmap(5, y - tbh, myToday, 30, 30, GxEPD_BLACK); _display->setFont(&FreeSans12pt7b);
x = ((_display->width() - tbw - 20) / 2) - tbx; _display->println("kWh");
_display->setCursor(x, y); } else if (totalYieldDay <= 9999) {
_display->print(_fmtText); snprintf(_fmtText, _display->width(), "%.0f", (totalYieldDay));
_display->setCursor(_display->width() - 38, y); _display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
_display->setFont(&FreeSans12pt7b); _display->drawInvertedBitmap(5, y - tbh, myToday, 30, 30, GxEPD_BLACK);
_display->println("Wh"); x = ((_display->width() - tbw - 20) / 2) - tbx;
} _display->setCursor(x, y);
y = y + tbh + 15; _display->print(_fmtText);
_display->setCursor(_display->width() - 38, y);
// Total Production _display->setFont(&FreeSans12pt7b);
_display->setFont(&FreeSans18pt7b); _display->println("Wh");
_display->setCursor(5, y); }
if (totalYieldTotal > 9999) { y = y + tbh + 15;
snprintf(_fmtText, _display->width(), "%.1f", (totalYieldTotal / 1000));
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); // Total Production
_display->drawInvertedBitmap(5, y - tbh, mySigma, 30, 30, GxEPD_BLACK); _display->setFont(&FreeSans18pt7b);
x = ((_display->width() - tbw - 20) / 2) - tbx; _display->setCursor(5, y);
_display->setCursor(x, y); if (totalYieldTotal > 9999) {
_display->print(_fmtText); snprintf(_fmtText, _display->width(), "%.1f", (totalYieldTotal / 1000));
_display->setCursor(_display->width() - 59, y); _display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
_display->setFont(&FreeSans12pt7b); _display->drawInvertedBitmap(5, y - tbh, mySigma, 30, 30, GxEPD_BLACK);
_display->println("MWh"); x = ((_display->width() - tbw - 20) / 2) - tbx;
} else if (totalYieldTotal <= 9999) { _display->setCursor(x, y);
snprintf(_fmtText, _display->width(), "%.0f", (totalYieldTotal)); _display->print(_fmtText);
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); _display->setCursor(_display->width() - 59, y);
_display->drawInvertedBitmap(5, y - tbh, mySigma, 30, 30, GxEPD_BLACK); _display->setFont(&FreeSans12pt7b);
x = ((_display->width() - tbw - 20) / 2) - tbx; _display->println("MWh");
_display->setCursor(x, y); } else if (totalYieldTotal <= 9999) {
_display->print(_fmtText); snprintf(_fmtText, _display->width(), "%.0f", (totalYieldTotal));
_display->setCursor(_display->width() - 50, y); _display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
_display->setFont(&FreeSans12pt7b); _display->drawInvertedBitmap(5, y - tbh, mySigma, 30, 30, GxEPD_BLACK);
_display->println("kWh"); x = ((_display->width() - tbw - 20) / 2) - tbx;
_display->setCursor(x, y);
_display->print(_fmtText);
_display->setCursor(_display->width() - 50, y);
_display->setFont(&FreeSans12pt7b);
_display->println("kWh");
}
} }
}
// Inverter online // Inverter online
_display->setFont(&FreeSans12pt7b); _display->setFont(&FreeSans12pt7b);
y = _display->height() - (mHeadFootPadding + 10); y = _display->height() - (mHeadFootPadding + 10);
snprintf(_fmtText, sizeof(_fmtText), " %d online", isprod); snprintf(_fmtText, sizeof(_fmtText), " %d online", isprod);
_display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh); _display->getTextBounds(_fmtText, 0, 0, &tbx, &tby, &tbw, &tbh);
_display->drawInvertedBitmap(10, y - tbh, myWR, 20, 20, GxEPD_BLACK); _display->drawInvertedBitmap(10, y - tbh, myWR, 20, 20, GxEPD_BLACK);
x = ((_display->width() - tbw - 20) / 2) - tbx; x = ((_display->width() - tbw - 20) / 2) - tbx;
_display->setCursor(x, y); _display->setCursor(x, y);
_display->println(_fmtText); _display->println(_fmtText);
}
} while (_display->nextPage()); } while (_display->nextPage());
} }
//*************************************************************************** //***************************************************************************

Loading…
Cancel
Save