Implicinte vypnuta obsluha OLED dokud se nezavola begin()

This commit is contained in:
Pavel Brychta 2020-11-25 10:26:16 +01:00
parent a42e4b27b6
commit 8bf0f6d3c5
2 changed files with 10 additions and 1 deletions

View File

@ -20,7 +20,7 @@ typedef struct {
} crt_anim_t; } crt_anim_t;
static crt_anim_t _anim; 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) void OLEDUIPlus::goToFrame(uint8_t frame)
{ {
@ -46,6 +46,7 @@ void OLEDUIPlus::begin(OLEDDisplay *display, kbdRead rKbd, uint32_t timeout, Fra
_oled = display; _oled = display;
_frames = frames; _frames = frames;
_framesCount = framesCount; _framesCount = framesCount;
_displayon = true;
setTargetFPS(30); setTargetFPS(30);
setFrameAnimation(SLIDE_UP); setFrameAnimation(SLIDE_UP);
setFrames(frames, framesCount); setFrames(frames, framesCount);
@ -310,4 +311,11 @@ void OLEDUIPlus::setMainFrame(FrameCallback cb)
_mainFrame = getFrameIndex(cb); _mainFrame = getFrameIndex(cb);
} }
void OLEDUIPlus::setTimeout(uint32_t ms)
{
_oledtimeout = ms;
extendOn();
}
OLEDUIPlus ui; OLEDUIPlus ui;

View File

@ -52,6 +52,7 @@ public:
void drawMenu(OLEDDisplay *display, const menu_t *menu, int *top, int *selected, int16_t x, int16_t y); void drawMenu(OLEDDisplay *display, const menu_t *menu, int *top, int *selected, int16_t x, int16_t y);
int handleKbd(void); int handleKbd(void);
int extendOn(void); int extendOn(void);
void setTimeout(uint32_t ms);
bool blinkIsVisible(void); bool blinkIsVisible(void);
bool menuExpired(void); bool menuExpired(void);
uint8_t getFrameIndex(FrameCallback cb); uint8_t getFrameIndex(FrameCallback cb);