diff --git a/ion b/ion new file mode 100644 index 0000000..e65d249 --- /dev/null +++ b/ion @@ -0,0 +1,59 @@ +commit d64dd4b0fa1fe53c64d5e2064cd59ef064cd2d07 (HEAD -> main, origin/main, origin/HEAD) +Author: Luke Else +Date: Mon Nov 13 14:19:50 2023 +0000 + + Added draw function to Display + +commit 6c157f65f66ac590d33e7743f88c327daef5c8a0 +Author: Luke Else +Date: Mon Nov 13 13:59:22 2023 +0000 + + Created generic display module + +commit 6625351e38025e489a18051d2e16340402a56e5f +Author: Luke Else +Date: Mon Nov 6 23:20:12 2023 +0000 + + Chore: Started moving individual components out into modules. Started with GPS. Display and i2c driver to follow. + +commit a880586321a023dacbc0d02bbf62f05d3da4aad7 +Author: Luke Else +Date: Fri Aug 18 09:57:12 2023 +0100 + + Changed the project name in cargo.toml + +commit 8c7181add2b9519307538d4f32e2d75c26525902 +Author: Luke Else +Date: Tue Jul 25 21:15:59 2023 +0100 + + Removed some unecessary code, cleaned up the main UI to show only speed, and finally made a start on implementing some sort of app state for different screens / menus + +commit 5828d5ead696667d5a979f31f2314cae0a8e2103 +Author: Luke Else +Date: Fri Jul 21 14:29:57 2023 +0100 + + Updated some of the error handling and data sources for GPS + +commit 620ff4b2072f9df94f262505d7ac22e2bf16c6ae +Author: Luke Else +Date: Fri Jul 21 10:23:23 2023 +0100 + + Reverted back to pre async attempt + +commit 46ca82f379860d275b2d82ef7d2c6e54ab86b09e +Author: Luke Else +Date: Fri Jul 14 14:01:46 2023 +0100 + + Created some very verbose, inefficient and messy code that sends data down an I2C bus for a SSD1306 display to pickup. + +commit 1f8fe3020ffc50691db385c0dd86857fbd2d6962 +Author: Luke Else +Date: Fri Jul 14 12:23:13 2023 +0100 + + Finished code to have data get read from a serial GPS module + +commit 443ef167c144001b462388922f6dd45917d18952 +Author: Luke Else +Date: Fri Jul 14 13:12:43 2023 +0200 + + Initial commit diff --git a/src/gps/mod.rs b/src/gps/mod.rs index 8541ce9..c91c792 100644 --- a/src/gps/mod.rs +++ b/src/gps/mod.rs @@ -22,7 +22,8 @@ pub enum GpsError { pub struct GPS<'a> { uart: uart::UartRxDriver<'a>, - latest: gpsdata::GpsData + latest: gpsdata::GpsData, + current: gpsdata::GpsData } impl<'a> GPS<'a> { @@ -42,7 +43,12 @@ impl<'a> GPS<'a> { &config ).map_err(|err| Error::EspError(err))?; - Ok(GPS { uart, latest: gpsdata::GpsData::default() }) + // Create GPS struct + Ok(GPS { + uart, + latest: gpsdata::GpsData::default(), + current: gpsdata::GpsData::default() + }) } pub fn poll(self: &mut GPS<'a>) -> Result<&gpsdata::GpsData, Error> { diff --git a/src/main.rs b/src/main.rs index 3005948..4073ce4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,10 +46,20 @@ fn main() -> Result<(), Error> { &config ).map_err(|err| Error::EspError(err))?; - let gps: GPS = GPS::new(peripherals.uart0, gps_rx)?; - let display: Display = Display::new(i2c, DisplaySize128x64, DisplayRotation::Rotate0)?; + let mut gps: GPS = GPS::new(peripherals.uart0, gps_rx)?; + let mut display: Display = Display::new(i2c, DisplaySize128x64, DisplayRotation::Rotate0)?; let mut app_state = appstate::AppState::default(); - let mut latest_data = gpsdata::GpsData::default(); - Err(error::Error::DisplayError(DisplayError::DrawingError)) + loop { + let text: &str; + + // Get the latest data from GPS module and flush to Display + match gps.poll() { + Ok(res) => {display.draw(&res.get_speed().as_str())?}, + Err(e) => { + display.draw("NO\nGPS\nDATA"); + }, + } + + } } \ No newline at end of file