From 565b944da37e33c57b928c95883fe48198a1865c Mon Sep 17 00:00:00 2001 From: dAjaY85 Date: Sun, 5 Mar 2023 17:22:03 +0100 Subject: [PATCH] =?UTF-8?q?PeriodenDauer=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/settings.h | 6 ++++-- src/plugins/Display/Display.h | 5 +---- src/plugins/Display/Display_Mono.h | 3 ++- src/web/RestApi.h | 1 + src/web/web.h | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/config/settings.h b/src/config/settings.h index bd804386..b02b5a61 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -124,6 +124,7 @@ typedef struct { bool logoEn; bool pxShift; uint8_t rot; + uint16_t period; uint16_t wakeUp; uint16_t sleepAt; uint8_t contrast; @@ -344,6 +345,7 @@ class settings { mCfg.plugin.display.logoEn = true; mCfg.plugin.display.pxShift = true; mCfg.plugin.display.rot = 0; + mCfg.plugin.display.period = 10000; mCfg.plugin.display.disp_data = DEF_PIN_OFF; // SDA mCfg.plugin.display.disp_clk = DEF_PIN_OFF; // SCL mCfg.plugin.display.disp_cs = DEF_PIN_OFF; @@ -477,7 +479,7 @@ class settings { JsonObject disp = obj.createNestedObject("disp"); disp[F("type")] = mCfg.plugin.display.type; disp[F("pwrSafe")] = (bool)mCfg.plugin.display.pwrSaveAtIvOffline; - disp[F("logo")] = (bool)mCfg.plugin.display.logoEn; + disp[F("period")] = mCfg.plugin.display.period; disp[F("pxShift")] = (bool)mCfg.plugin.display.pxShift; disp[F("rotation")] = mCfg.plugin.display.rot; disp[F("wake")] = mCfg.plugin.display.wakeUp; @@ -493,7 +495,7 @@ class settings { JsonObject disp = obj["disp"]; mCfg.plugin.display.type = disp[F("type")]; mCfg.plugin.display.pwrSaveAtIvOffline = (bool)disp[F("pwrSafe")]; - mCfg.plugin.display.logoEn = (bool)disp[F("logo")]; + mCfg.plugin.display.period = disp[F("period")]; mCfg.plugin.display.pxShift = (bool)disp[F("pxShift")]; mCfg.plugin.display.rot = disp[F("rotation")]; mCfg.plugin.display.wakeUp = disp[F("wake")]; diff --git a/src/plugins/Display/Display.h b/src/plugins/Display/Display.h index 8849f30e..8509dacd 100644 --- a/src/plugins/Display/Display.h +++ b/src/plugins/Display/Display.h @@ -10,8 +10,6 @@ #include "Display_ePaper.h" #include "imagedata.h" -#define DISP_DEFAULT_TIMEOUT 60 // in seconds - template class Display { public: @@ -75,7 +73,7 @@ class Display { if (*mUtcTs == 0) return; - if ((millis() - _lastDisplayUpdate) > period) { + if ((millis() - _lastDisplayUpdate) > mCfg->period) { float totalPower = 0; float totalYieldDay = 0; float totalYieldTotal = 0; @@ -120,7 +118,6 @@ class Display { const char *mVersion; display_t *mCfg; HMSYSTEM *mSys; - uint16_t period = 10000; // Achtung, max 65535 uint16_t counterEPaper; uint32_t _lastDisplayUpdate = 0; }; diff --git a/src/plugins/Display/Display_Mono.h b/src/plugins/Display/Display_Mono.h index b3307ef9..81375605 100644 --- a/src/plugins/Display/Display_Mono.h +++ b/src/plugins/Display/Display_Mono.h @@ -2,6 +2,7 @@ #pragma once #include +#define DISP_DEFAULT_TIMEOUT 60000 // in milliseconds class DisplayMonoClass { public: @@ -33,7 +34,7 @@ class DisplayMonoClass { uint32_t _previousMillis = 0; uint8_t _mExtra; - uint16_t _mTimeout; // interval at which to power save (milliseconds) + uint16_t _mTimeout = DISP_DEFAULT_TIMEOUT; // interval at which to power save (milliseconds) char _fmtText[32]; }; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 1236b35f..616244fa 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -433,6 +433,7 @@ class RestApi { obj[F("disp_pwr")] = (bool)mConfig->plugin.display.pwrSaveAtIvOffline; obj[F("px_shift")] = (bool)mConfig->plugin.display.pxShift; obj[F("rotation")] = (uint8_t)mConfig->plugin.display.rot; + obj[F("period")] = (uint16_t)mConfig->plugin.display.period; obj[F("contrast")] = (uint8_t)mConfig->plugin.display.contrast; obj[F("data")] = mConfig->plugin.display.disp_data; obj[F("clock")] = mConfig->plugin.display.disp_clk; diff --git a/src/web/web.h b/src/web/web.h index 2f5cc364..5eed3688 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -606,7 +606,7 @@ class Web { mConfig->plugin.display.rot = request->arg("rotation").toInt(); mConfig->plugin.display.type = request->arg("dispType").toInt(); mConfig->plugin.display.contrast = request->arg("dispCont").toInt(); - + mConfig->plugin.display.period = request->arg("period").toInt(); mConfig->plugin.display.disp_data = request->arg("data").toInt(); mConfig->plugin.display.disp_clk = request->arg("clock").toInt(); mConfig->plugin.display.disp_cs = request->arg("cs").toInt();