add blank screen for ship mode

This commit is contained in:
bunnie 2021-04-22 18:07:41 +08:00
parent ca63091f98
commit 076ee3588e
3 changed files with 24 additions and 0 deletions

View file

@ -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

View file

@ -43,6 +43,19 @@ impl Gam {
panic!("GAM_API: unexpected return value: {:#?}", response);
}
}
pub fn shipmode_blank_request(&self) -> Result<bool, xous::Error> {
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

View file

@ -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");