fix(core): fix display fatal error screen

[no changelog]
pull/3712/head
tychovrahe 1 month ago committed by TychoVrahe
parent 165238b78e
commit 72146c2ae2

@ -100,7 +100,6 @@ __attribute__((noreturn)) void display_error_and_die(const char *message,
display_init();
display_backlight(180);
screen_fatal_error_rust(title, message, footer);
display_refresh();
#if USE_TOUCH
printf("Click screen to exit.\n");
#elif USE_BUTTON
@ -210,7 +209,6 @@ __attribute__((noreturn)) void jump_to(void *addr) {
"STORAGE WAS RETAINED");
}
display_backlight(180);
display_refresh();
hal_delay(3000);
exit(0);
}

@ -14,12 +14,14 @@ fn shutdown() -> ! {
#[cfg(feature = "bootloader")]
pub fn __fatal_error(_expr: &str, _msg: &str, _file: &str, _line: u32, _func: &str) -> ! {
ModelUI::screen_fatal_error("BL.rs", "BL.rs", "PLEASE VISIT\nTREZOR.IO/RSOD");
ModelUI::backlight_on();
shutdown()
}
#[cfg(not(feature = "bootloader"))]
pub fn __fatal_error(_expr: &str, msg: &str, _file: &str, _line: u32, _func: &str) -> ! {
ModelUI::screen_fatal_error("INTERNAL_ERROR", msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
ModelUI::backlight_on();
shutdown()
}

@ -8,6 +8,7 @@ pub fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());
frame.place(constant::screen());
frame.paint();
display::refresh();
}
pub fn screen_boot_full() {

@ -23,6 +23,11 @@ impl UIFeaturesCommon for ModelTTFeatures {
crate::ui::display::fade_backlight_duration(theme::BACKLIGHT_DIM, 150);
}
fn backlight_on() {
#[cfg(feature = "backlight")]
crate::ui::display::set_backlight(theme::BACKLIGHT_NORMAL);
}
const SCREEN: Rect = constant::SCREEN;
fn screen_fatal_error(title: &str, msg: &str, footer: &str) {

@ -12,6 +12,7 @@ pub fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());
frame.place(constant::screen());
frame.paint();
display::refresh();
}
pub fn screen_boot_full() {

@ -5,6 +5,7 @@ use crate::{trezorhal::secbool::secbool, ui::display::Color};
pub trait UIFeaturesCommon {
fn fadein() {}
fn fadeout() {}
fn backlight_on() {}
const SCREEN: Rect;

@ -53,6 +53,7 @@ uint32_t systick_val_copy = 0;
extern void shutdown_privileged(void);
void __attribute__((noreturn)) trezor_shutdown(void) {
display_finish_actions();
#ifdef USE_SVC_SHUTDOWN
svc_shutdown();
#else
@ -69,9 +70,7 @@ error_uni(const char *label, const char *msg, const char *footer) {
display_orientation(0);
#ifdef FANCY_FATAL_ERROR
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
if (label) {
@ -85,7 +84,6 @@ error_uni(const char *label, const char *msg, const char *footer) {
}
#endif
display_backlight(255);
display_refresh();
trezor_shutdown();
}
@ -100,7 +98,6 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
mini_snprintf(buf, sizeof(buf), "%s: %d", file, line);
screen_fatal_error_rust("INTERNAL ERROR", msg != NULL ? msg : buf,
"PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
term_printf("\nINTERNAL ERROR:\n");
@ -133,7 +130,6 @@ error_shutdown(const char *label, const char *msg) {
#ifdef FANCY_FATAL_ERROR
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
if (label) {

@ -105,8 +105,6 @@ void secret_show_install_restricted_screen(void) {
"INSTALL RESTRICTED",
"Installation of custom firmware is currently restricted.",
"Please visit\ntrezor.io/bootloader");
display_refresh();
#endif
}

@ -71,9 +71,7 @@ error_uni(const char *label, const char *msg, const char *footer) {
display_orientation(0);
#ifdef FANCY_FATAL_ERROR
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
if (label) {
@ -87,7 +85,6 @@ error_uni(const char *label, const char *msg, const char *footer) {
}
#endif
display_backlight(255);
display_refresh();
trezor_shutdown();
}
@ -102,7 +99,6 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
mini_snprintf(buf, sizeof(buf), "%s: %d", file, line);
screen_fatal_error_rust("INTERNAL ERROR", msg != NULL ? msg : buf,
"PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
term_printf("\nINTERNAL ERROR:\n");
@ -133,9 +129,7 @@ error_shutdown(const char *label, const char *msg) {
display_orientation(0);
#ifdef FANCY_FATAL_ERROR
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
if (label) {

@ -34,6 +34,7 @@
extern void main_clean_exit(int);
void __attribute__((noreturn)) trezor_shutdown(void) {
display_finish_actions();
printf("SHUTDOWN\n");
main_clean_exit(3);
for (;;)
@ -52,9 +53,7 @@ error_uni(const char *label, const char *msg, const char *footer) {
display_orientation(0);
#ifdef FANCY_FATAL_ERROR
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
if (label) {
@ -68,7 +67,6 @@ error_uni(const char *label, const char *msg, const char *footer) {
}
#endif
display_backlight(255);
display_refresh();
hal_delay(3000);
trezor_shutdown();
}
@ -90,8 +88,6 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line,
screen_fatal_error_rust("INTERNAL ERROR", msg,
"PLEASE VISIT\nTREZOR.IO/RSOD");
}
display_refresh();
#else
term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR);
term_printf("\nINTERNAL ERROR:\n");
@ -130,7 +126,6 @@ void __attribute__((noreturn))
error_shutdown(const char *label, const char *msg) {
#ifdef FANCY_FATAL_ERROR
screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD");
display_refresh();
#else
display_clear();
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_FATAL_ERROR);

Loading…
Cancel
Save