~ruther/map-led-strip

ref: b7e43afe1dd99a6454be3c355d038bd228571ba2 map-led-strip/src/commands/reset_command.rs -rw-r--r-- 552 bytes
b7e43afe — František Boháček feat: add map clear 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
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> {
        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