Notifications
Toasts and modal dialogues drawn over the app
The firmware owns one notification; every function here shows it. The caller's strings are COPIED (a stack buffer is fine), and a newer notification replaces an older one.
Warning — A modal notification swallows input: while it is up the firmware consumes button events before the app's on_input() sees them and drains the encoder accumulator, so the first os_controls_encoder_get_delta() afterwards reads 0. The app UI must not be driven from on_input() while a modal is showing.
void ui_notify_toast(ui_notify_kind_t kind, const char* message, uint16_t timeout_ms)
A short message (one line, ~30 chars), gone after timeout_ms
| ui_notify_kind_t | kind | NotifyInfo, or NotifySuccess / NotifyWarning / NotifyError (named on a 2nd line) |
| const char* | message | |
| uint16_t | timeout_ms | 0 = stays until another notification replaces it |
void ui_notify_confirm(const char* message, const gfx_img_t* icon, ui_notify_cb_t callback, void* callback_ctx)
Ask: the user HOLDS BTN1 to confirm or presses BTN4/BTN5 to cancel
| const char* | message | up to ~5 wrapped lines ('\n' breaks) |
| const gfx_img_t* | icon | |
| ui_notify_cb_t | callback | runs once with the answer - check it: it also fires on cancel |
| void* | callback_ctx |
static void on_erase(void* ctx, bool confirmed) { if(confirmed) wipe(ctx); }
ui_notify_confirm("Erase all?", NULL, on_erase, m);