1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-25 08:58:14 +00:00

fix(core): fix broken flow for changing brightness [no changelog]

This commit is contained in:
Lukas Bielesch 2024-11-22 15:12:12 +01:00
parent b3267625ca
commit b28b950b0a
2 changed files with 4 additions and 2 deletions

View File

@ -64,7 +64,8 @@ impl FlowController for SetBrightness {
static BRIGHTNESS: AtomicU8 = AtomicU8::new(0);
pub fn new_set_brightness(brightness: u8) -> Result<SwipeFlow, Error> {
pub fn new_set_brightness(brightness: Option<u8>) -> Result<SwipeFlow, Error> {
let brightness = brightness.unwrap_or(theme::backlight::get_backlight_normal());
let content_slider = Frame::left_aligned(
TR::brightness__title.into(),
NumberInputSliderDialog::new(
@ -122,6 +123,7 @@ pub fn new_set_brightness(brightness: u8) -> Result<SwipeFlow, Error> {
)
.with_footer(TR::instructions__swipe_up.into(), None)
.with_swipe(Direction::Up, SwipeSettings::default())
.with_result_icon(theme::ICON_BULLET_CHECKMARK, theme::GREEN_LIGHT)
.map(move |_msg| Some(FlowMsg::Confirmed));
let res = SwipeFlow::new(&SetBrightness::Slider)?

View File

@ -676,7 +676,7 @@ extern "C" fn new_confirm_summary(n_args: usize, args: *const Obj, kwargs: *mut
extern "C" fn new_set_brightness(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let current: u8 = kwargs.get(Qstr::MP_QSTR_current)?.try_into()?;
let current: Option<u8> = kwargs.get(Qstr::MP_QSTR_current)?.try_into_option()?;
let flow = flow::set_brightness::new_set_brightness(current)?;
Ok(LayoutObj::new_root(flow)?.into())
};