guild icon
Toit
#wifi
Thread channel in help
Fernan
Fernan 04/12/2025 09:24 PM
Hello, I need to read the wifi rssi dbm of my esp32
floitsch
floitsch 04/12/2025 09:26 PM
floitsch
floitsch 04/12/2025 09:28 PM
Program your microcontrollers in a fast and robust high-level language. - toitlang/toit
Fernan
Fernan 04/12/2025 09:34 PM
:๐Ÿ‘:
Fernan
Fernan 04/13/2025 12:16 AM
how do i get the index of an element on a list?
FernanOPFernan
how do i get the index of an element on a list?
floitsch
floitsch 04/13/2025 08:09 AM
The .do doesn't do that.
So either use a for i := ... loop, or list.size.repeat: | i | ...
(edited)
Geoff
Geoff 02/14/2026 11:07 PM
How can I read the rssi of Jaguar's (or Artemis's?) wifi connection? Scan returns a list, but which SSID is Jaguar connected to? I can wifi.open an ap and get the rssi but that requires ssid AND password. Is there a way to network := jaguar.open.wifi ? Do I have to resort to saving a spare copy of wifi credentials? THANK YOU.
GeoffGeoff
How can I read the rssi of Jaguar's (or Artemis's?) wifi connection? Scan returns a list, but which SSID is Jaguar connected to? I can wifi.open an ap and get the rssi but that req...
floitsch
floitsch 02/14/2026 11:10 PM
Good question. I'm not sure it's possible, but I will have a look tomorrow.
It might also be possible to read the wifi configuration that Jaguar uses
floitsch
floitsch 02/15/2026 06:18 PM
I think the easiest is to just open a wifi-client without any credentials:
floitsch
floitsch 02/15/2026 06:18 PM
import net.wifi main: wifi-client := wifi.open null print wifi-client.access-point.ssid print wifi-client.signal-strength(edited)
floitsch
floitsch 02/15/2026 06:18 PM
I haven't looked too deep, but that either reuses an existing connection, or connects with the saved credentials (which is what Jaguar also uses).
floitsch
floitsch 02/15/2026 06:19 PM
@bitphlipphar is that the best way?
Geoff
Geoff 02/15/2026 08:09 PM
Works great! I could never find correct syntax for wifi.open null. RSSI is printing as "1.0" or "0.98461538461538467004" or "0.96923076923076922906". What is that in dB?
floitsch
floitsch 02/15/2026 08:12 PM
I had to look at the code myself :๐Ÿ™‚:
(not 100% sure it was intended to be used this way).

The value is basically what we get from the esp-idf slightly modified:
/** Returns the signal strength of the current access point association as a float in the range [0..1]. Throws an exception if this network isn't currently connected to an access point. */ signal-strength -> float: info := (client_ as WifiServiceClient).ap-info handle_ rssi := info[WIFI-SCAN-RSSI_] // RSSI is usually in the range [-100..-35]. rssi = min 65 (max 0 rssi + 100) return rssi / 65.0
floitsch
floitsch 02/15/2026 08:13 PM
If you use the wifi-client.access-point you can get the integer value from there.
Geoff
Geoff 02/15/2026 08:14 PM
It's perfect! Thank you.
๐Ÿ‘1
16 messages in total