Skip to content
Snippets Groups Projects
Commit 16e56589 authored by Stephen D's avatar Stephen D
Browse files

wire up debug info

parent 31189099
No related branches found
No related tags found
1 merge request!4Radio refactor
Pipeline #6657 passed
......@@ -181,6 +181,7 @@ impl View {
storage: &mut Storage,
gps: &GpsData,
restarts: u32,
dropped_packets: u32,
) -> Result<(), E> {
match self {
View::MainMenu(m) => m.render(dt),
......@@ -192,7 +193,7 @@ impl View {
View::Packets(p) => p.render(dt),
View::Digipeater(d) => d.render(dt),
View::Gps(g) => g.render(dt, gps),
View::Settings(s) => s.render(dt, restarts),
View::Settings(s) => s.render(dt, restarts, dropped_packets),
}
}
......@@ -271,8 +272,9 @@ pub struct Controller {
new_unread: bool,
// radio status
radio_error: bool,
radio_restarts: u32,
pub radio_error: bool,
pub radio_restarts: u32,
pub dropped_packets: u32,
}
impl Controller {
......@@ -303,6 +305,7 @@ impl Controller {
radio_error: false,
radio_restarts: 0,
dropped_packets: 0,
}
}
......@@ -655,8 +658,13 @@ impl Controller {
} else {
dt.clear(Rgb565::new(0, 32, 16))?;
self.cur_view
.render(dt, &mut self.storage, &self.gps_data, self.radio_restarts)?;
self.cur_view.render(
dt,
&mut self.storage,
&self.gps_data,
self.radio_restarts,
self.dropped_packets,
)?;
self.status
.render(dt, &self.gps_data, self.storage.settings())?;
......
......@@ -27,11 +27,12 @@ impl About {
&mut self,
dt: &mut DT,
restarts: u32,
dropped_packets: u32,
) -> Result<(), E> {
let mut buf: String<80> = String::new();
let mut buf: String<100> = String::new();
write!(
&mut buf,
"CATS Companion v{}\nMade with <3\nhttps://cats.radio\n\nRadio restarts: {restarts}",
"CATS Companion v{}\nMade with <3\nhttps://cats.radio\n\nRadio restarts: {restarts}\nDropped Packets: {dropped_packets}",
env!("CARGO_PKG_VERSION")
)
.unwrap();
......
......@@ -47,6 +47,7 @@ impl SettingsView {
&mut self,
dt: &mut DT,
restarts: u32,
dropped_packets: u32,
) -> Result<(), E> {
match &mut self.view {
View::Selector(s) => s.render(dt),
......@@ -55,7 +56,7 @@ impl SettingsView {
View::Device(d) => d.render(dt),
View::Beacon(b) => b.render(dt),
View::BlackHole(b) => b.render(dt),
View::About(a) => a.render(dt, restarts),
View::About(a) => a.render(dt, restarts, dropped_packets),
}
}
......
......@@ -48,6 +48,10 @@ impl SpiDeviceCommunicator {
}
pub fn tick(&mut self, controller: &mut Controller) {
controller.radio_error = self.radio_error;
controller.radio_restarts = self.radio_restarts;
controller.dropped_packets = self.dropped_packets;
if let Some(disp) = &mut self.display {
controller.render(disp).unwrap();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment