mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
@@ -12,8 +12,6 @@ pub static AURA_CONFIG_PATH: &str = "/etc/asusd/aura.conf";
|
||||
#[serde(default)]
|
||||
pub struct AuraConfig {
|
||||
pub brightness: LedBrightness,
|
||||
/// Used to re-set brightness on wake from sleep/hibernation
|
||||
pub last_brightness: LedBrightness,
|
||||
pub current_mode: AuraModeNum,
|
||||
pub builtins: BTreeMap<AuraModeNum, AuraEffect>,
|
||||
pub multizone: Option<BTreeMap<AuraModeNum, Vec<AuraEffect>>>,
|
||||
@@ -24,7 +22,6 @@ impl Default for AuraConfig {
|
||||
fn default() -> Self {
|
||||
AuraConfig {
|
||||
brightness: LedBrightness::Med,
|
||||
last_brightness: LedBrightness::Med,
|
||||
current_mode: AuraModeNum::Static,
|
||||
builtins: BTreeMap::new(),
|
||||
multizone: None,
|
||||
|
||||
@@ -103,7 +103,7 @@ impl CtrlTask for CtrlKbdLedTask {
|
||||
// If waking up
|
||||
if !start {
|
||||
info!("CtrlKbdLedTask reloading brightness and modes");
|
||||
lock.set_brightness(lock.config.last_brightness)
|
||||
lock.set_brightness(lock.config.brightness)
|
||||
.map_err(|e| error!("CtrlKbdLedTask: {e}"))
|
||||
.ok();
|
||||
if let Some(mode) = lock.config.builtins.get(&lock.config.current_mode) {
|
||||
@@ -113,7 +113,9 @@ impl CtrlTask for CtrlKbdLedTask {
|
||||
}
|
||||
} else if start {
|
||||
info!("CtrlKbdLedTask saving last brightness");
|
||||
lock.config.last_brightness = lock.config.brightness;
|
||||
Self::update_config(&mut lock)
|
||||
.map_err(|e| error!("CtrlKbdLedTask: {e}"))
|
||||
.ok();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -153,14 +155,14 @@ impl CtrlTask for CtrlKbdLedTask {
|
||||
})
|
||||
.detach();
|
||||
|
||||
let inner = self.inner.clone();
|
||||
self.repeating_task(500, executor, move || loop {
|
||||
if let Ok(ref mut lock) = inner.try_lock() {
|
||||
Self::update_config(lock).unwrap();
|
||||
break;
|
||||
}
|
||||
})
|
||||
.await;
|
||||
// let inner = self.inner.clone();
|
||||
// self.repeating_task(500, executor, move || loop {
|
||||
// if let Ok(ref mut lock) = inner.try_lock() {
|
||||
// Self::update_config(lock).unwrap();
|
||||
// break;
|
||||
// }
|
||||
// })
|
||||
// .await;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user