mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-22 18:57:12 +02:00
merged PR Monodisplay
, many thanks to @dAjaY85 #566, Note: (settings are introduced but not able to be modified, will be included in next version)
This commit is contained in:
parent
7c3a78ec26
commit
3ff348bba8
4 changed files with 24 additions and 5 deletions
|
@ -7,6 +7,7 @@
|
|||
* fixed YieldTotal correction calculation #589
|
||||
* fixed serial output of power limit acknowledge #569
|
||||
* reviewed `sendDiscoveryConfig` #565
|
||||
* merged PR `Monodisplay`, many thanks to @dAjaY85 #566, Note: (settings are introduced but not able to be modified, will be included in next version)
|
||||
|
||||
## 0.5.70
|
||||
* corrected MQTT `comm_disabled` #529
|
||||
|
|
|
@ -70,7 +70,7 @@ void app::setup() {
|
|||
|
||||
// Plugins
|
||||
#if defined(ENA_NOKIA) || defined(ENA_SSD1306) || defined(ENA_SH1106)
|
||||
mMonoDisplay.setup(mSys, &mTimestamp);
|
||||
mMonoDisplay.setup(&mConfig->plugin.display, mSys, &mTimestamp);
|
||||
#endif
|
||||
|
||||
mPubSerial.setup(mConfig, mSys, &mTimestamp);
|
||||
|
|
|
@ -116,6 +116,17 @@ typedef struct {
|
|||
cfgIv_t iv[MAX_NUM_INVERTERS];
|
||||
} cfgInst_t;
|
||||
|
||||
typedef struct {
|
||||
bool pwrSaveAtIvOffline;
|
||||
uint32_t wakeUp;
|
||||
uint32_t sleepAt;
|
||||
uint8_t contrast;
|
||||
} display_t;
|
||||
|
||||
typedef struct {
|
||||
display_t display;
|
||||
} plugins_t;
|
||||
|
||||
typedef struct {
|
||||
cfgSys_t sys;
|
||||
cfgNrf24_t nrf;
|
||||
|
@ -125,6 +136,7 @@ typedef struct {
|
|||
cfgMqtt_t mqtt;
|
||||
cfgLed_t led;
|
||||
cfgInst_t inst;
|
||||
plugins_t plugin;
|
||||
bool valid;
|
||||
} settings_t;
|
||||
|
||||
|
@ -314,6 +326,9 @@ class settings {
|
|||
mCfg.led.led1 = DEF_LED1_PIN;
|
||||
|
||||
memset(&mCfg.inst, 0, sizeof(cfgInst_t));
|
||||
|
||||
mCfg.plugin.display.pwrSaveAtIvOffline = false;
|
||||
mCfg.plugin.display.contrast = 60;
|
||||
}
|
||||
|
||||
void jsonWifi(JsonObject obj, bool set = false) {
|
||||
|
|
|
@ -60,7 +60,8 @@ class MonochromeDisplay {
|
|||
}
|
||||
#endif
|
||||
|
||||
void setup(HMSYSTEM *sys, uint32_t *utcTs) {
|
||||
void setup(display_t *cfg, HMSYSTEM *sys, uint32_t *utcTs) {
|
||||
mCfg = cfg;
|
||||
mSys = sys;
|
||||
mUtcTs = utcTs;
|
||||
memset( mToday, 0, sizeof(float)*MAX_NUM_INVERTERS );
|
||||
|
@ -222,7 +223,7 @@ class MonochromeDisplay {
|
|||
mDisplay.print(timeStr);
|
||||
}
|
||||
#else // ENA_SSD1306
|
||||
mDisplay.setContrast(60);
|
||||
mDisplay.setContrast(mCfg->contrast);
|
||||
// pxZittern in +x (0 - 8 px)
|
||||
int ex = 2*( mExtra % 5 );
|
||||
mDisplay.drawXBM(100+ex,2,16,16,bmp_logo);
|
||||
|
@ -253,7 +254,8 @@ class MonochromeDisplay {
|
|||
mDisplay.setFont(u8g2_font_logisoso18_tr);
|
||||
mDisplay.setCursor(10+ex,20);
|
||||
mDisplay.print(String(F("offline")));
|
||||
if ((millis() - displaySleepTimer) > displaySleepDelay) {
|
||||
if(mCfg->pwrSaveAtIvOffline) {
|
||||
if ((millis() - displaySleepTimer) > displaySleepDelay)
|
||||
mDisplay.setPowerSave(true);
|
||||
}
|
||||
//<=======================
|
||||
|
@ -309,6 +311,7 @@ class MonochromeDisplay {
|
|||
float mToday[ MAX_NUM_INVERTERS ];
|
||||
uint32_t *mUtcTs;
|
||||
int mLastHour;
|
||||
display_t *mCfg;
|
||||
HMSYSTEM *mSys;
|
||||
Timezone mCE;
|
||||
bool displaySleep;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue