~ruther/map-led-strip

map-led-strip/src/commands/reset_command.rs -rw-r--r-- 540 bytes
bd185825 — František Boháček fix: set finished of snake animation on the last step, not after 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::commands::command_handler::{CommandHandleError, SpecificCommandHandler};
use crate::commands::command_data::CommandData;

#[derive(Default)]
pub struct ResetCommand;

impl SpecificCommandHandler for ResetCommand {
    fn handle(&self, command: CommandData) -> Result<(), CommandHandleError> {
        let (_, map, animation) = command.deconstruct();
        map.clear();
        animation.remove_animation();
        Ok(())
    }

    fn help(&self) -> &'static str {
        "- Resets the board, all leds set to 0, 0, 0"
    }
}
Do not follow this link