Compare commits
2 commits
main
...
custom-dim
Author | SHA1 | Date | |
---|---|---|---|
374d228ed9 | |||
57fec7d26f |
1 changed files with 14 additions and 10 deletions
24
src/main.rs
24
src/main.rs
|
@ -20,23 +20,27 @@ fn main() {
|
|||
|
||||
let on_cmd = "HX\x02\x02\x00".as_bytes();
|
||||
let off_cmd = "HX\x02\x02\x01".as_bytes();
|
||||
let son1_cmd = "HX\x03\x02\x02\x01".as_bytes();
|
||||
let son2_cmd = "HX\x03\x02\x02\x00".as_bytes();
|
||||
let toggle0_cmd = "HX\x03\x02\x02\x00".as_bytes();
|
||||
let toggle1_cmd = "HX\x03\x02\x02\x01".as_bytes();
|
||||
let toggle2_cmd = "HX\x03\x02\x02\x02".as_bytes();
|
||||
let toggle3_cmd = "HX\x03\x02\x02\x03".as_bytes();
|
||||
let increase0_cmd = "HX\x03\x02\x03\x00".as_bytes();
|
||||
let increase1_cmd = "HX\x03\x02\x03\x01".as_bytes();
|
||||
let increase2_cmd = "HX\x03\x02\x03\x02".as_bytes();
|
||||
let increase3_cmd = "HX\x03\x02\x03\x03".as_bytes();
|
||||
|
||||
match args.mode.as_str() {
|
||||
"on" => {
|
||||
println!("Turning on...");
|
||||
port.write(on_cmd).expect("Write failed!");
|
||||
}
|
||||
"off" => {
|
||||
println!("Turning off...");
|
||||
port.write(off_cmd).expect("Write failed!");
|
||||
}
|
||||
"son" => {
|
||||
"on" | "son" => {
|
||||
println!("Turning semi-on...");
|
||||
port.write(on_cmd).expect("Write failed!");
|
||||
port.write(son1_cmd).expect("Write failed!");
|
||||
port.write(son2_cmd).expect("Write failed!");
|
||||
port.write(off_cmd).expect("Write failed!");
|
||||
for _ in 0..40 {
|
||||
port.write(increase1_cmd).expect("Write failed!");
|
||||
// port.write(increase2_cmd).expect("Write failed!");
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
eprintln!("Invalid mode value");
|
||||
|
|
Loading…
Reference in a new issue