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

@@ -1,4 +1,4 @@
use crate::{config::Config, led_control::AuraCommand, rogcore::RogCore};
use crate::{config::Config, rogcore::RogCore};
use rog_client::{
aura_modes::{
AuraModes, BREATHING, COMET, FLASH, HIGHLIGHT, LASER, PULSE, RAIN, RAINBOW, RIPPLE, SINGLE,
@@ -116,7 +116,7 @@ impl LaptopBase {
rogcore: &mut RogCore,
config: &Mutex<Config>,
key_buf: [u8; 32],
mut aura_command: mpsc::Sender<AuraCommand>,
mut aura_command: mpsc::Sender<AuraModes>,
) -> Result<(), AuraError> {
let mut config = config.lock().await;
match FnKeys::from(key_buf[1]) {
@@ -127,7 +127,7 @@ impl LaptopBase {
info!("Increased LED brightness to {:#?}", bright);
}
aura_command
.send(AuraCommand::WriteMode(AuraModes::LedBrightness(bright)))
.send(AuraModes::LedBrightness(bright))
.await
.unwrap_or_else(|err| warn!("LedBrightUp: {}", err));
}
@@ -137,7 +137,7 @@ impl LaptopBase {
bright -= 1;
}
aura_command
.send(AuraCommand::WriteMode(AuraModes::LedBrightness(bright)))
.send(AuraModes::LedBrightness(bright))
.await
.unwrap_or_else(|err| warn!("LedBrightDown: {}", err));
}
@@ -150,7 +150,7 @@ impl LaptopBase {
};
if let Some(data) = config.get_led_mode_data(self.supported_modes[idx_next]) {
aura_command
.send(AuraCommand::WriteMode(data.to_owned()))
.send(data.to_owned())
.await
.unwrap_or_else(|_| {});
}
@@ -167,7 +167,7 @@ impl LaptopBase {
};
if let Some(data) = config.get_led_mode_data(self.supported_modes[idx_next]) {
aura_command
.send(AuraCommand::WriteMode(data.to_owned()))
.send(data.to_owned())
.await
.unwrap_or_else(|_| {});
}