@@ -215,7 +215,7 @@ fn main() -> ! {
215
215
let mut prev_timer = timer. get_counter ( ) . ticks ( ) ;
216
216
let mut game_timer = timer. get_counter ( ) . ticks ( ) ;
217
217
218
- let mut startup_percentage = 0 ;
218
+ let mut startup_percentage = Some ( 0 ) ;
219
219
220
220
loop {
221
221
// TODO: Current hardware revision does not have the sleep pin wired up :(
@@ -226,9 +226,12 @@ fn main() -> ! {
226
226
// Handle period display updates. Don't do it too often
227
227
if timer. get_counter ( ) . ticks ( ) > prev_timer + 20_000 {
228
228
// On startup slowly turn the screen on - it's a pretty effect :)
229
- if startup_percentage <= 100 {
230
- state. grid = percentage ( startup_percentage) ;
231
- startup_percentage += 5 ;
229
+ match startup_percentage {
230
+ Some ( p) if p <= 100 => {
231
+ state. grid = percentage ( p) ;
232
+ startup_percentage = Some ( p + 5 ) ;
233
+ }
234
+ _ => { }
232
235
}
233
236
234
237
fill_grid_pixels ( & state. grid , & mut matrix) ;
@@ -288,7 +291,7 @@ fn main() -> ! {
288
291
}
289
292
( Some ( command) , SleepState :: Awake ) => {
290
293
// If there's a very early command, cancel the startup animation
291
- startup_percentage = 101 ;
294
+ startup_percentage = None ;
292
295
293
296
// While sleeping no command is handled, except waking up
294
297
if let Some ( response) =
0 commit comments