diff --git a/Cargo.lock b/Cargo.lock index 4127ac83e24c9f35bad22f6b9005e79e355f2a05..e29355c3904bb936159181c6cec948066d03c6ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -699,6 +699,7 @@ dependencies = [ "shared-bus", "smart-leds", "static_cell", + "tinybmp", ] [[package]] @@ -1269,6 +1270,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tinybmp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197cc000e382175ff15abd9c54c694ef80ef20cb07e7f956c71e3ea97fc8dc60" +dependencies = [ + "embedded-graphics", +] + [[package]] name = "toml_datetime" version = "0.6.3" diff --git a/Cargo.toml b/Cargo.toml index 9c9e8dc80a8be29a1e88650cf09b9ea6f1afc7c8..2f79b6da7ae0719099d1248b496e5354c0cd7e9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,3 +32,4 @@ port-expander = "0.4.0" shared-bus = { version = "0.3.0", features = ["xtensa"] } smart-leds = "0.3.0" static_cell = "1.2.0" +tinybmp = "0.5.0" diff --git a/img/logo.bmp b/img/logo.bmp new file mode 100644 index 0000000000000000000000000000000000000000..aa065fa3bfaa51446bf7a859ea31295d39dcd2c5 Binary files /dev/null and b/img/logo.bmp differ diff --git a/src/demo_tasks.rs b/src/demo_tasks.rs index 76f9dc005cec3a82ea04387aac3db3b4db81c9df..c9d0362725f9b8cfb5fea8df92362688f68e3325 100644 --- a/src/demo_tasks.rs +++ b/src/demo_tasks.rs @@ -5,10 +5,11 @@ use embedded_graphics::{ pixelcolor::Rgb565, prelude::*, primitives::{PrimitiveStyle, Rectangle, StyledDrawable}, - text::Text, + text::Text, image::Image, }; use esp_backtrace as _; use esp_println::println; +use tinybmp::Bmp; use crate::flow3r::display::Display; use smart_leds::SmartLedsWrite; @@ -87,3 +88,18 @@ async fn move_rectangle<'a>( display.flush().await.unwrap(); Timer::after(Duration::from_millis(10)).await; } + +pub async fn draw_start_screen(display: &mut Display) { + let bmp_data = include_bytes!("../img/logo.bmp"); + let bmp = Bmp::from_slice(bmp_data).unwrap(); + display.fill_solid(&display.bounding_box(), Rgb565::WHITE).unwrap(); + Image::with_center(&bmp, display.bounding_box().center()).draw(display).unwrap(); + Text::with_alignment( + "flow3-rs starting", + Point { x: 120, y: 180 }, + MonoTextStyle::new(&FONT_6X10, Rgb565::BLACK), + embedded_graphics::text::Alignment::Center + ).draw(display).unwrap(); + display.flush().await.unwrap(); + display.set_backlight(100).unwrap(); +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 4e3a76c9e8ef4755d20c82f846d7b6514e3d03fb..62fc88b9c61cd0344830b02acaa8e69509903ba0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,7 @@ mod flow3r; mod runtime; mod demo_tasks; +use demo_tasks::draw_start_screen; use embassy_executor::Spawner; use embassy_time::{Duration, Timer}; @@ -24,7 +25,10 @@ fn runtime() -> ! { } #[embassy_executor::task] -async fn main(flow3r: Flow3r) -> ! { +async fn main(mut flow3r: Flow3r) -> ! { + draw_start_screen(&mut flow3r.display).await; + Timer::after(Duration::from_secs(10)).await; + let spawner = Spawner::for_current_executor().await; spawner.spawn(demo_tasks::leds_fade(flow3r.leds)).ok(); spawner.spawn(demo_tasks::display_demo(flow3r.display)).ok();