mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
improve test oqc interface with new API
This commit is contained in:
parent
c07101f41c
commit
06b9f88926
6 changed files with 55 additions and 43 deletions
|
|
@ -285,10 +285,10 @@ mod implementation {
|
|||
|
||||
pub fn get_battstats(&mut self) -> BattStats {
|
||||
BattStats {
|
||||
voltage: 3700,
|
||||
current: -150,
|
||||
soc: 50,
|
||||
remaining_capacity: 750,
|
||||
voltage: 3950,
|
||||
current: -110,
|
||||
soc: 85,
|
||||
remaining_capacity: 850,
|
||||
}
|
||||
}
|
||||
pub fn stby_current(&self) -> Option<i16> { None }
|
||||
|
|
@ -321,7 +321,9 @@ mod implementation {
|
|||
}
|
||||
}
|
||||
pub fn get_more_stats(&mut self) -> [u16; 15] {
|
||||
[0; 15]
|
||||
let mut ret = [0u16; 15];
|
||||
ret[12] = 3950; // make the oqc test happy
|
||||
ret
|
||||
}
|
||||
|
||||
pub fn poll_usb_cc(&mut self) -> [u32; 2] {
|
||||
|
|
|
|||
|
|
@ -545,25 +545,25 @@ mod implementation {
|
|||
|
||||
|
||||
pub fn xadc_vbus(&self) -> u16 {
|
||||
0
|
||||
2 // some small but non-zero value to represent typical noise
|
||||
}
|
||||
pub fn xadc_vccint(&self) -> u16 {
|
||||
0
|
||||
1296
|
||||
}
|
||||
pub fn xadc_vccaux(&self) -> u16 {
|
||||
0
|
||||
2457
|
||||
}
|
||||
pub fn xadc_vccbram(&self) -> u16 {
|
||||
0
|
||||
2450
|
||||
}
|
||||
pub fn xadc_usbn(&self) -> u16 {
|
||||
0
|
||||
3
|
||||
}
|
||||
pub fn xadc_usbp(&self) -> u16 {
|
||||
0
|
||||
4
|
||||
}
|
||||
pub fn xadc_temperature(&self) -> u16 {
|
||||
0
|
||||
2463
|
||||
}
|
||||
pub fn xadc_gpio5(&self) -> u16 {
|
||||
0
|
||||
|
|
|
|||
|
|
@ -1076,10 +1076,10 @@ fn xmain() -> ! {
|
|||
},
|
||||
Some(Opcode::ModalKeys) => msg_scalar_unpack!(msg, k1, k2, k3, k4, {
|
||||
let keys = [
|
||||
if let Some(a) = core::char::from_u32(k1 as u32) {a} else {'\u{0000}'},
|
||||
if let Some(a) = core::char::from_u32(k2 as u32) {a} else {'\u{0000}'},
|
||||
if let Some(a) = core::char::from_u32(k3 as u32) {a} else {'\u{0000}'},
|
||||
if let Some(a) = core::char::from_u32(k4 as u32) {a} else {'\u{0000}'},
|
||||
core::char::from_u32(k1 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k2 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k3 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k4 as u32).unwrap_or('\u{0000}'),
|
||||
];
|
||||
rootkeys_modal.key_event(keys);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -430,6 +430,8 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
};
|
||||
|
||||
let susres = susres::Susres::new_without_hook(&env.xns).unwrap();
|
||||
// turn off the connection for the duration of this test
|
||||
env.netmgr.connection_manager_stop().unwrap();
|
||||
env.llio.wfi_override(true).unwrap();
|
||||
// activate SSID scanning while the test runs
|
||||
env.com.set_ssid_scanning(true).expect("couldn't turn on SSID scanning");
|
||||
|
|
@ -440,12 +442,6 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
write!(ret, "FAIL: JTAG self access").unwrap();
|
||||
return Ok(Some(ret));
|
||||
}
|
||||
env.com.wlan_set_ssid("precursortest").unwrap();
|
||||
env.ticktimer.sleep_ms(500).unwrap();
|
||||
env.com.wlan_set_pass("notasecret").unwrap();
|
||||
env.ticktimer.sleep_ms(500).unwrap();
|
||||
env.com.wlan_join().unwrap();
|
||||
|
||||
let battstats = env.com.get_more_stats().unwrap();
|
||||
if battstats[12] < 3900 {
|
||||
write!(ret, "FAIL: Battery voltage too low ({}mV) for shipment. Charge to >3900mV before OQC testing.", battstats[12]).unwrap();
|
||||
|
|
@ -455,7 +451,8 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
write!(ret, "FAIL: Battery voltage too high ({}mV).\nSuspect issue with U17P or U11K.", battstats[12]).unwrap();
|
||||
return Ok(Some(ret));
|
||||
}
|
||||
|
||||
log::info!("initiating suspend");
|
||||
env.ticktimer.sleep_ms(250).unwrap(); // give a moment for all the command queues to clear
|
||||
susres.initiate_suspend().unwrap();
|
||||
env.ticktimer.sleep_ms(1000).unwrap(); // pause for the suspend/resume cycle
|
||||
|
||||
|
|
@ -463,6 +460,13 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
xous::send_message(oqc_cid,
|
||||
xous::Message::new_blocking_scalar(OqcOp::Trigger.to_usize().unwrap(), timeout, 0, 0, 0,)
|
||||
).expect("couldn't trigger self test");
|
||||
// join the LAN while the keyboard test is running
|
||||
log::info!("starting wlan join");
|
||||
env.com.wlan_set_ssid("precursortest").unwrap();
|
||||
env.ticktimer.sleep_ms(500).unwrap();
|
||||
env.com.wlan_set_pass("notasecret").unwrap();
|
||||
env.ticktimer.sleep_ms(500).unwrap();
|
||||
env.com.wlan_join().unwrap();
|
||||
|
||||
loop {
|
||||
match oqc_status(oqc_cid) {
|
||||
|
|
@ -473,7 +477,7 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
let mut min_index = 0;
|
||||
for (index, (rssi, name)) in ssid_str.iter().enumerate() {
|
||||
if name.len() > 0 {
|
||||
if *rssi < min {
|
||||
if (*rssi < min) && (*rssi != 0) { // 0 are non-reporting and thus not valid
|
||||
min = *rssi;
|
||||
min_index = index;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ impl<'a> ShellCmdApi<'a> for Wlan {
|
|||
// for now, we should always call flush at the end of a routine; perhaps in the
|
||||
// future we'll have a timer that automatically syncs the pddb
|
||||
entry.flush().expect("couldn't sync pddb cache");
|
||||
write!(ret, "SSID/pass combo saved to PDDB. Connection manager started.").unwrap();
|
||||
write!(ret, "SSID/pass combo saved to PDDB.\nConnection manager started.").unwrap();
|
||||
// restart the connection manager now that the key combo has been committed
|
||||
env.netmgr.connection_manager_run().unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc<AtomicU32>, kbd: keyboard::Keyboard) {
|
|||
passing = Some(true);
|
||||
com.set_backlight(0, 0).unwrap();
|
||||
modal.dynamic_notification_close().unwrap();
|
||||
ticktimer.sleep_ms(50).unwrap();
|
||||
log::info!("all keys hit, exiting");
|
||||
test_finished = true;
|
||||
}
|
||||
|
|
@ -140,6 +141,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc<AtomicU32>, kbd: keyboard::Keyboard) {
|
|||
passing = Some(false);
|
||||
com.set_backlight(0, 0).unwrap();
|
||||
modal.dynamic_notification_close().unwrap();
|
||||
ticktimer.sleep_ms(50).unwrap();
|
||||
log::info!("test done, relinquishing focus");
|
||||
test_finished = true;
|
||||
}
|
||||
|
|
@ -304,14 +306,14 @@ fn map_codes(code: RowCol) -> &'static str {
|
|||
(8, 1) => "F2",
|
||||
(3, 8) => "F3",
|
||||
(3, 9) => "F4",
|
||||
//(8, 3) => "⬅️",
|
||||
(8, 3) => "LT",
|
||||
//(3, 6) => "➡️",
|
||||
(3, 6) => "RT",
|
||||
//(6, 4) => "⬆️",
|
||||
(6, 4) => "UP",
|
||||
//(8, 2) => "⬇️",
|
||||
(8, 2) => "DN",
|
||||
(8, 3) => "←",
|
||||
//(8, 3) => "LT",
|
||||
(3, 6) => "→",
|
||||
//(3, 6) => "RT",
|
||||
(6, 4) => "↑",
|
||||
//(6, 4) => "UP",
|
||||
(8, 2) => "↓",
|
||||
//(8, 2) => "DN",
|
||||
(5, 2) => "MID",
|
||||
_ => "ERR!",
|
||||
}
|
||||
|
|
@ -320,13 +322,13 @@ fn map_codes(code: RowCol) -> &'static str {
|
|||
fn render_string(txt: &mut String, remaining: &Vec::<(RowCol, bool)>, time_remaining: u64) {
|
||||
txt.clear();
|
||||
let mut keyrowstrs: [String; 7] = [
|
||||
String::new(),
|
||||
String::new(),
|
||||
String::new(),
|
||||
String::new(),
|
||||
String::new(),
|
||||
String::new(),
|
||||
String::new(),
|
||||
String::from("▶ "),
|
||||
String::from("▶ "),
|
||||
String::from("▶ "),
|
||||
String::from("▶ "),
|
||||
String::from("▶ "),
|
||||
String::from("▶ "),
|
||||
String::from("▶ "),
|
||||
];
|
||||
for &(code, was_hit) in remaining.iter() {
|
||||
if !was_hit {
|
||||
|
|
@ -343,12 +345,16 @@ fn render_string(txt: &mut String, remaining: &Vec::<(RowCol, bool)>, time_remai
|
|||
_ => 6,
|
||||
};
|
||||
keyrowstrs[draw_row].push_str(map_codes(code));
|
||||
keyrowstrs[draw_row].push_str(" ");
|
||||
keyrowstrs[draw_row].push_str("\t");
|
||||
}
|
||||
}
|
||||
for s in keyrowstrs.iter() {
|
||||
txt.push_str(s);
|
||||
txt.push('\n');
|
||||
if s.chars().count() > 2 {
|
||||
txt.push_str(s);
|
||||
txt.push('\n');
|
||||
} else {
|
||||
txt.push_str("✔\n")
|
||||
}
|
||||
}
|
||||
txt.push_str("Timeout: ");
|
||||
txt.push_str(&(time_remaining / 1000).to_string());
|
||||
|
|
|
|||
Loading…
Reference in a new issue