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,11 +88,19 @@ impl EventHandler for MPDDisplay {
|
||||||
|
|
||||||
if self.is_valid && self.is_initialized && self.poll_instant.elapsed() > POLL_TIME {
|
if self.is_valid && self.is_initialized && self.poll_instant.elapsed() > POLL_TIME {
|
||||||
self.poll_instant = Instant::now();
|
self.poll_instant = Instant::now();
|
||||||
self.shared = MPDHandler::get_current_song_info(self.mpd_handler.clone().unwrap())
|
if !self.dirty_flag.is_none()
|
||||||
.map_or(None, |f| Some(f));
|
&& self
|
||||||
if let Some(shared) = &self.shared {
|
.dirty_flag
|
||||||
if self.notice_text.contents() != shared.error_text {
|
.as_ref()
|
||||||
self.notice_text = Text::new(TextFragment::new(shared.error_text.clone()));
|
.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 {
|
||||||
|
if self.notice_text.contents() != shared.error_text {
|
||||||
|
self.notice_text = Text::new(TextFragment::new(shared.error_text.clone()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue