Clear background in draw

This commit is contained in:
FliegendeWurst 2023-10-14 11:36:08 +02:00
parent f4d42943af
commit f881075c4a

View File

@ -16,7 +16,7 @@ use embedded_graphics::{
use raspi_oled::Events; use raspi_oled::Events;
use time::{format_description, Date, OffsetDateTime, PrimitiveDateTime}; use time::{format_description, Date, OffsetDateTime, PrimitiveDateTime};
use crate::{screensaver::Screensaver, Context, ContextDefault, Draw}; use crate::{screensaver::Screensaver, Context, ContextDefault, Draw, BLACK};
use time_tz::{timezones::db::europe::BERLIN, OffsetDateTimeExt, PrimitiveDateTimeExt}; use time_tz::{timezones::db::europe::BERLIN, OffsetDateTimeExt, PrimitiveDateTimeExt};
static CLOCK_FONT: MonoFont = MonoFont { static CLOCK_FONT: MonoFont = MonoFont {
@ -89,6 +89,7 @@ impl<D: DrawTarget<Color = Rgb565>> Draw<D> for Measurements {
if self.drawn.load(std::sync::atomic::Ordering::Relaxed) { if self.drawn.load(std::sync::atomic::Ordering::Relaxed) {
return Ok(false); return Ok(false);
} }
disp.clear(BLACK)?;
let events = fs::read_to_string("events.json").expect("failed to read events.json"); let events = fs::read_to_string("events.json").expect("failed to read events.json");
let events: Events = serde_json::from_str(&events).unwrap(); let events: Events = serde_json::from_str(&events).unwrap();
let database = ctx.database(); let database = ctx.database();