Skip to content
Draft
2 changes: 2 additions & 0 deletions TFT/src/User/API/Mainboard_FlowControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ void resetPendingQueries(void)
// non-UI background loop tasks
void loopBackEnd(void)
{
if (!infoMenu.menu[infoMenu.cur])
return;
UPD_SCAN_RATE(); // debug monitoring KPI

// handle a print from TFT media, if any
Expand Down
21 changes: 11 additions & 10 deletions TFT/src/User/API/Notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static uint32_t nextToastTime = 0; // time to change to next toast notifi
// message notification variables
static NOTIFICATION msglist[MAX_MSG_COUNT]; // message notification array
static uint8_t nextMsgIndex = 0; // next index to store new message
static void (* notificationHandler)() = NULL; // message notification handler
// static void (* notificationHandler)() = NULL; // message notification handler

// add new message to toast notification queue
void addToast(DIALOG_TYPE style, const char * text)
Expand All @@ -45,7 +45,7 @@ void drawToast(bool redraw)
if (!redraw)
curToastDisplay = (curToastDisplay + 1) % TOAST_MSG_COUNT;

if (toastlist[curToastDisplay].isNew == true || redraw)
if (toastlist[curToastDisplay].isNew || redraw)
{
// set toast notification running status
_toastRunning = true;
Expand Down Expand Up @@ -114,7 +114,7 @@ static inline bool toastAvailable(void)
{
for (int i = 0; i < TOAST_MSG_COUNT; i++)
{
if (toastlist[i].isNew == true)
if (toastlist[i].isNew)
return true;
}

Expand All @@ -132,7 +132,7 @@ void loopToast(void)
{
drawToast(false);
}
else if (_toastRunning == true)
else if (_toastRunning)
{
_toastRunning = false;
_toastAvailable = false;
Expand Down Expand Up @@ -168,8 +168,8 @@ void addNotification(DIALOG_TYPE style, const char * title, const char * text, b
if (drawDialog && MENU_IS_NOT(menuNotification))
popupReminder(style, title, text);

if (notificationHandler != NULL)
notificationHandler();
//if (notificationHandler != NULL) // don't call loopFrontEnd task from loopBackEnd
// notificationHandler();

notificationDot();
statusSetMsg(title, text);
Expand Down Expand Up @@ -210,10 +210,11 @@ void clearNotification(void)
statusSetReady();
}

void setNotificationHandler(void (* handler)(void))
{
notificationHandler = handler;
}
// not needed
//void setNotificationHandler(void (* handler)(void))
//{
// notificationHandler = handler;
//}

// check if pressed on titlebar area
void titleBarPress(void)
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/Notification.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void replayNotification(uint8_t index);
NOTIFICATION * getNotification(uint8_t index);
bool hasNotification(void);
void clearNotification(void);
void setNotificationHandler(void (* handler)(void));
//void setNotificationHandler(void (* handler)(void)); // not needed
void titleBarPress(void);

#ifdef __cplusplus
Expand Down
Loading