Skip to content

Commit d3a5a99

Browse files
committed
ledmatrix: Reset sleep timer if command is received
Keep the device awake if the user interacts with it. Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent f21d2ad commit d3a5a99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ledmatrix/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ fn main() -> ! {
361361
Ok(count) => {
362362
let random = get_random_byte(&rosc);
363363
match (parse_command(count, &buf), &state.sleeping) {
364+
// While sleeping no command is handled, except waking up
364365
(Some(Command::Sleep(go_sleeping)), _) => {
365366
sleeping = go_sleeping;
366367
handle_sleep(
@@ -383,7 +384,9 @@ fn main() -> ! {
383384
// If there's a very early command, cancel the startup animation
384385
startup_percentage = None;
385386

386-
// While sleeping no command is handled, except waking up
387+
// Reset sleep timer when interacting with the device
388+
sleep_timer = timer.get_counter().ticks();
389+
387390
if let Some(response) =
388391
handle_command(&command, &mut state, &mut matrix, random)
389392
{

0 commit comments

Comments
 (0)