minor tweaks to SSID scan and FCC infra

-fix help string in FCC
-try resetting SSID scan state machine after sleep cycle & timeout
This commit is contained in:
bunnie 2021-04-18 13:38:42 +08:00
parent 53f3ca20f0
commit b85650f5a6
2 changed files with 9 additions and 1 deletions

View file

@ -88,7 +88,7 @@ impl<'a> ShellCmdApi<'a> for Fcc {
fn process(&mut self, args: String::<1024>, env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
let mut ret = String::<1024>::new();
let helpstring = "fcc [ch 1-14] [rate <code>] [go] [stop] [rev] [res]\nrate code: b[1,2,5.5,11], g[6,9,12,18,24,36,48,54], mcs[0-7]";
let helpstring = "fcc [ch 1-11] [euch 1-13] [rate <code>] [go] [stop] [rev] [res]\nrate code: b[1,2,5.5,11], g[6,9,12,18,24,36,48,54], mcs[0-7]";
// no matter what, we want SSID scanning to be off
env.com.set_ssid_scanning(false).expect("couldn't turn off SSID scanning");

View file

@ -14,6 +14,7 @@ pub fn callback_thread() {
let callback_conn = xns.request_connection_blocking(crate::SERVER_NAME_SHELLCHAT).unwrap();
let com = Com::new(&xns).unwrap();
let mut iters = 0; // count how long we've been waiting
loop {
if CB_RUN.load(Ordering::Relaxed) {
log::trace!("checking ssid status");
@ -24,10 +25,17 @@ pub fn callback_thread() {
id: 0xdeadbeef, arg1: 0, arg2: 0, arg3: 0, arg4: 0,
})).unwrap();
CB_RUN.store(false, Ordering::Relaxed);
} else {
iters += 1;
if iters > 11 { // should have gotten a result within 20 seconds...
// there may have been stale data in the scan cache, clear it
let _ = com.ssid_fetch_as_string().unwrap();
}
}
ticktimer.sleep_ms(2_000).unwrap();
} else {
ticktimer.sleep_ms(1_000).unwrap();
iters = 0;
}
}
}