mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix handling of orientation inputs
This commit is contained in:
parent
fbe6aad8bb
commit
8f16270efa
1 changed files with 20 additions and 21 deletions
|
|
@ -522,29 +522,28 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
GfxOpcode::KeyPress => {
|
GfxOpcode::KeyPress => {
|
||||||
if let Some(scalar) = msg.body.scalar_message() {
|
if let Some(scalar) = msg.body.scalar_message() {
|
||||||
let k = char::from_u32(scalar.arg1 as u32).unwrap_or('\u{0000}');
|
let k = char::from_u32(scalar.arg1 as u32).unwrap_or('\u{0000}');
|
||||||
if k == '🔽' || k == '🔼' {
|
|
||||||
// ignore accelerometer reports
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#[cfg(not(feature = "hosted-baosec"))]
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
// any key press will abort QR acquisition by taking the qr_request.
|
// ignore accelerometer reports
|
||||||
if let Some(mut envelope) = qr_request.take() {
|
if !(k == '🔽' || k == '🔼') {
|
||||||
let acquisition = QrAcquisition { content: None, meta: None };
|
// any key press will abort QR acquisition by taking the qr_request.
|
||||||
let mut response = unsafe {
|
if let Some(mut envelope) = qr_request.take() {
|
||||||
xous_ipc::Buffer::from_memory_message_mut(
|
let acquisition = QrAcquisition { content: None, meta: None };
|
||||||
envelope.body.memory_message_mut().unwrap(),
|
let mut response = unsafe {
|
||||||
)
|
xous_ipc::Buffer::from_memory_message_mut(
|
||||||
};
|
envelope.body.memory_message_mut().unwrap(),
|
||||||
response.replace(acquisition).unwrap();
|
)
|
||||||
if orientation == DisplayOrientation::UpsideDown {
|
};
|
||||||
|
response.replace(acquisition).unwrap();
|
||||||
|
if orientation == DisplayOrientation::UpsideDown {
|
||||||
|
display.flip_vertical(true).unwrap_or_else(|_| {
|
||||||
|
display_timeout_handler(&udma_global, &mut display)
|
||||||
|
})
|
||||||
|
}
|
||||||
display
|
display
|
||||||
.flip_vertical(true)
|
.pop()
|
||||||
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display))
|
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
||||||
|
hal.set_preemption(true);
|
||||||
}
|
}
|
||||||
display
|
|
||||||
.pop()
|
|
||||||
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
|
||||||
hal.set_preemption(true);
|
|
||||||
}
|
}
|
||||||
// forward messages on to listeners iff we don't have an active modal
|
// forward messages on to listeners iff we don't have an active modal
|
||||||
if modal_queue.len() == 0 {
|
if modal_queue.len() == 0 {
|
||||||
|
|
@ -942,7 +941,7 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
#[cfg(feature = "board-baosec")]
|
#[cfg(feature = "board-baosec")]
|
||||||
GfxOpcode::FlipScreen => {
|
GfxOpcode::FlipScreen => {
|
||||||
if let Some(scalar) = msg.body.scalar_message_mut() {
|
if let Some(scalar) = msg.body.scalar_message_mut() {
|
||||||
log::info!("gfx flip");
|
log::debug!("gfx flip");
|
||||||
if scalar.arg1 != 0 {
|
if scalar.arg1 != 0 {
|
||||||
orientation = DisplayOrientation::UpsideDown;
|
orientation = DisplayOrientation::UpsideDown;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue