diff --git a/core/assets/device_name_T.png b/core/assets/device_name_T.png index 93f17c7bc..209f70175 100644 Binary files a/core/assets/device_name_T.png and b/core/assets/device_name_T.png differ diff --git a/core/embed/rust/src/ui/model_tr/bootloader/mod.rs b/core/embed/rust/src/ui/model_tr/bootloader/mod.rs index 557922068..0e6fed040 100644 --- a/core/embed/rust/src/ui/model_tr/bootloader/mod.rs +++ b/core/embed/rust/src/ui/model_tr/bootloader/mod.rs @@ -1,6 +1,5 @@ use crate::{ strutil::hexlify, - time::Duration, trezorhal::io::io_button_read, ui::{ component::{Component, Event, EventCtx, Label, LineBreaking::BreakWordsNoHyphen, Never}, @@ -32,7 +31,7 @@ use confirm::Confirm; use connect::Connect; use intro::Intro; use menu::Menu; -use theme::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, ICON_SUCCESS, LOGO_EMPTY}; +use theme::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, ICON_SUCCESS}; use welcome::Welcome; pub type BootloaderString = String<128>; @@ -322,13 +321,9 @@ extern "C" fn screen_wipe_fail() { #[no_mangle] extern "C" fn screen_boot_empty(_fading: bool) { display::rect_fill(SCREEN, BLD_BG); - LOGO_EMPTY.draw( - SCREEN.top_center() + Offset::y(11), - Alignment2D::TOP_CENTER, - BLD_FG, - BLD_BG, - ); - display::refresh(); + + let mut frame = WelcomeScreen::new(true); + show(&mut frame); } #[no_mangle] @@ -366,7 +361,7 @@ extern "C" fn screen_welcome() { #[no_mangle] extern "C" fn screen_welcome_model() { - let mut frame = WelcomeScreen::new(); + let mut frame = WelcomeScreen::new(false); show(&mut frame); } diff --git a/core/embed/rust/src/ui/model_tr/bootloader/theme.rs b/core/embed/rust/src/ui/model_tr/bootloader/theme.rs index 386ec0287..cc6388e0c 100644 --- a/core/embed/rust/src/ui/model_tr/bootloader/theme.rs +++ b/core/embed/rust/src/ui/model_tr/bootloader/theme.rs @@ -8,7 +8,6 @@ pub use super::super::theme::{BLACK, WHITE}; pub const BLD_BG: Color = BLACK; pub const BLD_FG: Color = WHITE; -include_icon!(LOGO_EMPTY, "model_tr/res/logo_22_33_empty.toif"); include_icon!(ICON_TRASH, "model_tr/res/trash.toif"); include_icon!(ICON_ALERT, "model_tr/res/alert.toif"); include_icon!(ICON_SPINNER, "model_tr/res/spinner.toif"); diff --git a/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs b/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs index d7cdef167..6c656ed15 100644 --- a/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs +++ b/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs @@ -5,15 +5,19 @@ use crate::ui::{ use super::super::theme; -const ICON_TOP_MARGIN: i16 = 11; +const ICON_TOP_MARGIN: i16 = 12; pub struct WelcomeScreen { area: Rect, + empty_lock: bool, } impl WelcomeScreen { - pub fn new() -> Self { - Self { area: Rect::zero() } + pub fn new(empty_lock: bool) -> Self { + Self { + area: Rect::zero(), + empty_lock, + } } } @@ -31,12 +35,17 @@ impl Component for WelcomeScreen { fn paint(&mut self) { theme::ICON_DEVICE_NAME.draw( - self.area.bottom_center(), + self.area.bottom_center() - Offset::y(5), Alignment2D::BOTTOM_CENTER, theme::FG, theme::BG, ); - theme::ICON_LOGO.draw( + let icon = if self.empty_lock { + theme::ICON_LOGO_EMPTY + } else { + theme::ICON_LOGO + }; + icon.draw( self.area.top_center() + Offset::y(ICON_TOP_MARGIN), Alignment2D::TOP_CENTER, theme::FG, diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index 6729cc727..32532fc13 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -1422,7 +1422,7 @@ extern "C" fn new_show_lockscreen(n_args: usize, args: *const Obj, kwargs: *mut extern "C" fn draw_welcome_screen() -> Obj { // No need of util::try_or_raise, this does not allocate - let mut screen = WelcomeScreen::new(); + let mut screen = WelcomeScreen::new(false); screen.place(constant::screen()); display::sync(); screen.paint(); diff --git a/core/embed/rust/src/ui/model_tr/theme.rs b/core/embed/rust/src/ui/model_tr/theme.rs index bd85e3e7e..adbb14216 100644 --- a/core/embed/rust/src/ui/model_tr/theme.rs +++ b/core/embed/rust/src/ui/model_tr/theme.rs @@ -79,6 +79,7 @@ include_icon!(ICON_DEVICE_NAME, "model_tr/res/device_name.toif"); // 116*18 include_icon!(ICON_EYE, "model_tr/res/eye_round.toif"); // 12*7 include_icon!(ICON_LOCK, "model_tr/res/lock.toif"); // 10*10 include_icon!(ICON_LOGO, "model_tr/res/logo_22_33.toif"); // 22*33 +include_icon!(ICON_LOGO_EMPTY, "model_tr/res/logo_22_33_empty.toif"); include_icon!( ICON_NEXT_PAGE, "model_tr/res/next_page.toif", diff --git a/core/embed/rust/src/ui/model_tt/bootloader/mod.rs b/core/embed/rust/src/ui/model_tt/bootloader/mod.rs index 33bee69df..c0a1257f0 100644 --- a/core/embed/rust/src/ui/model_tt/bootloader/mod.rs +++ b/core/embed/rust/src/ui/model_tt/bootloader/mod.rs @@ -6,7 +6,7 @@ use crate::{ constant::{screen, HEIGHT}, display::{self, Color, Font, Icon}, event::TouchEvent, - geometry::{Alignment2D, Point}, + geometry::Point, model_tt::{ bootloader::{ confirm::ConfirmTitle, @@ -14,13 +14,13 @@ use crate::{ theme::{ button_bld, button_confirm, button_wipe_cancel, button_wipe_confirm, BLD_BG, BLD_FG, BLD_WIPE_COLOR, CHECK24, CHECK40, DOWNLOAD32, FIRE32, FIRE40, - LOGO_EMPTY, TEXT_WIPE_BOLD, TEXT_WIPE_NORMAL, WARNING40, WELCOME_COLOR, X24, + TEXT_WIPE_BOLD, TEXT_WIPE_NORMAL, WARNING40, WELCOME_COLOR, X24, }, welcome::Welcome, }, component::{Button, ResultScreen, WelcomeScreen}, constant, - theme::{BACKLIGHT_DIM, BACKLIGHT_NORMAL, BLACK, FG, WHITE}, + theme::{BACKLIGHT_DIM, BACKLIGHT_NORMAL, FG, WHITE}, }, util::{from_c_array, from_c_str}, }, @@ -35,6 +35,7 @@ pub mod menu; pub mod theme; pub mod welcome; +use crate::ui::model_tt::theme::BLACK; use confirm::Confirm; use intro::Intro; use menu::Menu; @@ -338,17 +339,10 @@ extern "C" fn screen_boot_empty(fading: bool) { fadeout(); } - let fg = WHITE; - let bg = BLACK; + display::rect_fill(constant::screen(), BLACK); - display::rect_fill(constant::screen(), bg); - let icon = Icon::new(LOGO_EMPTY); - icon.draw( - Point::new(screen().center().x, 48), - Alignment2D::TOP_CENTER, - fg, - bg, - ); + let mut frame = WelcomeScreen::new(true); + show(&mut frame, false); if fading { fadein(); @@ -408,7 +402,7 @@ extern "C" fn screen_install_success( #[no_mangle] extern "C" fn screen_welcome_model() { - let mut frame = WelcomeScreen::new(); + let mut frame = WelcomeScreen::new(false); show(&mut frame, false); } diff --git a/core/embed/rust/src/ui/model_tt/bootloader/theme.rs b/core/embed/rust/src/ui/model_tt/bootloader/theme.rs index 89d428068..e865d3db9 100644 --- a/core/embed/rust/src/ui/model_tt/bootloader/theme.rs +++ b/core/embed/rust/src/ui/model_tt/bootloader/theme.rs @@ -66,7 +66,6 @@ pub const WARNING40: &[u8] = include_res!("model_tt/res/warning40.toif"); pub const CHECK24: &[u8] = include_res!("model_tt/res/check24.toif"); pub const CHECK40: &[u8] = include_res!("model_tt/res/check40.toif"); -pub const LOGO_EMPTY: &[u8] = include_res!("model_tt/res/lock_empty.toif"); pub const DEVICE_NAME: &[u8] = include_res!("model_tt/res/device_name_T.toif"); pub const START_URL: &[u8] = include_res!("model_tt/res/start.toif"); diff --git a/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs b/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs index ea621d8c5..ac45d6d63 100644 --- a/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs +++ b/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs @@ -15,11 +15,15 @@ use crate::ui::{constant::MODEL_NAME, display}; pub struct WelcomeScreen { area: Rect, + empty_lock: bool, } impl WelcomeScreen { - pub fn new() -> Self { - Self { area: Rect::zero() } + pub fn new(empty_lock: bool) -> Self { + Self { + area: Rect::zero(), + empty_lock, + } } } @@ -36,12 +40,21 @@ impl Component for WelcomeScreen { } fn paint(&mut self) { - theme::ICON_LOGO.draw( - self.area.top_center() + Offset::y(ICON_TOP_MARGIN), - Alignment2D::TOP_CENTER, - theme::FG, - theme::BG, - ); + if self.empty_lock { + theme::ICON_LOGO_EMPTY.draw( + self.area.top_center() + Offset::y(ICON_TOP_MARGIN), + Alignment2D::TOP_CENTER, + theme::FG, + theme::BG, + ); + } else { + theme::ICON_LOGO.draw( + self.area.top_center() + Offset::y(ICON_TOP_MARGIN), + Alignment2D::TOP_CENTER, + theme::FG, + theme::BG, + ); + } #[cfg(not(feature = "bootloader"))] display::text_center( self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN), @@ -52,7 +65,7 @@ impl Component for WelcomeScreen { ); #[cfg(feature = "bootloader")] Icon::new(DEVICE_NAME).draw( - self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN) + Offset::y(1), + self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN), Alignment2D::BOTTOM_CENTER, theme::FG, theme::BG, diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index d15211d1e..bc2dbbc63 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -1573,7 +1573,7 @@ extern "C" fn new_show_lockscreen(n_args: usize, args: *const Obj, kwargs: *mut extern "C" fn draw_welcome_screen() -> Obj { // No need of util::try_or_raise, this does not allocate - let mut screen = WelcomeScreen::new(); + let mut screen = WelcomeScreen::new(false); screen.place(constant::screen()); display::sync(); screen.paint(); diff --git a/core/embed/rust/src/ui/model_tt/res/device_name_T.toif b/core/embed/rust/src/ui/model_tt/res/device_name_T.toif index 397bffd9d..ccc56416f 100644 Binary files a/core/embed/rust/src/ui/model_tt/res/device_name_T.toif and b/core/embed/rust/src/ui/model_tt/res/device_name_T.toif differ diff --git a/core/embed/rust/src/ui/model_tt/theme.rs b/core/embed/rust/src/ui/model_tt/theme.rs index 4fe66fe9b..9abd85058 100644 --- a/core/embed/rust/src/ui/model_tt/theme.rs +++ b/core/embed/rust/src/ui/model_tt/theme.rs @@ -99,6 +99,7 @@ include_icon!(IMAGE_BG_BACK_BTN_TALL, "model_tt/res/bg-back52.toif"); // Welcome screen. include_icon!(ICON_LOGO, "model_tt/res/lock_full.toif"); +include_icon!(ICON_LOGO_EMPTY, "model_tt/res/lock_empty.toif"); // Default homescreen pub const IMAGE_HOMESCREEN: &[u8] = include_res!("model_tt/res/bg.jpg"); diff --git a/core/src/boot.py b/core/src/boot.py index 2fb0104d0..ef45059ad 100644 --- a/core/src/boot.py +++ b/core/src/boot.py @@ -1,13 +1,11 @@ # isort:skip_file import trezorui2 -import utime # Showing welcome screen as soon as possible # (display is also prepared on that occasion). # Remembering time to control how long we show it. trezorui2.draw_welcome_screen() -welcome_screen_start_ms = utime.ticks_ms() import storage import storage.device @@ -21,17 +19,6 @@ from trezor.ui.layouts.homescreen import Lockscreen from apps.common.request_pin import can_lock_device, verify_user_pin -_WELCOME_SCREEN_MS = 1200 # how long do we want to show welcome screen (minimum) - - -def enforce_welcome_screen_duration() -> None: - """Make sure we will show the welcome screen for appropriate amount of time.""" - # Not wasting the time in emulator debug builds (debugging and development) - if __debug__ and utils.EMULATOR: - return - while utime.ticks_ms() - welcome_screen_start_ms < _WELCOME_SCREEN_MS: - utime.sleep_ms(100) - async def bootscreen() -> None: """Sequence of actions to be done on boot (after device is connected). @@ -47,11 +34,9 @@ async def bootscreen() -> None: while True: try: if can_lock_device(): - enforce_welcome_screen_duration() await lockscreen await verify_user_pin() storage.init_unlocked() - enforce_welcome_screen_duration() allow_all_loader_messages() return except wire.PinCancelled: