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)]
|
#[serde(default)]
|
||||||
pub struct AuraConfig {
|
pub struct AuraConfig {
|
||||||
pub brightness: LedBrightness,
|
pub brightness: LedBrightness,
|
||||||
/// Used to re-set brightness on wake from sleep/hibernation
|
|
||||||
pub last_brightness: LedBrightness,
|
|
||||||
pub current_mode: AuraModeNum,
|
pub current_mode: AuraModeNum,
|
||||||
pub builtins: BTreeMap<AuraModeNum, AuraEffect>,
|
pub builtins: BTreeMap<AuraModeNum, AuraEffect>,
|
||||||
pub multizone: Option<BTreeMap<AuraModeNum, Vec<AuraEffect>>>,
|
pub multizone: Option<BTreeMap<AuraModeNum, Vec<AuraEffect>>>,
|
||||||
@@ -24,7 +22,6 @@ impl Default for AuraConfig {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
AuraConfig {
|
AuraConfig {
|
||||||
brightness: LedBrightness::Med,
|
brightness: LedBrightness::Med,
|
||||||
last_brightness: LedBrightness::Med,
|
|
||||||
current_mode: AuraModeNum::Static,
|
current_mode: AuraModeNum::Static,
|
||||||
builtins: BTreeMap::new(),
|
builtins: BTreeMap::new(),
|
||||||
multizone: None,
|
multizone: None,
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ impl CtrlTask for CtrlKbdLedTask {
|
|||||||
// If waking up
|
// If waking up
|
||||||
if !start {
|
if !start {
|
||||||
info!("CtrlKbdLedTask reloading brightness and modes");
|
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}"))
|
.map_err(|e| error!("CtrlKbdLedTask: {e}"))
|
||||||
.ok();
|
.ok();
|
||||||
if let Some(mode) = lock.config.builtins.get(&lock.config.current_mode) {
|
if let Some(mode) = lock.config.builtins.get(&lock.config.current_mode) {
|
||||||
@@ -113,7 +113,9 @@ impl CtrlTask for CtrlKbdLedTask {
|
|||||||
}
|
}
|
||||||
} else if start {
|
} else if start {
|
||||||
info!("CtrlKbdLedTask saving last brightness");
|
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();
|
.detach();
|
||||||
|
|
||||||
let inner = self.inner.clone();
|
// let inner = self.inner.clone();
|
||||||
self.repeating_task(500, executor, move || loop {
|
// self.repeating_task(500, executor, move || loop {
|
||||||
if let Ok(ref mut lock) = inner.try_lock() {
|
// if let Ok(ref mut lock) = inner.try_lock() {
|
||||||
Self::update_config(lock).unwrap();
|
// Self::update_config(lock).unwrap();
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
.await;
|
// .await;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user