Fixed arrival time.
This commit is contained in:
+5
-2
@@ -38,12 +38,15 @@ impl Screen<'_> {
|
||||
|
||||
pub fn update_information(&mut self, display_data: &DisplayData) {
|
||||
self.do_clear();
|
||||
|
||||
// TODO: Add header
|
||||
|
||||
let num_arrivals: i32 = min(if display_data.status.is_some() {LINE_COUNT - 1} else {LINE_COUNT}, display_data.lines.len().try_into().unwrap());
|
||||
for line in 0..num_arrivals {
|
||||
// Compose a line of text with all the information
|
||||
let entry = display_data.lines.get(line as usize).unwrap();
|
||||
let line: u32 = line.try_into().unwrap();
|
||||
let due_in_mins = (entry.due_in / 60) as i32;
|
||||
let line: u32 = (line + 1).try_into().unwrap();
|
||||
let due_in_mins = entry.due_in as i32;
|
||||
let arrival_color: Color = self.color_for(due_in_mins);
|
||||
|
||||
self.color = COLOR_LCD_AMBER;
|
||||
|
||||
@@ -18,7 +18,7 @@ pub struct Prefs {
|
||||
pub struct DisplayEntry {
|
||||
pub route: String,
|
||||
pub destination: String,
|
||||
pub due_in: i32,
|
||||
pub due_in: i64,
|
||||
}
|
||||
|
||||
pub struct DisplayData {
|
||||
|
||||
Reference in New Issue
Block a user