Small fixxes to functionality

- Fixed return of rog-core in client mode
- Fixed writing of customised builtin LED modes
This commit is contained in:
Luke
2020-05-04 15:33:41 +12:00
parent a0d256cbef
commit 62a613a312
9 changed files with 36 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "rog-daemon"
version = "0.9.2"
version = "0.9.3"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]

View File

@@ -414,7 +414,7 @@ where
};
self.set_builtin(config, idx_next).await?;
}
AuraCommand::WriteBytes(bytes) => self.write_bytes(&bytes).await?,
AuraCommand::WriteBytes(bytes) => self.set_and_save(&bytes, config).await?,
AuraCommand::WriteEffect(effect) => self.write_effect(effect).await?,
AuraCommand::ReloadLast => self.reload_last_builtin(&config).await?,
}
@@ -426,7 +426,7 @@ where
match unsafe { self.handle.as_ref() }.write_interrupt(
self.led_endpoint,
message,
Duration::from_millis(2),
Duration::from_millis(5),
) {
Ok(_) => {}
Err(err) => match err {

View File

@@ -128,7 +128,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
} else {
if let Ok(mut lock) = input.try_lock() {
if let Some(bytes) = lock.take() {
if bytes.len() > 8 {
if bytes.len() > 0 {
let mut config = config.lock().await;
led_writer
.do_command(AuraCommand::WriteBytes(bytes), &mut config)
@@ -148,11 +148,11 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
// Write a colour block
if let Ok(mut effect_lock) = effect.try_lock() {
// Spawn a writer
if let Some(stuff) = effect_lock.take() {
if stuff.len() == 10 {
if let Some(effect) = effect_lock.take() {
if effect.len() == 10 {
let mut config = config.lock().await;
led_writer
.do_command(AuraCommand::WriteEffect(stuff), &mut config)
.do_command(AuraCommand::WriteEffect(effect), &mut config)
.await
.map_err(|err| warn!("{:?}", err))
.unwrap();

View File

@@ -7,7 +7,7 @@ use rog_aura::{
AuraDbusWriter, LED_MSG_LEN,
};
static VERSION: &'static str = "0.9.2";
static VERSION: &'static str = "0.9.3";
#[derive(Debug, Options)]
struct CLIStart {
@@ -64,17 +64,24 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
SetAuraBuiltin::MultiStatic(_) => {
let byte_arr = <[[u8; LED_MSG_LEN]; 4]>::from(command);
for arr in byte_arr.iter() {
writer.write_bytes(arr)?;
match writer.write_bytes(arr) {
Ok(msg) => println!("Response: {}", msg),
Err(err) => println!("Error: {}", err),
}
}
}
_ => {
writer.write_builtin_mode(&command)?;
}
_ => match writer.write_builtin_mode(&command) {
Ok(msg) => println!("Response: {}", msg),
Err(err) => println!("Error: {}", err),
},
}
}
}
if let Some(brightness) = parsed.bright {
writer.write_brightness(brightness.level())?;
match writer.write_brightness(brightness.level()) {
Ok(msg) => println!("Response: {}", msg),
Err(err) => println!("Error: {}", err),
}
}
Ok(())
}