mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 14:42:05 +00:00
Add screen->isOverlayBannerShowing()
This commit is contained in:
parent
0f5413d113
commit
cb3a20feb8
@ -221,7 +221,7 @@ class Screen : public concurrency::OSThread
|
||||
OLEDDISPLAY_GEOMETRY geometry;
|
||||
|
||||
char alertBannerMessage[256] = {0};
|
||||
uint32_t alertBannerUntil = 0;
|
||||
uint32_t alertBannerUntil = 0; // 0 is a special case meaning forever
|
||||
|
||||
// Stores the last 4 of our hardware ID, to make finding the device for pairing easier
|
||||
// FIXME: Needs refactoring and getMacAddr needs to be moved to a utility class
|
||||
@ -288,6 +288,11 @@ class Screen : public concurrency::OSThread
|
||||
|
||||
void showOverlayBanner(const char *message, uint32_t durationMs = 3000);
|
||||
|
||||
bool isOverlayBannerShowing()
|
||||
{
|
||||
return strlen(alertBannerMessage) > 0 && (alertBannerUntil == 0 || millis() <= alertBannerUntil);
|
||||
}
|
||||
|
||||
void startFirmwareUpdateScreen()
|
||||
{
|
||||
ScreenCmd cmd;
|
||||
|
@ -78,7 +78,7 @@ void NotificationRenderer::drawWelcomeScreen(OLEDDisplay *display, OLEDDisplayUi
|
||||
void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||
{
|
||||
// Exit if no message is active or duration has passed
|
||||
if (strlen(screen->alertBannerMessage) == 0 || (screen->alertBannerUntil != 0 && millis() > screen->alertBannerUntil))
|
||||
if (screen->isOverlayBannerShowing())
|
||||
return;
|
||||
|
||||
// === Layout Configuration ===
|
||||
|
@ -720,7 +720,7 @@ bool CannedMessageModule::handleSystemCommandInput(const InputEvent *event)
|
||||
return false;
|
||||
|
||||
// Block ALL input if an alert banner is active // TODO: Make an accessor function
|
||||
if (strlen(screen->alertBannerMessage) > 0 && (screen->alertBannerUntil == 0 || millis() <= screen->alertBannerUntil)) {
|
||||
if (screen && screen->isOverlayBannerShowing()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user