refactor: ♻️ much proper implementation
because while I was learning this I hadn't learned vectors
This commit is contained in:
parent
528969944d
commit
1cc4d47dab
1 changed files with 7 additions and 5 deletions
|
@ -30,16 +30,18 @@ impl LedState {
|
|||
self
|
||||
}
|
||||
|
||||
fn export_values(&self) -> Vec<u16> {
|
||||
fn export_values(&self) -> [u16; 4] {
|
||||
match self {
|
||||
LedState::On(r, g, b) => vec![*r as u16, *g as u16, *b as u16],
|
||||
LedState::On(r, g, b) => [*r as u16, *g as u16, *b as u16, 0],
|
||||
LedState::Blink(r, g, b, effect_time) => {
|
||||
vec![*r as u16, *g as u16, *b as u16, *effect_time]
|
||||
[*r as u16, *g as u16, *b as u16, *effect_time]
|
||||
}
|
||||
|
||||
LedState::Breath(r, g, b, effect_time) => {
|
||||
vec![*r as u16, *g as u16, *b as u16, *effect_time]
|
||||
[*r as u16, *g as u16, *b as u16, *effect_time]
|
||||
}
|
||||
LedState::Off => vec![],
|
||||
|
||||
LedState::Off => [0, 0, 0, 0],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue