mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-19 13:08:14 +00:00
DO NOT MERGE: ping shows colors, no text over homescreen
This commit is contained in:
parent
2db05b747b
commit
fd9e6c7132
@ -202,7 +202,7 @@ impl Component for Homescreen {
|
||||
label_style.text_color = theme::FG;
|
||||
|
||||
let text = HomescreenText {
|
||||
text: self.label,
|
||||
text: "".into(),
|
||||
style: label_style,
|
||||
offset: Offset::y(LABEL_Y),
|
||||
icon: None,
|
||||
@ -221,7 +221,7 @@ impl Component for Homescreen {
|
||||
homescreen(
|
||||
&mut hs_img,
|
||||
&[text],
|
||||
notification,
|
||||
None,
|
||||
self.paint_notification_only,
|
||||
);
|
||||
show_default = false;
|
||||
@ -233,7 +233,7 @@ impl Component for Homescreen {
|
||||
homescreen(
|
||||
&mut hs_img,
|
||||
&[text],
|
||||
notification,
|
||||
None,
|
||||
self.paint_notification_only,
|
||||
);
|
||||
show_default = false;
|
||||
@ -244,12 +244,7 @@ impl Component for Homescreen {
|
||||
let mut input = BufferInput(IMAGE_HOMESCREEN);
|
||||
let mut pool = BufferJpegWork::get_cleared();
|
||||
let mut hs_img = HomescreenJpeg::new(&mut input, pool.buffer.as_mut_slice());
|
||||
homescreen(
|
||||
&mut hs_img,
|
||||
&[text],
|
||||
notification,
|
||||
self.paint_notification_only,
|
||||
);
|
||||
homescreen(&mut hs_img, &[text], None, self.paint_notification_only);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ fn homescreen_line(
|
||||
for x in 0..HOMESCREEN_IMAGE_WIDTH {
|
||||
let d = image_data[x as usize];
|
||||
|
||||
let c = if homescreen_dim_area(x, y) {
|
||||
let c = if false {
|
||||
let coef = (65536_f32 * HOMESCREEN_DIM) as u32;
|
||||
|
||||
let r = (d & 0xF800) >> 8;
|
||||
|
@ -237,12 +237,18 @@ async def handle_EndSession(msg: EndSession) -> Success:
|
||||
return Success()
|
||||
|
||||
|
||||
async def handle_Ping(msg: Ping) -> Success:
|
||||
if msg.button_protection:
|
||||
from trezor.enums import ButtonRequestType as B
|
||||
from trezor.ui.layouts import confirm_action
|
||||
def rgb(r: int, g: int, b: int) -> int:
|
||||
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)
|
||||
|
||||
await confirm_action("ping", TR.words__confirm, "ping", br_code=B.ProtectCall)
|
||||
|
||||
async def handle_Ping(msg: Ping) -> Success:
|
||||
from trezor.ui.layouts import confirm_action
|
||||
|
||||
c = msg.message
|
||||
color = rgb(int(c[0:2], 16), int(c[2:4], 16), int(c[4:6], 16))
|
||||
print(f"color: {color}")
|
||||
|
||||
await confirm_action("ping", "Confirm", "ping", color=color)
|
||||
return Success(message=msg.message)
|
||||
|
||||
|
||||
|
@ -86,8 +86,8 @@ ignore_nonpin_loader_messages()
|
||||
config.init(show_pin_timeout)
|
||||
translations.init()
|
||||
|
||||
if __debug__ and not utils.EMULATOR:
|
||||
config.wipe()
|
||||
# if __debug__ and not utils.EMULATOR:
|
||||
# config.wipe()
|
||||
|
||||
loop.schedule(bootscreen())
|
||||
loop.run()
|
||||
|
@ -43,7 +43,7 @@ if TYPE_CHECKING:
|
||||
StorageSafetyCheckLevel = Literal[0, 1]
|
||||
# fmt: on
|
||||
|
||||
HOMESCREEN_MAXSIZE = const(16384)
|
||||
HOMESCREEN_MAXSIZE = const(163840)
|
||||
LABEL_MAXLENGTH = const(32)
|
||||
|
||||
if __debug__:
|
||||
|
@ -39,10 +39,11 @@ class RustLayout(LayoutParentType[T]):
|
||||
BACKLIGHT_LEVEL = ui.style.BACKLIGHT_NORMAL
|
||||
|
||||
# pylint: disable=super-init-not-called
|
||||
def __init__(self, layout: trezorui2.LayoutObj[T]):
|
||||
def __init__(self, layout: trezorui2.LayoutObj[T], color: int | None = None):
|
||||
self.layout = layout
|
||||
self.timer = loop.Timer()
|
||||
self.layout.attach_timer_fn(self.set_timer)
|
||||
self.color = color
|
||||
|
||||
def set_timer(self, token: int, deadline: int) -> None:
|
||||
self.timer.schedule(deadline, token)
|
||||
@ -55,8 +56,11 @@ class RustLayout(LayoutParentType[T]):
|
||||
import storage.cache as storage_cache
|
||||
|
||||
painted = self.layout.paint()
|
||||
|
||||
if self.color is not None:
|
||||
print("PAINTING")
|
||||
ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT - 60, self.color)
|
||||
ui.refresh()
|
||||
|
||||
if storage_cache.homescreen_shown is not None and painted:
|
||||
storage_cache.homescreen_shown = None
|
||||
|
||||
@ -255,6 +259,7 @@ def confirm_action(
|
||||
reverse: bool = False,
|
||||
exc: ExceptionType = ActionCancelled,
|
||||
br_code: ButtonRequestType = BR_TYPE_OTHER,
|
||||
color: int | None = None,
|
||||
) -> Awaitable[None]:
|
||||
if verb is not None:
|
||||
verb = verb.upper()
|
||||
@ -276,7 +281,8 @@ def confirm_action(
|
||||
hold=hold,
|
||||
hold_danger=hold_danger,
|
||||
reverse=reverse,
|
||||
)
|
||||
),
|
||||
color=color,
|
||||
),
|
||||
br_type,
|
||||
br_code,
|
||||
|
Loading…
Reference in New Issue
Block a user