Browse Source

- define display defaults

- adjust font sizes and positions
pull/1027/head
Stephan Enderlein 2 years ago
parent
commit
e04f3ff948
  1. 33
      src/plugins/Display/Display_Mono_64X48.h

33
src/plugins/Display/Display_Mono_64X48.h

@ -10,8 +10,8 @@ class DisplayMono64X48 : public DisplayMono {
public: public:
DisplayMono64X48() : DisplayMono() { DisplayMono64X48() : DisplayMono() {
mEnPowerSafe = true; mEnPowerSafe = true;
mEnScreenSaver = true; mEnScreenSaver = false;
mLuminance = 50; mLuminance = 20;
mExtra = 0; mExtra = 0;
mDispY = 0; mDispY = 0;
mTimeout = DISP_DEFAULT_TIMEOUT; // interval at which to power save (milliseconds) mTimeout = DISP_DEFAULT_TIMEOUT; // interval at which to power save (milliseconds)
@ -36,8 +36,8 @@ class DisplayMono64X48 : public DisplayMono {
mDisplay->setContrast(mLuminance); mDisplay->setContrast(mLuminance);
printText("AHOY!", 0); printText("AHOY!", 0);
printText("ahoydtu.de", 2); printText("ahoydtu.de", 1);
printText(version, 3); printText(version, 2);
mDisplay->sendBuffer(); mDisplay->sendBuffer();
} }
@ -77,24 +77,24 @@ class DisplayMono64X48 : public DisplayMono {
mDisplay->setPowerSave(mEnPowerSafe); mDisplay->setPowerSave(mEnPowerSafe);
} }
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "today: %4.0f Wh", totalYieldDay); snprintf(mFmtText, DISP_FMT_TEXT_LEN, "D: %4.0f Wh", totalYieldDay);
printText(mFmtText, 1); printText(mFmtText, 1);
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "total: %.1f kWh", totalYieldTotal); snprintf(mFmtText, DISP_FMT_TEXT_LEN, "T: %.1f kWh", totalYieldTotal);
printText(mFmtText, 2); printText(mFmtText, 2);
IPAddress ip = WiFi.localIP(); IPAddress ip = WiFi.localIP();
if (!(mExtra % 10) && (ip)) if (!(mExtra % 10) && (ip))
printText(ip.toString().c_str(), 3); printText(ip.toString().c_str(), 3);
else if (!(mExtra % 5)) { else if (!(mExtra % 5)) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%d Inverter on", isprod); snprintf(mFmtText, DISP_FMT_TEXT_LEN, "active Inv: %d", isprod);
printText(mFmtText, 3); printText(mFmtText, 3);
} else if (NULL != mUtcTs) } else if (NULL != mUtcTs)
printText(ah::getTimeStr(gTimezone.toLocal(*mUtcTs)).c_str(), 3); printText(ah::getTimeStr(gTimezone.toLocal(*mUtcTs)).c_str(), 3);
mDisplay->sendBuffer(); mDisplay->sendBuffer();
mExtra = 1; mExtra++;
} }
private: private:
@ -110,22 +110,25 @@ class DisplayMono64X48 : public DisplayMono {
inline void setFont(uint8_t line) { inline void setFont(uint8_t line) {
switch (line) { switch (line) {
case 0: case 0:
mDisplay->setFont(u8g2_font_logisoso16_tr); mDisplay->setFont(u8g2_font_fur11_tf);
break;
case 1:
case 2:
mDisplay->setFont(u8g2_font_6x10_tf);
break; break;
case 3: case 3:
mDisplay->setFont(u8g2_font_5x8_tr); mDisplay->setFont(u8g2_font_4x6_tr);
break; break;
default: case 4:
mDisplay->setFont(u8g2_font_5x8_tr); mDisplay->setFont(u8g2_font_4x6_tr);
break; break;
} }
} }
void printText(const char *text, uint8_t line) { void printText(const char *text, uint8_t line) {
uint8_t dispX = (line == 0) ? 10 : 5; uint8_t dispX = 0; //small display, use all we have
dispX += (mEnScreenSaver) ? (mExtra % 4) : 0;
setFont(line); setFont(line);
dispX += (mEnScreenSaver) ? (mExtra % 7) : 0;
mDisplay->drawStr(dispX, mLineYOffsets[line], text); mDisplay->drawStr(dispX, mLineYOffsets[line], text);
} }
}; };

Loading…
Cancel
Save