diff --git a/services/com/src/lib.rs b/services/com/src/lib.rs index 28922b018..6c744d7ba 100644 --- a/services/com/src/lib.rs +++ b/services/com/src/lib.rs @@ -601,7 +601,10 @@ impl Com { log::error!("got an error code in fetching the RSSI data: 0x{:x}", rssi_usize); Err(xous::Error::UnknownError) } else { - Ok((rssi_usize & 0xFF) as u8) + // must convert raw code to signal strength here + let rssi = 110u8 - (rssi_usize & 0xFF) as u8; + log::debug!("RSSI (lib): -{}dBm", rssi); + Ok(rssi) } } else { Err(xous::Error::InternalError) diff --git a/services/com/src/main.rs b/services/com/src/main.rs index 881e29a5a..1e8f65677 100644 --- a/services/com/src/main.rs +++ b/services/com/src/main.rs @@ -997,7 +997,13 @@ fn main() -> ! { let rssi = if (maybe_rssi >> 8) & 0xff != 0 { None } else { - Some(maybe_rssi & 0xff) + // rssi as reported is a number from 0-110, where 110 is 0 dbm. + // a perhaps dubious decision was made to shift the reported value over by one before + // returning to the host, so we lost a 0.5dBm step. But...not a big deal, and not worth + // putting every user through an EC update to gain some resolution they never see. + // note there is also a function in lib.rs/wlan_get_rssi() that has to be patched if + // this is fixed. + Some((110 - maybe_rssi) & 0xff) }; let link_state = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)); let mut ipv4_raw = Ipv4Conf::default().encode_u16(); @@ -1015,6 +1021,7 @@ fn main() -> ! { let ssid_str = core::str::from_utf8(&ssid_buf[2..2+ssid_checked_len]).unwrap_or("Disconnected"); let status = WlanStatusIpc { ssid: if let Some(rssi) = rssi { + log::debug!("RSSI: -{}dBm", rssi); Some(SsidRecord { rssi: rssi as u8, name: xous_ipc::String::<32>::from_str(ssid_str) diff --git a/services/status/src/main.rs b/services/status/src/main.rs index d5be4ccc1..4c35878bd 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -833,6 +833,7 @@ fn wrapped_main() -> ! { stats.soc).unwrap(); } else { if let Some(ssid) = wifi_status.ssid { + log::debug!("RSSI: -{}dBm", ssid.rssi); compute_bars(&mut wifi_bars, ssid.rssi); bars(&gam, status_gid, &wifi_bars, Point {x: 310, y: 13}, (3 ,2), 3, 2); write!(