From 9f417bbe42ac9aea78cb8f18ab933e6e5fc5a2df Mon Sep 17 00:00:00 2001 From: Pablo2048 Date: Wed, 25 Nov 2020 17:49:30 +0100 Subject: [PATCH] Informace o viditelnosti --- src/OLEDUIPlus.cpp | 11 ++++++++++- src/OLEDUIPlus.h | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/OLEDUIPlus.cpp b/src/OLEDUIPlus.cpp index 60e1e11..7b17f40 100644 --- a/src/OLEDUIPlus.cpp +++ b/src/OLEDUIPlus.cpp @@ -168,8 +168,9 @@ void onOffOverlay(OLEDDisplay *display, OLEDDisplayUiState *state) } } -void OLEDUIPlus::loop(void) +bool OLEDUIPlus::loop(void) { + bool result = false; if (_displayon) { // obsluha puvodniho Ui objektu @@ -178,6 +179,7 @@ void OLEDUIPlus::loop(void) if (0 < rtb) { _timing.set(rtb); } + result = true; } // obsluha casovace blikani if (_blink.expired()) { @@ -193,6 +195,7 @@ void OLEDUIPlus::loop(void) } else { handleKbd(); } + return result; } void OLEDUIPlus::drawMenu(OLEDDisplay * display, const menu_t *menu, int *top, int *selected, int16_t x, int16_t y) @@ -318,6 +321,12 @@ void OLEDUIPlus::setTimeout(uint32_t ms) extendOn(); } +bool OLEDUIPlus::isVisible(void) +{ + + return _displayon; +} + #if defined(USE_OTA) void OLEDUIPlus::OTAStart(void) { diff --git a/src/OLEDUIPlus.h b/src/OLEDUIPlus.h index d7c6a63..bb3df28 100644 --- a/src/OLEDUIPlus.h +++ b/src/OLEDUIPlus.h @@ -48,7 +48,7 @@ public: void begin(OLEDDisplay *display, kbdRead rKbd, uint32_t timeout, FrameCallback frames[], size_t framesCount, OverlayCallback overlays[], size_t overlaysCount); void startAnim(int open); void onOffOverlay(OLEDDisplay *display, OLEDDisplayUiState *state); - void loop(void); + bool loop(void); void drawMenu(OLEDDisplay *display, const menu_t *menu, int *top, int *selected, int16_t x, int16_t y); int handleKbd(void); int extendOn(void); @@ -57,6 +57,7 @@ public: bool menuExpired(void); uint8_t getFrameIndex(FrameCallback cb); void setMainFrame(FrameCallback cb); + bool isVisible(void); #if defined(USE_OTA) void OTAStart(void); void OTAProgress(unsigned int progress, unsigned int total);