Moznost callbacku pri zapnuti a vypnuti OLED displeje
This commit is contained in:
parent
19782d2af5
commit
a2011cacf8
@ -21,6 +21,8 @@ typedef struct {
|
|||||||
|
|
||||||
static crt_anim_t _anim;
|
static crt_anim_t _anim;
|
||||||
static bool _displayon = false; // 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)
|
||||||
|
static oledon _oledon = nullptr;
|
||||||
|
static oledoff _oledoff = nullptr;
|
||||||
|
|
||||||
void OLEDUIPlus::goToFrame(uint8_t frame)
|
void OLEDUIPlus::goToFrame(uint8_t frame)
|
||||||
{
|
{
|
||||||
@ -122,6 +124,8 @@ void onOffOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
|||||||
if (_anim.lineClosing && _anim.closing) {
|
if (_anim.lineClosing && _anim.closing) {
|
||||||
_anim.active = false;
|
_anim.active = false;
|
||||||
display->displayOff();
|
display->displayOff();
|
||||||
|
if (_oledoff != nullptr)
|
||||||
|
_oledoff();
|
||||||
_displayon = false;
|
_displayon = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,6 +282,8 @@ int OLEDUIPlus::extendOn(void)
|
|||||||
if (0 != _oledtimeout) {
|
if (0 != _oledtimeout) {
|
||||||
_oledTiming.setOneshot(_oledtimeout); // prodlouzime delku svitu OLED
|
_oledTiming.setOneshot(_oledtimeout); // prodlouzime delku svitu OLED
|
||||||
if (false == _displayon) {
|
if (false == _displayon) {
|
||||||
|
if (_oledon != nullptr)
|
||||||
|
_oledon();
|
||||||
startAnim(1);
|
startAnim(1);
|
||||||
retval = 1; // musime rozsvitit displej
|
retval = 1; // musime rozsvitit displej
|
||||||
}
|
}
|
||||||
@ -364,4 +370,16 @@ void OLEDUIPlus::OTAEnd(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void OLEDUIPlus::setOffCb(oledoff oloff)
|
||||||
|
{
|
||||||
|
|
||||||
|
_oledoff = oloff;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OLEDUIPlus::setOnCb(oledon olon)
|
||||||
|
{
|
||||||
|
|
||||||
|
_oledon = olon;
|
||||||
|
}
|
||||||
|
|
||||||
OLEDUIPlus ui;
|
OLEDUIPlus ui;
|
||||||
|
@ -24,6 +24,8 @@ typedef void (*de)(OLEDDisplay *display, int16_t x, int16_t y, void *ptr); // dr
|
|||||||
typedef int (*ee)(void *ptr);
|
typedef int (*ee)(void *ptr);
|
||||||
typedef void (*ce)(void);
|
typedef void (*ce)(void);
|
||||||
typedef bool (*ve)(void *ptr);
|
typedef bool (*ve)(void *ptr);
|
||||||
|
typedef void (*oledon)(void); // informace o tom, ze je treba zapnout OLED displej
|
||||||
|
typedef void (*oledoff)(void); // informace o tom, ze zhasiname OLED displej
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *entryText; // staticky text, vypisovany v polozce menu
|
const char *entryText; // staticky text, vypisovany v polozce menu
|
||||||
@ -58,6 +60,9 @@ public:
|
|||||||
uint8_t getFrameIndex(FrameCallback cb);
|
uint8_t getFrameIndex(FrameCallback cb);
|
||||||
void setMainFrame(FrameCallback cb);
|
void setMainFrame(FrameCallback cb);
|
||||||
bool isVisible(void);
|
bool isVisible(void);
|
||||||
|
void setOffCb(oledoff oloff);
|
||||||
|
void setOnCb(oledon olon);
|
||||||
|
|
||||||
#if defined(USE_OTA)
|
#if defined(USE_OTA)
|
||||||
void OTAStart(void);
|
void OTAStart(void);
|
||||||
void OTAProgress(unsigned int progress, unsigned int total);
|
void OTAProgress(unsigned int progress, unsigned int total);
|
||||||
|
Loading…
Reference in New Issue
Block a user