1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

bootloader

This commit is contained in:
tychovrahe 2022-11-11 15:07:34 +01:00
parent 9cd9e0bb40
commit c2162f0831
11 changed files with 24 additions and 36 deletions

View File

@ -77,14 +77,14 @@ impl Component for Intro {
self.bg
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, HEIGHT)));
self.title
.place(Rect::new(Point::new(10, 0), Point::new(128, 8)));
.place(Rect::new(Point::new(0, 0), Point::new(128, 8)));
let button_area = bounds.split_bottom(12).1;
self.host.place(button_area);
self.menu.place(button_area);
self.text
.place(Rect::new(Point::new(10, 20), Point::new(118, 50)));
.place(Rect::new(Point::new(0, 20), Point::new(128, 50)));
bounds
}

View File

@ -8,7 +8,7 @@ use crate::ui::{
geometry::{Offset, Rect},
model_tr::{
bootloader::{
theme::{BLD_BG, BLD_FG},
theme::{BLD_BG, BLD_FG, ICON_DOWNLOAD, ICON_REDO, ICON_TRASH},
ReturnToC,
},
component::{Choice, ChoiceFactory, ChoicePage, ChoicePageMsg},
@ -80,9 +80,9 @@ pub struct MenuChoiceFactory;
impl MenuChoiceFactory {
const CHOICES: [(&'static str, &'static str, &'static [u8]); CHOICE_LENGTH] = [
("WIPE", "DEVICE", ICON_BIN.0),
("REBOOT", "TREZOR", ICON_BIN.0),
("EXIT", "MENU", ICON_BIN.0),
("Wipe", "Trezor", ICON_TRASH),
("Reboot", "Trezor", ICON_REDO),
("Exit", "Menu", ICON_DOWNLOAD),
];
pub fn new() -> Self {

View File

@ -28,7 +28,7 @@ use crate::ui::{
confirm::Confirm,
intro::Intro,
menu::Menu,
theme::{BLD_BG, BLD_FG, LOGO_EMPTY},
theme::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, LOGO_EMPTY},
},
component::ResultScreen,
theme::{ICON_BIN, ICON_CANCEL, ICON_FAIL, ICON_SUCCESS},
@ -108,8 +108,6 @@ extern "C" fn screen_install_confirm(
let text = unwrap!(unsafe { from_c_array(vendor_str, vendor_str_len as usize) });
let version = unwrap!(unsafe { from_c_str(version) });
const ICON: Option<&'static [u8]> = None; //Some(RECEIVE);
let msg = if downgrade {
"Downgrade firmware by"
} else if vendor {
@ -130,7 +128,7 @@ extern "C" fn screen_install_confirm(
let mut frame = Confirm::new(
BLD_BG,
ICON,
None,
"INSTALL FIRMWARE",
Paragraphs::new(message).with_placement(LinearPlacement::vertical().align_at_center()),
"INSTALL",
@ -142,8 +140,6 @@ extern "C" fn screen_install_confirm(
#[no_mangle]
extern "C" fn screen_wipe_confirm() -> u32 {
const ICON: Option<&'static [u8]> = None; //Some(ERASE_BIG);
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(
@ -155,7 +151,7 @@ extern "C" fn screen_wipe_confirm() -> u32 {
let message =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = Confirm::new(BLD_BG, ICON, "WIPE TREZOR", message, "WIPE", true);
let mut frame = Confirm::new(BLD_BG, None, "WIPE TREZOR", message, "WIPE", true);
run(&mut frame)
}
@ -194,8 +190,8 @@ fn screen_progress(
display::rect_rounded2_partial(
Rect::new(
Point::new(screen().center().x - 9, 0),
Point::new(screen().center().x + 9, 18),
screen().top_center() + Offset::new(-9, 3),
screen().top_center() + Offset::new(9, 18 + 3),
),
fg_color,
bg_color,
@ -301,7 +297,7 @@ extern "C" fn screen_wipe_success() -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SUCCESS.0, m_top, m_bottom, true);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, m_top, m_bottom, true);
frame.place(SCREEN_ADJ);
frame.paint();
0
@ -322,7 +318,7 @@ extern "C" fn screen_wipe_fail() -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_FAIL.0, m_top, m_bottom, true);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, m_top, m_bottom, true);
frame.place(SCREEN_ADJ);
frame.paint();
0
@ -347,7 +343,7 @@ extern "C" fn screen_install_fail() -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_FAIL.0, m_top, m_bottom, true);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, m_top, m_bottom, true);
frame.place(SCREEN_ADJ);
frame.paint();
0
@ -366,14 +362,7 @@ fn screen_install_success_bld(msg: &'static str, complete_draw: bool) -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(
BLD_FG,
BLD_BG,
ICON_SUCCESS.0,
m_top,
m_bottom,
complete_draw,
);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, m_top, m_bottom, complete_draw);
frame.place(SCREEN_ADJ);
frame.paint();
0
@ -392,14 +381,7 @@ fn screen_install_success_initial(msg: &'static str, complete_draw: bool) -> u32
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(
BLD_FG,
BLD_BG,
ICON_SUCCESS.0,
m_top,
m_bottom,
complete_draw,
);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, m_top, m_bottom, complete_draw);
frame.place(SCREEN_ADJ);
frame.paint();
0

View File

@ -15,6 +15,11 @@ pub const RADIUS: u8 = 2;
pub const ICON_SIZE: i32 = 16;
pub const LOGO_EMPTY: &[u8] = include_res!("model_tr/res/trezor_empty.toif");
pub const ICON_TRASH: &[u8] = include_res!("model_tr/res/trash.toif");
pub const ICON_ALERT: &[u8] = include_res!("model_tr/res/alert.toif");
pub const ICON_SPINNER: &[u8] = include_res!("model_tr/res/spinner.toif");
pub const ICON_REDO: &[u8] = include_res!("model_tr/res/redo.toif");
pub const ICON_DOWNLOAD: &[u8] = include_res!("model_tr/res/download.toif");
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);

View File

@ -40,7 +40,7 @@ impl Component for Title {
BLD_BG,
);
display::text_top_left(
Point::new(self.area.top_left().x + 65, self.area.top_left().y),
Point::new(self.area.top_left().x + 75, self.area.top_left().y),
self.version,
Font::NORMAL,
BLD_FG,

View File

@ -74,11 +74,12 @@ impl Component for ResultScreen {
self.small_pad.paint();
display::icon(
screen().center() + Offset::y(-24),
screen().top_center() + Offset::y(12),
self.icon,
self.fg_color,
self.bg_color,
);
self.message_top.paint();
self.message_bottom.paint();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.