Page 1 of 1

'esp_wifi_get_inactive_time' was not declared in this scope

Posted: Mon Dec 28, 2020 10:36 am
by digsub
ESP-IDF function esp_wifi_get_inactive_time() is found in esp_wifi.h, but code below won't compile in Arduino IDE 1.8.13 due to 'esp_wifi_get_inactive_time' was not declared in this scope

other functions in esp_wifi.h e.g. esp_wifi_set_bandwidth() are fine.

Checked spelling, conflicts, etc & I can't find the cause. Thanks!


Code: Select all

#include <WiFi.h>
#include "esp_wifi.h"

void setup() {
  ESP_ERROR_CHECK(esp_wifi_set_bandwidth(ESP_IF_WIFI_STA, WIFI_BW_HT20));
  ESP_ERROR_CHECK(esp_wifi_set_bandwidth(ESP_IF_WIFI_AP, WIFI_BW_HT20));

  uint16_t sec;

  ESP_ERROR_CHECK(esp_wifi_get_inactive_time(ESP_IF_WIFI_AP, &sec));  
}

void loop() {}

Re: 'esp_wifi_get_inactive_time' was not declared in this scope

Posted: Wed Dec 30, 2020 2:08 am
by ESP_Jan
Hi digsub,

you are experiencing this issue because the arduino-esp32 is not the same as ESP-IDF.

The header file esp_wifi.h from arduino-esp32 can be found here:
https://github.com/espressif/arduino-es ... esp_wifi.h

To use the function esp_wifi_get_inactive_time you may want to consider to moving your development to the ESP-IDF.

Feel free to post any follow-up questions.

Jan