Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support assert_display_exit() for apps for Nano built on NBGL #502

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/ledger_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
#include "os_io_seproxyhal.h"

#ifdef HAVE_NBGL
#ifdef TARGET_STAX
#include "nbgl_use_case.h"
#else // TARGET_STAX
#include "nbgl_flow.h"
#endif // TARGET_STAX
#endif

#ifndef ASSERT_BUFFER_LEN
Expand Down Expand Up @@ -127,6 +131,18 @@ UX_STEP_CB(ux_error,
});
UX_FLOW(ux_error_flow, &ux_error);
#endif
#ifdef HAVE_NBGL
#ifndef TARGET_STAX
static void assert_exit_true(void)
{
assert_exit(true);
}

static const nbgl_stepDesc_t error_flow[] = {
{.text = "\bApp error", .subText = assert_buffer, .callback = assert_exit_true}
};
#endif // TARGET_STAX
#endif

void __attribute__((noreturn)) assert_display_exit(void)
{
Expand All @@ -135,8 +151,12 @@ void __attribute__((noreturn)) assert_display_exit(void)
#endif

#ifdef HAVE_NBGL
#ifdef TARGET_STAX
nbgl_useCaseChoice(
&C_round_warning_64px, "App error", assert_buffer, "Exit app", "Exit app", assert_exit);
#else // TARGET_STAX
nbgl_flowDraw(error_flow, 1, 0, false, false);
#endif // TARGET_STAX
#endif

// Block until the user approve and the app is quit
Expand Down
Loading