mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
apps.homescreen: brighten the display after swipe
This commit is contained in:
parent
bd514c4732
commit
d13006ebbe
@ -5,24 +5,19 @@ from trezor.utils import unimport
|
||||
async def swipe_to_rotate():
|
||||
from trezor.ui.swipe import Swipe
|
||||
|
||||
while True:
|
||||
degrees = await Swipe(absolute=True)
|
||||
ui.display.orientation(degrees)
|
||||
display_homescreen()
|
||||
degrees = await Swipe(absolute=True)
|
||||
ui.display.orientation(degrees)
|
||||
|
||||
|
||||
async def dim_screen():
|
||||
current = ui.display.backlight()
|
||||
|
||||
await loop.Sleep(5 * 1000000)
|
||||
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
||||
|
||||
original = ui.display.backlight()
|
||||
try:
|
||||
await loop.Sleep(5 * 1000000)
|
||||
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
||||
while True:
|
||||
await loop.Sleep(1000000)
|
||||
finally:
|
||||
# Return back to original brightness
|
||||
ui.display.backlight(current)
|
||||
ui.display.backlight(original)
|
||||
|
||||
|
||||
def display_homescreen():
|
||||
@ -39,6 +34,8 @@ def display_homescreen():
|
||||
|
||||
@unimport
|
||||
async def layout_homescreen():
|
||||
display_homescreen()
|
||||
ui.display.backlight(ui.BACKLIGHT_NORMAL)
|
||||
await loop.Wait([swipe_to_rotate(), dim_screen()])
|
||||
|
||||
while True:
|
||||
display_homescreen()
|
||||
await loop.Wait([swipe_to_rotate(), dim_screen()])
|
||||
|
Loading…
Reference in New Issue
Block a user