ESP32 RSSI auslesen

OP #5599957
Lesenswert?

Ich bekomme es nicht hin den RSSI Wert der aktuellen Verbindung 
auszugeben?

https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/wifi/esp_wifi.html?highlight=wifi_ap_record_t

Hat jemand eine Idee???
1
void rssi_task() {
2

3
  wifi_ap_record_t ap_info;
4

5
  while(1) {
6

7
     esp_err_t esp_wifi_sta_get_ap_info(&ap_info);  
8

9
    printf("%d\n", ap_info.rssi);
10

11
      vTaskDelay(2000 / portTICK_PERIOD_MS);
12

13
  }
14

15

16
}
#5600099
Lesenswert?

Also bei mir gehts mit Arduino out of the Box.
Sowohl Wifiscan + RSSI sowie Client Connect  + RSSI.
1
#include <Arduino.h>
2
#include "Wifi.h"
3

4
const char* ssid     = "meinWifi";
5
const char* password = "Meinpasswort";
6

7

8

9
void setup()
10
{
11
    Serial.begin(115200);
12
    delay(10);
13

14
    // We start by connecting to a WiFi network
15

16
    Serial.println();
17
    Serial.println();
18
    Serial.print("Connecting to ");
19
    Serial.println(ssid);
20

21
    WiFi.begin(ssid, password);
22

23
    while (WiFi.status() != WL_CONNECTED) {
24
        delay(500);
25
        Serial.print(".");
26
    }
27

28
    Serial.println("");
29
    Serial.println("WiFi connected");
30
    Serial.println("IP address: ");
31
    Serial.println(WiFi.localIP());
32
    Serial.println(WiFi.RSSI());
33
}
34

35
int value = 0;
36

37
void loop()
38
{
39
    delay(5000);
40
    Serial.println(WiFi.RSSI());
41
}
Spuckt aus:
1
Connecting to meinWifi
2
.....
3
WiFi connected
4
IP address:
5
192.168.0.12
6
-30
7
-26
8
-28
9
-27
10
-30
11
-29

Und Wifi.RSSI ist ja nichts anderes als
1
/**
2
 * Return the current network RSSI.
3
 * @return  RSSI value
4
 */
5
int8_t WiFiSTAClass::RSSI(void)
6
{
7
    if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
8
        return 0;
9
    }
10
    wifi_ap_record_t info;
11
    if(!esp_wifi_sta_get_ap_info(&info)) {
12
        return info.rssi;
13
    }
14
    return 0;
15
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren