Browse Source

PeriodenDauer hinzugefügt

pull/735/head
dAjaY85 2 years ago
parent
commit
565b944da3
  1. 6
      src/config/settings.h
  2. 5
      src/plugins/Display/Display.h
  3. 3
      src/plugins/Display/Display_Mono.h
  4. 1
      src/web/RestApi.h
  5. 2
      src/web/web.h

6
src/config/settings.h

@ -124,6 +124,7 @@ typedef struct {
bool logoEn; bool logoEn;
bool pxShift; bool pxShift;
uint8_t rot; uint8_t rot;
uint16_t period;
uint16_t wakeUp; uint16_t wakeUp;
uint16_t sleepAt; uint16_t sleepAt;
uint8_t contrast; uint8_t contrast;
@ -344,6 +345,7 @@ class settings {
mCfg.plugin.display.logoEn = true; mCfg.plugin.display.logoEn = true;
mCfg.plugin.display.pxShift = true; mCfg.plugin.display.pxShift = true;
mCfg.plugin.display.rot = 0; mCfg.plugin.display.rot = 0;
mCfg.plugin.display.period = 10000;
mCfg.plugin.display.disp_data = DEF_PIN_OFF; // SDA mCfg.plugin.display.disp_data = DEF_PIN_OFF; // SDA
mCfg.plugin.display.disp_clk = DEF_PIN_OFF; // SCL mCfg.plugin.display.disp_clk = DEF_PIN_OFF; // SCL
mCfg.plugin.display.disp_cs = DEF_PIN_OFF; mCfg.plugin.display.disp_cs = DEF_PIN_OFF;
@ -477,7 +479,7 @@ class settings {
JsonObject disp = obj.createNestedObject("disp"); JsonObject disp = obj.createNestedObject("disp");
disp[F("type")] = mCfg.plugin.display.type; disp[F("type")] = mCfg.plugin.display.type;
disp[F("pwrSafe")] = (bool)mCfg.plugin.display.pwrSaveAtIvOffline; 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("pxShift")] = (bool)mCfg.plugin.display.pxShift;
disp[F("rotation")] = mCfg.plugin.display.rot; disp[F("rotation")] = mCfg.plugin.display.rot;
disp[F("wake")] = mCfg.plugin.display.wakeUp; disp[F("wake")] = mCfg.plugin.display.wakeUp;
@ -493,7 +495,7 @@ class settings {
JsonObject disp = obj["disp"]; JsonObject disp = obj["disp"];
mCfg.plugin.display.type = disp[F("type")]; mCfg.plugin.display.type = disp[F("type")];
mCfg.plugin.display.pwrSaveAtIvOffline = (bool)disp[F("pwrSafe")]; 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.pxShift = (bool)disp[F("pxShift")];
mCfg.plugin.display.rot = disp[F("rotation")]; mCfg.plugin.display.rot = disp[F("rotation")];
mCfg.plugin.display.wakeUp = disp[F("wake")]; mCfg.plugin.display.wakeUp = disp[F("wake")];

5
src/plugins/Display/Display.h

@ -10,8 +10,6 @@
#include "Display_ePaper.h" #include "Display_ePaper.h"
#include "imagedata.h" #include "imagedata.h"
#define DISP_DEFAULT_TIMEOUT 60 // in seconds
template <class HMSYSTEM> template <class HMSYSTEM>
class Display { class Display {
public: public:
@ -75,7 +73,7 @@ class Display {
if (*mUtcTs == 0) if (*mUtcTs == 0)
return; return;
if ((millis() - _lastDisplayUpdate) > period) { if ((millis() - _lastDisplayUpdate) > mCfg->period) {
float totalPower = 0; float totalPower = 0;
float totalYieldDay = 0; float totalYieldDay = 0;
float totalYieldTotal = 0; float totalYieldTotal = 0;
@ -120,7 +118,6 @@ class Display {
const char *mVersion; const char *mVersion;
display_t *mCfg; display_t *mCfg;
HMSYSTEM *mSys; HMSYSTEM *mSys;
uint16_t period = 10000; // Achtung, max 65535
uint16_t counterEPaper; uint16_t counterEPaper;
uint32_t _lastDisplayUpdate = 0; uint32_t _lastDisplayUpdate = 0;
}; };

3
src/plugins/Display/Display_Mono.h

@ -2,6 +2,7 @@
#pragma once #pragma once
#include <U8g2lib.h> #include <U8g2lib.h>
#define DISP_DEFAULT_TIMEOUT 60000 // in milliseconds
class DisplayMonoClass { class DisplayMonoClass {
public: public:
@ -33,7 +34,7 @@ class DisplayMonoClass {
uint32_t _previousMillis = 0; uint32_t _previousMillis = 0;
uint8_t _mExtra; 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]; char _fmtText[32];
}; };

1
src/web/RestApi.h

@ -433,6 +433,7 @@ class RestApi {
obj[F("disp_pwr")] = (bool)mConfig->plugin.display.pwrSaveAtIvOffline; obj[F("disp_pwr")] = (bool)mConfig->plugin.display.pwrSaveAtIvOffline;
obj[F("px_shift")] = (bool)mConfig->plugin.display.pxShift; obj[F("px_shift")] = (bool)mConfig->plugin.display.pxShift;
obj[F("rotation")] = (uint8_t)mConfig->plugin.display.rot; 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("contrast")] = (uint8_t)mConfig->plugin.display.contrast;
obj[F("data")] = mConfig->plugin.display.disp_data; obj[F("data")] = mConfig->plugin.display.disp_data;
obj[F("clock")] = mConfig->plugin.display.disp_clk; obj[F("clock")] = mConfig->plugin.display.disp_clk;

2
src/web/web.h

@ -606,7 +606,7 @@ class Web {
mConfig->plugin.display.rot = request->arg("rotation").toInt(); mConfig->plugin.display.rot = request->arg("rotation").toInt();
mConfig->plugin.display.type = request->arg("dispType").toInt(); mConfig->plugin.display.type = request->arg("dispType").toInt();
mConfig->plugin.display.contrast = request->arg("dispCont").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_data = request->arg("data").toInt();
mConfig->plugin.display.disp_clk = request->arg("clock").toInt(); mConfig->plugin.display.disp_clk = request->arg("clock").toInt();
mConfig->plugin.display.disp_cs = request->arg("cs").toInt(); mConfig->plugin.display.disp_cs = request->arg("cs").toInt();

Loading…
Cancel
Save