Fixes to tasks

This commit is contained in:
Luke D. Jones
2022-06-12 15:31:09 +12:00
parent 578d5fd541
commit 9519a35e32
4 changed files with 83 additions and 63 deletions

View File

@@ -178,13 +178,16 @@ impl CtrlTask for CtrlCharge {
// If waking up - intention is to catch hibernation event
if !args.start {
info!("CtrlCharge reloading charge limit");
if let Ok(mut lock) = config.clone().try_lock() {
Self::set(lock.bat_charge_limit, &mut lock)
.map_err(|err| {
warn!("CtrlCharge: set_limit {}", err);
err
})
.ok();
loop {
if let Ok(mut lock) = config.clone().try_lock() {
Self::set(lock.bat_charge_limit, &mut lock)
.map_err(|err| {
warn!("CtrlCharge: set_limit {}", err);
err
})
.ok();
break;
}
}
}
}