Browse Source

protocol optimizations

master
Michael Preisach 7 years ago
parent
commit
0c1b282dc6
  1. 8
      src/protocol.rs

8
src/protocol.rs

@ -72,7 +72,7 @@ impl Protocol {
return Err("ERR Missing arguments"); return Err("ERR Missing arguments");
} }
match arguments[0] { match arguments[0] {
"setsegment" => { "set" => {
if arguments.len() != 3 { if arguments.len() != 3 {
self.running = false; self.running = false;
return Err("ERR Wrong number of arguments"); return Err("ERR Wrong number of arguments");
@ -88,8 +88,8 @@ impl Protocol {
Err(_e) => return Err("ERR index not a number") Err(_e) => return Err("ERR index not a number")
}; };
let value = match arguments[2] { let value = match arguments[2] {
"on" => true, "0" => true,
"off" => false, "1" => false,
_ => return Err("ERR no value for segment") _ => return Err("ERR no value for segment")
}; };
if RPI { if RPI {
@ -100,7 +100,7 @@ impl Protocol {
} }
} }
} }
"display" => { "show" => {
//show the saved state on the display //show the saved state on the display
if RPI { if RPI {

Loading…
Cancel
Save