mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-06 01:48:19 +02:00
added Nokia display again for ESP8266 #764
changed `var` / `VAr` to SI unit `var` #732 fix MQTT retained flags for totals (P_AC, P_DC) #726, #721
This commit is contained in:
parent
f5ef19ccab
commit
6ef7720324
9 changed files with 41 additions and 19 deletions
|
@ -42,6 +42,7 @@ class Display {
|
|||
}
|
||||
|
||||
void tickerSecond() {
|
||||
loop();
|
||||
if (mNewPayload || ((++mLoopCnt % 10) == 0)) {
|
||||
mNewPayload = false;
|
||||
mLoopCnt = 0;
|
||||
|
@ -79,7 +80,7 @@ class Display {
|
|||
}
|
||||
|
||||
if ((1 < mCfg->type) && (mCfg->type < 10)) {
|
||||
mMono.loop(totalPower, totalYieldDay, totalYieldTotal, isprod);
|
||||
mMono.disp(totalPower, totalYieldDay, totalYieldTotal, isprod);
|
||||
} else if (mCfg->type >= 10) {
|
||||
#if defined(ESP32)
|
||||
mEpaper.loop(totalPower, totalYieldDay, totalYieldTotal, isprod);
|
||||
|
|
|
@ -31,7 +31,7 @@ void DisplayMono::init(uint8_t type, uint8_t rot, uint8_t cs, uint8_t dc, uint8_
|
|||
u8g2_cb_t *rot = (u8g2_cb_t *)((rot != 0x00) ? U8G2_R2 : U8G2_R0);
|
||||
switch(type) {
|
||||
case 1:
|
||||
mDisplay = new U8G2_PCD8544_84X48_F_4W_HW_SPI(rot, cs, dc, reset);
|
||||
mDisplay = new U8G2_PCD8544_84X48_F_4W_SW_SPI(rot, clock, data, cs, dc, reset);
|
||||
break;
|
||||
case 2:
|
||||
mDisplay = new U8G2_SSD1306_128X64_NONAME_F_HW_I2C(rot, reset, clock, data);
|
||||
|
@ -64,10 +64,14 @@ void DisplayMono::config(bool enPowerSafe, bool enScreenSaver, uint8_t lum) {
|
|||
mLuminance = lum;
|
||||
}
|
||||
|
||||
void DisplayMono::loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod) {
|
||||
void DisplayMono::loop(void) {
|
||||
if (mEnPowerSafe)
|
||||
if(mTimeout != 0)
|
||||
mTimeout--;
|
||||
}
|
||||
|
||||
void DisplayMono::disp(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod) {
|
||||
|
||||
|
||||
mDisplay->clearBuffer();
|
||||
|
||||
|
@ -144,6 +148,6 @@ void DisplayMono::printText(const char* text, uint8_t line, uint8_t dispX) {
|
|||
}
|
||||
setFont(line);
|
||||
|
||||
dispX += (mEnPowerSafe) ? (_mExtra % 7) : 0;
|
||||
dispX += (mEnScreenSaver) ? (_mExtra % 7) : 0;
|
||||
mDisplay->drawStr(dispX, mLineOffsets[line], text);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ class DisplayMono {
|
|||
|
||||
void init(uint8_t type, uint8_t rot, uint8_t cs, uint8_t dc, uint8_t reset, uint8_t clock, uint8_t data, uint32_t *utcTs, const char* version);
|
||||
void config(bool enPowerSafe, bool enScreenSaver, uint8_t lum);
|
||||
void loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod);
|
||||
void loop(void);
|
||||
void disp(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod);
|
||||
|
||||
private:
|
||||
void calcLineHeights();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue