fix: RSSI mit Vorzeichen melden

This commit is contained in:
Michael Sauer
2026-09-12 00:32:37 +02:00
parent aae7a7462d
commit 6754cdfb66
+3 -1
View File
@@ -304,7 +304,9 @@ void nl_wifi_status(nl_wifi_status_t *out)
ip4addr_ntoa_r(ip_2_ip4(&e->ip_addr), out->sta_ip, sizeof out->sta_ip); ip4addr_ntoa_r(ip_2_ip4(&e->ip_addr), out->sta_ip, sizeof out->sta_ip);
memset(&bss, 0, sizeof bss); memset(&bss, 0, sizeof bss);
tls_wifi_get_current_bss(&bss); tls_wifi_get_current_bss(&bss);
out->rssi = (int)(int8_t)bss.rssi; /* W600 SDK reports RSSI magnitude as unsigned; EVK ninIOT measured ~-50 dBm as 50.
* Report negative for 0 < bss.rssi <= 127, unchanged for > 127 (already two's complement). */
out->rssi = (bss.rssi > 0 && bss.rssi <= 127) ? -(int)bss.rssi : (int)(int8_t)bss.rssi;
} }
if (out->sta_ip[0]) if (out->sta_ip[0])
copy(out->ip, out->sta_ip, sizeof out->ip); copy(out->ip, out->sta_ip, sizeof out->ip);