Browse Source

adapt Display_Mono.h to TimeMonitor

pull/1298/head
you69man 1 year ago
parent
commit
bd0c5e3613
  1. 11
      src/plugins/Display/Display_Mono.h

11
src/plugins/Display/Display_Mono.h

@ -19,6 +19,7 @@
#include "../../utils/helper.h" #include "../../utils/helper.h"
#include "Display_data.h" #include "Display_data.h"
#include "../../utils/dbg.h" #include "../../utils/dbg.h"
#include "../../utils/timemonitor.h"
class DisplayMono { class DisplayMono {
public: public:
@ -37,19 +38,19 @@ class DisplayMono {
if (mDisplayActive) { if (mDisplayActive) {
if (!dispConditions) { if (!dispConditions) {
if ((millis() - mStarttime) > DISP_DEFAULT_TIMEOUT * 1000ul) { // switch display off after timeout if (mDisplayTime.isTimeout()) { // switch display off after timeout
mDisplayActive = false; mDisplayActive = false;
mDisplay->setPowerSave(true); mDisplay->setPowerSave(true);
DBGPRINTLN("**** Display off ****"); DBGPRINTLN("**** Display off ****");
} }
} }
else else
mStarttime = millis(); // keep display on mDisplayTime.reStartTimeMonitor(); // keep display on
} }
else { else {
if (dispConditions) { if (dispConditions) {
mDisplayActive = true; // switch display on mDisplayActive = true;
mStarttime = millis(); mDisplayTime.reStartTimeMonitor(); // switch display on
mDisplay->setPowerSave(false); mDisplay->setPowerSave(false);
DBGPRINTLN("**** Display on ****"); DBGPRINTLN("**** Display on ****");
} }
@ -79,7 +80,7 @@ class DisplayMono {
uint8_t mExtra; uint8_t mExtra;
int8_t mPixelshift=0; int8_t mPixelshift=0;
uint32_t mStarttime = millis(); TimeMonitor mDisplayTime = TimeMonitor(1000ul * 15, true);
bool mDisplayActive = true; // always start with display on bool mDisplayActive = true; // always start with display on
char mFmtText[DISP_FMT_TEXT_LEN]; char mFmtText[DISP_FMT_TEXT_LEN];

Loading…
Cancel
Save