Skip to content

Commit

Permalink
force please wait message to clear before doing PDDB init
Browse files Browse the repository at this point in the history
While it's a kind of neat effect to have the "please wait"
message persist right up until the point where the dialog box
pops up, the problem is that the blit of the backplane captures
that, so when the context is reverted that message is still there.

On a very fast mount (empty PDDB under Renode emulation) the
mounting call finishes so quickly that the dialog box that would
normally trigger the redraw to clear this message never renders.

This patch forces the screen to blank before trying to call
PDDB init, ensuring that we don't have that persist after the
mount, even if it is very fast.

The downside is there is a fraction of a second where the please
wait disappears, and the dialog box pops up. That is just the
time it takes for the system to setup for the cryptographic
operations.
  • Loading branch information
bunnie committed Nov 6, 2022
1 parent 382380b commit 1d7641c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions services/shellchat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ enum ShellOpcode {
Line = 0, // make sure we occupy opcodes with discriminants < 1000, as the rest are used for callbacks
/// redraw our UI
Redraw,
/// Used by the automounter to clear the "please wait..." message
ForceRedraw,
/// change focus
ChangeFocus,
/// exit the application
Expand Down Expand Up @@ -430,8 +432,14 @@ fn wrapped_main() -> ! {
tt.sleep_ms(50).ok();
}
loop {
// Force the "please wait" message to disappear *prior* to the context switch out to the PDDB login box
// this is necessary because if the mounting process is extremely fast, the subsequent redraw message
// to clear the please wait message will get missed on the return.
xous::send_message(main_conn,
xous::Message::new_blocking_scalar(ShellOpcode::ForceRedraw.to_usize().unwrap(), 0, 0, 0, 0)
).ok();
let (no_retry_failure, count) = pddb::Pddb::new().try_mount();
pddb_init_done.store(true, Ordering::SeqCst);
pddb_init_done.store(false, Ordering::SeqCst);
if no_retry_failure {
// this includes both successfully mounted, and user abort of mount attempt
break;
Expand All @@ -457,9 +465,6 @@ fn wrapped_main() -> ! {
}
}
}
xous::send_message(main_conn,
xous::Message::new_scalar(ShellOpcode::Redraw.to_usize().unwrap(), 0, 0, 0, 0)
).ok();
}
});

Expand Down Expand Up @@ -492,6 +497,11 @@ fn wrapped_main() -> ! {
repl.redraw(pddb_init_done.load(Ordering::SeqCst)).expect("REPL couldn't redraw");
}
}
// Force a redraw without the "please wait" note.
Some(ShellOpcode::ForceRedraw) => {
repl.redraw(true).expect("REPL couldn't redraw");
xous::return_scalar(msg.sender, 0).ok();
}
Some(ShellOpcode::ChangeFocus) => xous::msg_scalar_unpack!(msg, new_state_code, _, _, _, {
let new_state = gam::FocusState::convert_focus_change(new_state_code);
match new_state {
Expand Down

0 comments on commit 1d7641c

Please sign in to comment.