~ruther/map-led-strip

ref: 85077ba6152de29228dbdc6d163d6f857267662a map-led-strip/src/commands/reset_command.rs -rw-r--r-- 649 bytes
85077ba6 — František Boháček docs: add basic README 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::commands::command_handler::{CommandData, CommandHandleError, SpecificCommandHandler};
use crate::commands::command_handler::CommandHandleError::WrongArguments;

pub struct ResetCommand {}

impl ResetCommand {
    pub fn new() -> Self {
        Self {}
    }
}

impl SpecificCommandHandler for ResetCommand {
    fn handle(&self, command: &mut CommandData) -> Result<(), CommandHandleError> {
        for led in command.map.get_map_mut() {
            led.r = 0;
            led.g = 0;
            led.b = 0;
        }
        Ok(())
    }

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