(serialdev: &str, arg: Option<bool>)
| 885 | } |
| 886 | |
| 887 | fn screensaver_cmd(serialdev: &str, arg: Option<bool>) { |
| 888 | let mut port = serialport::new(serialdev, 115_200) |
| 889 | .timeout(SERIAL_TIMEOUT) |
| 890 | .open() |
| 891 | .expect("Failed to open port"); |
| 892 | |
| 893 | if let Some(display_on) = arg { |
| 894 | simple_cmd_port(&mut port, Command::ScreenSaver, &[display_on as u8]); |
| 895 | } else { |
| 896 | simple_cmd_port(&mut port, Command::ScreenSaver, &[]); |
| 897 | |
| 898 | let mut response: Vec<u8> = vec![0; 32]; |
| 899 | port.read_exact(response.as_mut_slice()) |
| 900 | .expect("Found no data!"); |
| 901 | |
| 902 | let on = response[0] == 1; |
| 903 | println!("Currently on: {on}"); |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | fn fps_cmd(serialdev: &str, arg: Option<Fps>) { |
| 908 | const HIGH_FPS_MASK: u8 = 0b00010000; |
no test coverage detected