From 076ee3588e1e32c0ea4c53ee23d93a35d10b27b4 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 22 Apr 2021 18:07:41 +0800 Subject: [PATCH] add blank screen for ship mode --- services/gam/src/api.rs | 3 +++ services/gam/src/lib.rs | 13 +++++++++++++ services/gam/src/main.rs | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/services/gam/src/api.rs b/services/gam/src/api.rs index d8a50b9ae..9684393bb 100644 --- a/services/gam/src/api.rs +++ b/services/gam/src/api.rs @@ -62,6 +62,9 @@ pub(crate) enum Opcode { // Requests setting the UI to the power down screen PowerDownRequest, + // Request blank screen for ship mode + ShipModeBlankRequest, + /////// planned // hides a canvas with a given GID diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index e9a954041..985196572 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -43,6 +43,19 @@ impl Gam { panic!("GAM_API: unexpected return value: {:#?}", response); } } + pub fn shipmode_blank_request(&self) -> Result { + let response = send_message(self.conn, + Message::new_blocking_scalar(Opcode::ShipModeBlankRequest.to_usize().unwrap(), 0, 0, 0, 0))?; + if let xous::Result::Scalar1(confirmed) = response { + if confirmed != 0 { + Ok(true) + } else { + Ok(false) + } + } else { + panic!("GAM_API: unexpected return value: {:#?}", response); + } + } /// this "posts" a textview -- it's not a "draw" as the update is neither guaranteed nor instantaneous /// the GAM first has to check that the textview is allowed to be updated, and then it will decide when diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index 05d5b6418..799e0d5b9 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -273,6 +273,14 @@ fn xmain() -> ! { xous::return_scalar(msg.sender, 1).expect("couldn't confirm power down UI request"); }) } + Some(Opcode::ShipModeBlankRequest) => { + msg_blocking_scalar_unpack!(msg, _, _, _, _, { + powerdown_requested = true; + gfx.draw_rectangle(Rectangle::new_with_style(Point::new(0,0), screensize, DrawStyle::new(PixelColor::Light, PixelColor::Light, 0))).expect("couldn't clear screen"); + gfx.flush().expect("couldn't refresh blank screen"); + xous::return_scalar(msg.sender, 1).expect("couldn't confirm power down UI request"); + }) + } Some(Opcode::Redraw) => { msg_scalar_unpack!(msg, _, _, _, _, { log::trace!("redraw message received");