Simplify and remove further code

This commit is contained in:
Luke
2020-06-30 16:01:00 +12:00
parent 20b82b1f24
commit 9fad94a834
8 changed files with 66 additions and 189 deletions

View File

@@ -3,10 +3,8 @@ use daemon::rogcore::FanLevel;
use gumdrop::Options;
use log::LevelFilter;
use rog_client::{
aura_modes::AuraModes,
cli_options::{LedBrightness, SetAuraBuiltin},
core_dbus::AuraDbusWriter,
LED_MSG_LEN,
};
use std::io::Write;
@@ -61,19 +59,11 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Version: {}", VERSION);
}
let mut writer = AuraDbusWriter::new()?;
let writer = AuraDbusWriter::new()?;
if let Some(Command::LedMode(mode)) = parsed.command {
if let Some(command) = mode.command {
// Check for special modes here, eg, per-key or multi-zone
match command {
SetAuraBuiltin::MultiStatic(_) => {
let command: AuraModes = command.into();
let byte_arr = <[[u8; LED_MSG_LEN]; 4]>::from(command);
writer.write_multizone(&byte_arr)?;
}
_ => writer.write_builtin_mode(&command.into())?,
}
writer.write_builtin_mode(&command.into())?
}
}
if let Some(brightness) = parsed.bright {