Compare commits

...

2 commits

Author SHA1 Message Date
374d228ed9
Disable damaged light 2024-04-29 12:27:27 +02:00
57fec7d26f
Limit brightness of completely on 2024-04-19 19:22:31 +02:00

View file

@ -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");