WIP only update display if dirty_flag is set
This commit is contained in:
parent
866e88ba2a
commit
796ad86f19
1 changed files with 13 additions and 5 deletions
|
@ -88,6 +88,13 @@ impl EventHandler for MPDDisplay {
|
|||
|
||||
if self.is_valid && self.is_initialized && self.poll_instant.elapsed() > POLL_TIME {
|
||||
self.poll_instant = Instant::now();
|
||||
if !self.dirty_flag.is_none()
|
||||
&& self
|
||||
.dirty_flag
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.swap(false, std::sync::atomic::Ordering::Relaxed)
|
||||
{
|
||||
self.shared = MPDHandler::get_current_song_info(self.mpd_handler.clone().unwrap())
|
||||
.map_or(None, |f| Some(f));
|
||||
if let Some(shared) = &self.shared {
|
||||
|
@ -96,6 +103,7 @@ impl EventHandler for MPDDisplay {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue