From 8bf0f6d3c5334afe6477f440ca78edfd68205f7b Mon Sep 17 00:00:00 2001 From: Pavel Brychta Date: Wed, 25 Nov 2020 10:26:16 +0100 Subject: [PATCH] Implicinte vypnuta obsluha OLED dokud se nezavola begin() --- src/OLEDUIPlus.cpp | 10 +++++++++- src/OLEDUIPlus.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/OLEDUIPlus.cpp b/src/OLEDUIPlus.cpp index e824415..62942d2 100644 --- a/src/OLEDUIPlus.cpp +++ b/src/OLEDUIPlus.cpp @@ -20,7 +20,7 @@ typedef struct { } crt_anim_t; static crt_anim_t _anim; -static bool _displayon = true; // priznak, ze na OLED je videt zobrazeni (neni ve stavu spanku) +static bool _displayon = false; // priznak, ze na OLED je videt zobrazeni (neni ve stavu spanku) void OLEDUIPlus::goToFrame(uint8_t frame) { @@ -46,6 +46,7 @@ void OLEDUIPlus::begin(OLEDDisplay *display, kbdRead rKbd, uint32_t timeout, Fra _oled = display; _frames = frames; _framesCount = framesCount; + _displayon = true; setTargetFPS(30); setFrameAnimation(SLIDE_UP); setFrames(frames, framesCount); @@ -310,4 +311,11 @@ void OLEDUIPlus::setMainFrame(FrameCallback cb) _mainFrame = getFrameIndex(cb); } +void OLEDUIPlus::setTimeout(uint32_t ms) +{ + + _oledtimeout = ms; + extendOn(); +} + OLEDUIPlus ui; diff --git a/src/OLEDUIPlus.h b/src/OLEDUIPlus.h index b245add..c790b3d 100644 --- a/src/OLEDUIPlus.h +++ b/src/OLEDUIPlus.h @@ -52,6 +52,7 @@ public: void drawMenu(OLEDDisplay *display, const menu_t *menu, int *top, int *selected, int16_t x, int16_t y); int handleKbd(void); int extendOn(void); + void setTimeout(uint32_t ms); bool blinkIsVisible(void); bool menuExpired(void); uint8_t getFrameIndex(FrameCallback cb);