Limit brightness of completely on

This commit is contained in:
GHOSCHT 2024-04-19 19:22:31 +02:00
parent e05db87d0f
commit 57fec7d26f
Signed by: ghoscht
GPG key ID: 2C2C1C62A5388E82

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..20 {
port.write(increase1_cmd).expect("Write failed!");
port.write(increase2_cmd).expect("Write failed!");
}
}
_ => {
eprintln!("Invalid mode value");