File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ pub async fn lcd_task(
106106 }
107107 }
108108
109+ let current_scene = current_state. scene . clone ( ) ;
109110 let fut = async {
110111 let _ = process_lcd (
111112 current_state,
@@ -128,7 +129,10 @@ pub async fn lcd_task(
128129 }
129130
130131 #[ cfg( not( feature = "e2e" ) ) ]
131- if !sleep_state ( ) && ( Instant :: now ( ) - last_update) . as_millis ( ) > SLEEP_AFTER_MS {
132+ if !sleep_state ( )
133+ && ( Instant :: now ( ) - last_update) . as_millis ( ) > SLEEP_AFTER_MS
134+ && current_scene. can_sleep ( )
135+ {
132136 lcd. backlight_off ( ) ;
133137
134138 unsafe {
Original file line number Diff line number Diff line change @@ -77,6 +77,13 @@ impl Scene {
7777 Scene :: Finished => 9 ,
7878 }
7979 }
80+
81+ pub fn can_sleep ( & self ) -> bool {
82+ !matches ! (
83+ self ,
84+ Scene :: Update | Scene :: WifiConnect | Scene :: AutoSetupWait
85+ )
86+ }
8087}
8188
8289impl PartialOrd for Scene {
You can’t perform that action at this time.
0 commit comments