Handle rainbow with splitting in ui

This commit is contained in:
Your Name 2021-10-11 00:11:27 +01:00
parent bdf6122993
commit 3a81585d51

View File

@ -68,19 +68,19 @@ fn parse_cmd(strip_tx: &Sender<strip::Message>, s: &str) -> Result<(), String> {
let color = parse_color(c, c, c)?;
change_pattern(strip_tx, Box::new(pattern::Solid::new(&pattern::SolidParams {color})))
},
["r"] => change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width: 4, forward: true, skip: 0}))),
["r"] => change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width: 4, forward: true, skip: 0, fromcenter: false}))),
["r", w] => {
let width = w.parse::<u8>().map_err(|_| String::from("Width could not be parsed"))?;
change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width, forward: true, skip: 0})))
change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width, forward: true, skip: 0, fromcenter: false})))
},
["r", w, f] => {
let width = w.parse::<u8>().map_err(|_| String::from("Width could not be parsed"))?;
change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width, forward: ["t", "T"].contains(f), skip: 0})))
change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width, forward: ["t", "T"].contains(f), skip: 0, fromcenter: false})))
},
["r", w, f, s] => {
let width = w.parse::<u8>().map_err(|_| String::from("Width could not be parsed"))?;
let skip = s.parse::<u8>().map_err(|_| String::from("Skip could not be parsed"))?;
change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width, forward: ["t", "T"].contains(f), skip})))
change_pattern(strip_tx, Box::new(pattern::MovingRainbow::new(&pattern::MovingRainbowParams {width, forward: ["t", "T"].contains(f), skip, fromcenter: false})))
},
["b", r1, g1, b1, r2, g2, b2, r3, g3, b3] => {
let left_color = parse_color(r1, g1, b1)?;