mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 03:50:58 +00:00
fixup! chore(core): add missing parameter to set_brightness function
This commit is contained in:
parent
fdb7f04f31
commit
5091f3e6d3
@ -64,17 +64,7 @@ impl FlowController for SetBrightness {
|
|||||||
|
|
||||||
static BRIGHTNESS: AtomicU8 = AtomicU8::new(0);
|
static BRIGHTNESS: AtomicU8 = AtomicU8::new(0);
|
||||||
|
|
||||||
pub fn new_set_brightness(brightness: Option<u8>) -> Result<SwipeFlow, Error> {
|
pub fn new_set_brightness(brightness: u8) -> Result<SwipeFlow, Error> {
|
||||||
let brightness = brightness
|
|
||||||
.map(|value| {
|
|
||||||
// If brightness value is provided, set display brightness to that value
|
|
||||||
display::backlight(value as _);
|
|
||||||
BRIGHTNESS.store(value as u8, Ordering::Relaxed);
|
|
||||||
let _ = storage::set_brightness(BRIGHTNESS.load(Ordering::Relaxed));
|
|
||||||
value
|
|
||||||
})
|
|
||||||
.unwrap_or_else(|| theme::backlight::get_backlight_normal() as _);
|
|
||||||
|
|
||||||
let content_slider = Frame::left_aligned(
|
let content_slider = Frame::left_aligned(
|
||||||
TR::brightness__title.into(),
|
TR::brightness__title.into(),
|
||||||
NumberInputSliderDialog::new(
|
NumberInputSliderDialog::new(
|
||||||
|
@ -4,8 +4,10 @@ use crate::{
|
|||||||
error::{value_error, Error},
|
error::{value_error, Error},
|
||||||
io::BinaryData,
|
io::BinaryData,
|
||||||
micropython::{gc::Gc, iter::IterBuf, list::List, obj::Obj, util},
|
micropython::{gc::Gc, iter::IterBuf, list::List, obj::Obj, util},
|
||||||
|
storage,
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
|
trezorhal::display,
|
||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{
|
||||||
connect::Connect,
|
connect::Connect,
|
||||||
@ -787,6 +789,14 @@ impl FirmwareUI for UIMercury {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn set_brightness(current_brightness: Option<u8>) -> Result<impl LayoutMaybeTrace, Error> {
|
fn set_brightness(current_brightness: Option<u8>) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
|
let current_brightness = current_brightness
|
||||||
|
.map(|value| {
|
||||||
|
// If brightness value is provided, set display brightness to that value
|
||||||
|
display::backlight(value as _);
|
||||||
|
let _ = storage::set_brightness(value);
|
||||||
|
value
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| theme::backlight::get_backlight_normal() as _);
|
||||||
let flow = flow::set_brightness::new_set_brightness(current_brightness)?;
|
let flow = flow::set_brightness::new_set_brightness(current_brightness)?;
|
||||||
Ok(flow)
|
Ok(flow)
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,10 @@ use crate::{
|
|||||||
error::{value_error, Error},
|
error::{value_error, Error},
|
||||||
io::BinaryData,
|
io::BinaryData,
|
||||||
micropython::{gc::Gc, iter::IterBuf, list::List, obj::Obj, util},
|
micropython::{gc::Gc, iter::IterBuf, list::List, obj::Obj, util},
|
||||||
|
storage,
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
|
trezorhal::display,
|
||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{
|
||||||
connect::Connect,
|
connect::Connect,
|
||||||
@ -725,12 +727,18 @@ impl FirmwareUI for UIModelTT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn set_brightness(current_brightness: Option<u8>) -> Result<impl LayoutMaybeTrace, Error> {
|
fn set_brightness(current_brightness: Option<u8>) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
|
let current_brightness = current_brightness
|
||||||
|
.map(|value| {
|
||||||
|
// If brightness value is provided, set display brightness to that value
|
||||||
|
display::backlight(value as _);
|
||||||
|
let _ = storage::set_brightness(value);
|
||||||
|
value
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| theme::backlight::get_backlight_normal() as _);
|
||||||
let layout = RootComponent::new(Frame::centered(
|
let layout = RootComponent::new(Frame::centered(
|
||||||
theme::label_title(),
|
theme::label_title(),
|
||||||
TR::brightness__title.into(),
|
TR::brightness__title.into(),
|
||||||
SetBrightnessDialog::new(
|
SetBrightnessDialog::new(current_brightness),
|
||||||
current_brightness.unwrap_or(theme::backlight::get_backlight_normal()),
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
Ok(layout)
|
Ok(layout)
|
||||||
|
Loading…
Reference in New Issue
Block a user