+10
-4
src/badge_display/mod.rs
+10
-4
src/badge_display/mod.rs
···
23
23
use gpio::Output;
24
24
use heapless::String;
25
25
use tinybmp::Bmp;
26
-
use uc8151::asynch::Uc8151;
27
26
use uc8151::LUT;
28
27
use uc8151::WIDTH;
28
+
use uc8151::{asynch::Uc8151, UpdateRegion};
29
29
use {defmt_rtt as _, panic_probe as _};
30
30
31
31
use crate::Spi0Bus;
···
86
86
let mut cycles_since_last_clear = 0;
87
87
88
88
loop {
89
+
//TODO do the clock here need to
90
+
//1. Find the right time for counting
89
91
if cycles_since_last_clear >= cycles_to_skip || first_run {
90
92
let count = WIFI_COUNT.load(core::sync::atomic::Ordering::Relaxed);
91
93
let _ = core::fmt::write(&mut text, format_args!("Count: {}", count));
···
117
119
}
118
120
text.clear();
119
121
// let _ = display.clear(Rgb565::WHITE.into());
120
-
let _ = display.update().await;
122
+
// let _ = display.update().await;
121
123
WIFI_COUNT.store(count + 1, core::sync::atomic::Ordering::Relaxed);
122
124
cycles_since_last_clear = 0;
123
125
}
···
127
129
let tga: Bmp<BinaryColor> = Bmp::from_slice(¤t_image.image()).unwrap();
128
130
let image = Image::new(&tga, current_image.image_location());
129
131
//clear image location by writing a white rectangle over previous image location
130
-
let clear_bounds = Rectangle::new(
132
+
let image_bounds = Size::new(160, 140);
133
+
let clear_rectangle = Rectangle::new(
131
134
current_image.previous().image_location(),
132
135
Size::new(157, 101),
133
136
);
134
-
clear_bounds
137
+
clear_rectangle
135
138
.into_styled(PrimitiveStyle::with_fill(BinaryColor::On))
136
139
.draw(&mut display)
137
140
.unwrap();
138
141
139
142
let _ = image.draw(&mut display);
143
+
//TODO need to look up the reginal area display
144
+
// let update_region = UpdateRegion::new(192, 32, 160, 144).unwrap();
145
+
// let result = display.partial_update(update_region).await;
140
146
let _ = display.update().await;
141
147
CHANGE_IMAGE.store(false, core::sync::atomic::Ordering::Relaxed);
142
148
}