Fix to suspend process in anime thread to let custom anims run on wake

This commit is contained in:
Luke D. Jones
2023-12-27 11:24:39 +13:00
parent ce870cd5ed
commit 5cdfa5a8d4
2 changed files with 18 additions and 10 deletions

View File

@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Changed
- Fix to suspend process in anime thread to let custom anims run on wake
## [v5.0.6]
- Revert egui update due to a lot of issues arising from window closing.

View File

@@ -277,16 +277,8 @@ impl crate::CtrlTask for CtrlAnimeZbus {
async move {
let lock = inner.lock().await;
if lock.config.display_enabled {
lock.node
.write_bytes(&pkt_set_enable_powersave_anim(
!(sleeping && lock.config.off_when_suspended),
))
.map_err(|err| {
warn!("create_sys_event_tasks::off_when_suspended {}", err);
})
.ok();
lock.thread_exit.store(true, Ordering::Release); // ensure clean slate
lock.node
.write_bytes(&pkt_set_enable_display(
!(sleeping && lock.config.off_when_suspended),
@@ -296,7 +288,21 @@ impl crate::CtrlTask for CtrlAnimeZbus {
})
.ok();
if !sleeping && !lock.config.builtin_anims_enabled {
if lock.config.builtin_anims_enabled {
lock.node
.write_bytes(&pkt_set_enable_powersave_anim(
!(sleeping && lock.config.off_when_suspended),
))
.map_err(|err| {
warn!("create_sys_event_tasks::off_when_suspended {}", err);
})
.ok();
} else if !sleeping && !lock.config.builtin_anims_enabled {
// Run custom wake animation
lock.node
.write_bytes(&pkt_set_enable_powersave_anim(false))
.ok(); // ensure builtins are disabled
CtrlAnime::run_thread(inner.clone(), lock.cache.wake.clone(), true)
.await;
}