diff --git a/Readme.md b/Readme.md index d2b3d5d..2b8ed56 100644 --- a/Readme.md +++ b/Readme.md @@ -130,13 +130,5 @@ You can convert them using [ImageMagick](https://imagemagick.org) like this: # resize to 25px height, adding a black background to the white symbol and vice versa magick Sinnbild_Radfahrer_StVO_1992-200px-white.png -resize x25 -background black -alpha background -flatten -alpha off -verbose Sinnbild_Radfahrer_StVO_1992-25px-white.tga magick Sinnbild_Radfahrer_StVO_1992-200px-black.png -resize x25 -background white -alpha background -flatten -alpha off -verbose Sinnbild_Radfahrer_StVO_1992-25px-black.tga - -magick Stationary_Emergency_Vehicle_Dreieck_Rot.png -resize 200 -background black -alpha background -flatten -alpha off -verbose Stationary_Emergency_Vehicle_Dreieck_Rot-200px.tga -magick Stationary_Vehicle_Dreieck_Rot.png -resize 200 -background black -alpha background -flatten -alpha off -verbose Stationary_Vehicle_Dreieck_Rot-200px.tga -magick Work_Zone_Dreieck_Rot.png -resize 200 -background black -alpha background -flatten -alpha off -verbose Work_Zone_Dreieck_Rot-200px.tga - -magick Dreieck_Rot-300x240.png -resize 200 -background black -alpha background -flatten -alpha off -verbose Dreieck_Rot-200px.tga -magick Stationary_Emergency_Vehicle-140x105.svg -resize 70 -background black -alpha background -flatten -alpha off -verbose Stationary_Emergency_Vehicle-70px.tga -magick Stationary_Vehicle-140x70.svg -resize 80 -background black -alpha background -flatten -alpha off -verbose Stationary_Vehicle-80px.tga -magick Work_Zone-140x95.svg -resize 80 -background black -alpha background -flatten -alpha off -verbose Work_Zone-80px.tga ``` + diff --git a/graphics/Stationary_Emergency_Vehicle-140x105.svg b/graphics/Stationary_Emergency_Vehicle-140x105.svg deleted file mode 100644 index f5b5aa0..0000000 --- a/graphics/Stationary_Emergency_Vehicle-140x105.svg +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/graphics/Stationary_Emergency_Vehicle-70px.tga b/graphics/Stationary_Emergency_Vehicle-70px.tga deleted file mode 100644 index 7c2d1d6..0000000 Binary files a/graphics/Stationary_Emergency_Vehicle-70px.tga and /dev/null differ diff --git a/graphics/Stationary_Vehicle-140x70.svg b/graphics/Stationary_Vehicle-140x70.svg deleted file mode 100644 index 3ff1cd7..0000000 --- a/graphics/Stationary_Vehicle-140x70.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/graphics/Stationary_Vehicle-80px.tga b/graphics/Stationary_Vehicle-80px.tga deleted file mode 100644 index 413a367..0000000 Binary files a/graphics/Stationary_Vehicle-80px.tga and /dev/null differ diff --git a/graphics/Work_Zone-140x95.svg b/graphics/Work_Zone-140x95.svg deleted file mode 100644 index bbbe6fb..0000000 --- a/graphics/Work_Zone-140x95.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/graphics/Work_Zone-80px.tga b/graphics/Work_Zone-80px.tga deleted file mode 100644 index ad9b732..0000000 Binary files a/graphics/Work_Zone-80px.tga and /dev/null differ diff --git a/src/applogic/denm.rs b/src/applogic/denm.rs index d4a5516..9d46dbb 100644 --- a/src/applogic/denm.rs +++ b/src/applogic/denm.rs @@ -1,14 +1,13 @@ //! C-ITS DENM Evaluation -use c_its_parser::standards::cdd_2_2_1::etsi_its_cdd; use c_its_parser::standards::denm_2_2_1::denm_pdu_description; use log::info; -pub fn handle_denm(etsi: &denm_pdu_description::DENM) -> Option { +pub fn handle_denm(etsi: &denm_pdu_description::DENM) { let mgmt = &etsi.denm.management; if mgmt.termination.is_some() { - return None; + return; } if let (Some(sit), Some(loc)) = (&etsi.denm.situation, &etsi.denm.location) { @@ -39,11 +38,7 @@ pub fn handle_denm(etsi: &denm_pdu_description::DENM) -> Option ! { transport: _, ref etsi, } => { - match applogic::denm::handle_denm(etsi) { - #[cfg(feature = "screen")] - Some(cc) => { - let _ = screen - .update(screen::ScreenState::DenmWarning(cc)) - .inspect_err(log_screen_error); - } - _ => {} - } + applogic::denm::handle_denm(etsi); // Send data to BLE thread #[cfg(feature = "ble")] diff --git a/src/screen.rs b/src/screen.rs index 32461d8..2916862 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -1,7 +1,5 @@ //! Screen Output -#[cfg(feature = "denm")] -use c_its_parser::standards::cdd_2_2_1; use embedded_graphics::prelude::*; use embedded_graphics::{geometry, mono_font, pixelcolor, primitives, text}; @@ -28,15 +26,7 @@ where // assets #[cfg(feature = "spat")] - bike_image: tinytga::Tga<'static, pixelcolor::Rgb565>, // 45x25px - // #[cfg(feature = "denm")] - // warn_icon: tinytga::Tga<'static, pixelcolor::Rgb565>, // 200x153 px - #[cfg(feature = "denm")] - sv_insert: tinytga::Tga<'static, pixelcolor::Rgb565>, // 80px wide (original 140x70) - #[cfg(feature = "denm")] - ev_insert: tinytga::Tga<'static, pixelcolor::Rgb565>, // 60px wide (original 140x105) - #[cfg(feature = "denm")] - rww_insert: tinytga::Tga<'static, pixelcolor::Rgb565>, // 80px wide (original 140x95) + bike_image: tinytga::Tga<'static, pixelcolor::Rgb565>, } #[derive(Debug, Default, PartialEq, Eq)] @@ -52,8 +42,6 @@ pub enum ScreenState { GlosaFound(applogic::GlosaFound), #[cfg(feature = "spat")] GlosaLocked(applogic::GlosaSignalInfo), - #[cfg(feature = "denm")] - DenmWarning(cdd_2_2_1::etsi_its_cdd::CauseCodeChoice), } #[cfg(feature = "spat")] @@ -111,23 +99,9 @@ where pub fn new(target: D, display_size: DisplaySize) -> Self { #[cfg(feature = "spat")] - let bike_image = tinytga::Tga::from_slice(include_bytes!( - "../graphics/Sinnbild_Radfahrer_StVO_1992-25px-white.tga" - )) - .expect("Failed to parse TGA image"); - - #[cfg(feature = "denm")] - let sv_insert = - tinytga::Tga::from_slice(include_bytes!("../graphics/Stationary_Vehicle-80px.tga")) - .expect("Failed to parse TGA image"); - #[cfg(feature = "denm")] - let ev_insert = tinytga::Tga::from_slice(include_bytes!( - "../graphics/Stationary_Emergency_Vehicle-70px.tga" - )) - .expect("Failed to parse TGA image"); - #[cfg(feature = "denm")] - let rww_insert = tinytga::Tga::from_slice(include_bytes!("../graphics/Work_Zone-80px.tga")) - .expect("Failed to parse TGA image"); + let data = include_bytes!("../graphics/Sinnbild_Radfahrer_StVO_1992-25px-white.tga"); + #[cfg(feature = "spat")] + let bike_image = tinytga::Tga::from_slice(data).expect("Failed to parse TGA image"); Self { target, @@ -137,14 +111,6 @@ where gnss_hb_state: false, #[cfg(feature = "spat")] bike_image, - // #[cfg(feature = "denm")] - // warn_icon, - #[cfg(feature = "denm")] - sv_insert, - #[cfg(feature = "denm")] - ev_insert, - #[cfg(feature = "denm")] - rww_insert, } } @@ -165,10 +131,6 @@ where self.draw_glosa(glosa_data, prev_glosa_data)?; } ScreenState::Error(msg) => self.draw_message(msg)?, - #[cfg(feature = "denm")] - ScreenState::DenmWarning(cause_code_choice) => { - self.draw_denm_warning(cause_code_choice)? - } } } @@ -205,6 +167,7 @@ where } // on big screns: uses full screen width and height from 250 to 280 pixels + #[cfg(feature = "gnss_ubx")] pub fn update_gnss( &mut self, pvt: &ublox::nav_pvt::proto27::NavPvtRef, @@ -508,76 +471,6 @@ where Ok(()) } - #[cfg(feature = "denm")] - pub fn draw_denm_warning( - &mut self, - cc: &cdd_2_2_1::etsi_its_cdd::CauseCodeChoice, - ) -> Result<(), D::Error> { - // clear whole display and draw image - self.clear()?; - - let centerline = i32::from(self.size.width) / 2; - let sign_top = self.size.offset_top + 40; - - // build triangle shape - { - let point1 = geometry::Point::new(centerline, sign_top); - let point2 = geometry::Point::new(centerline - 100, sign_top + 150); - let point3 = geometry::Point::new(centerline + 100, sign_top + 150); - let mut line_style = - primitives::PrimitiveStyle::with_stroke(pixelcolor::Rgb565::CSS_RED, 10); - line_style.fill_color = Some(pixelcolor::Rgb565::WHITE); - - primitives::Triangle::new(point1, point2, point3) - .into_styled(line_style) - .draw(&mut self.target)?; - } - - // add icon inside the triangle - match cc { - cdd_2_2_1::etsi_its_cdd::CauseCodeChoice::slowVehicle26(_) - | cdd_2_2_1::etsi_its_cdd::CauseCodeChoice::stationaryVehicle94(_) => { - embedded_graphics::image::Image::new( - &self.sv_insert, - geometry::Point::new(centerline - (80 / 2), sign_top + 90), - ) - .draw(&mut self.target)?; - } - - cdd_2_2_1::etsi_its_cdd::CauseCodeChoice::rescueAndRecoveryWorkInProgress15(_) - | cdd_2_2_1::etsi_its_cdd::CauseCodeChoice::emergencyVehicleApproaching95(_) => { - embedded_graphics::image::Image::new( - &self.ev_insert, - geometry::Point::new(centerline - (70 / 2), sign_top + 85), - ) - .draw(&mut self.target)?; - } - - cdd_2_2_1::etsi_its_cdd::CauseCodeChoice::roadworks3(_) => { - embedded_graphics::image::Image::new( - &self.rww_insert, - geometry::Point::new(centerline - (80 / 2), sign_top + 85), - ) - .draw(&mut self.target)?; - } - - _ => { - text::Text::with_alignment( - "Unhandled DENM CC", - geometry::Point::new( - i32::from(self.size.width) / 2, - sign_top + 150 + (10 / 2) + 30, - ), - Self::MID_TEXT_STYLE, - text::Alignment::Center, - ) - .draw(&mut self.target)?; - } - } - - Ok(()) - } - #[allow(unused)] fn draw_slash_screen(&mut self) -> Result<(), D::Error> { let text_style = mono_font::MonoTextStyle::new(&profont::PROFONT_18_POINT, Self::COLOR_FG);