StevenMHernandez / ESP32-CSI-Tool

Extract Channel State Information from WiFi-enabled ESP32 Microcontroller. Active and Passive modes available. (https://stevenmhernandez.github.io/ESP32-CSI-Tool/)
https://stevenmhernandez.github.io/ESP32-CSI-Tool/
MIT License
265 stars 72 forks source link

active_sta mode build error : "main.cc:148:70: error: cannot convert 'esp_interface_t' to 'wifi_interface_t'" #37

Closed Judgement9882 closed 2 years ago

Judgement9882 commented 2 years ago

An error occurred while building in active_sta mode. (Previously, I successfully collected CSI data in passive mode.)

Tool Settings

To Reproduce Steps to reproduce the behavior:

  1. Build project(s) : active_sta
  2. Flash project(s) : active_sta

Desktop (please complete the following information):

Additional context

active_sta_error

I'm not sure how this code works but this error can be resolved by simply commenting out the line.

change_maincc_code

After the above process, I got CSI data. Hope this helps someone who has the same error.

StevenMHernandez commented 2 years ago

Hello. Thanks for mentioning the esp-idf version you used.

Currently the project is known to work with v4.0 of ESP-IDF. Small changes may be required to use higher versions, however I have not yet fully tested these higher versions.

From the project README.md:

First, Install Espressif IoT Development Framework (ESP-IDF) by following their step by step installation guide. Notice, this project requires version (v4.0) of ESP-IDF.

There is an existing issue on this github project to update to a higher version of esp-idf (#11). However, I believe versions 4.3 is the current stable version. Since v4.4 is a stable version, I will not plan update to that version yet. If you would like to help update this open source project to a higher version of esp-idf, please feel free to leave some comments in issue #11. Thanks!

xudesheng commented 2 years ago

for active_sta, you can modify it like this (line 148):

//ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));

for active_ap, you can modify line 115 like:

//ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config));

Those two constants are different in version 4.3.

@StevenMHernandez Please let me know if I should submit a PR.

StevenMHernandez commented 2 years ago

@xudesheng Thanks for identifying this. I am surprised that this is the only change that needs to happen to go from 4.1 to 4.3. There are no other errors?

Does the passive project need any updates too?

Please feel free to submit a PR. If you do, please reference #11

xudesheng commented 2 years ago

@xudesheng Thanks for identifying this. I am surprised that this is the only change that needs to happen to go from 4.1 to 4.3. There are no other errors?

Does the passive project need any updates too?

Please feel free to submit a PR. If you do, please reference #11

Thank you, @StevenMHernandez . My 3 ESP32 are now running as: 1 AP with 2 STA.

I will test passive mode later this week and I will come back with the test result here along with PR.

lyndametref commented 2 years ago

I have also found that the only line to change to make it work are the one mentioned by @xudesheng . I have 1 device running with the sta version and another with the ap and does not have any error at runtime (both on ESP32-S2-Saola-1). I have also tried on a C3 but get an error about the image being to big for the device memory... but that's another issue and I am happy with the S2.

StevenMHernandez commented 2 years ago

@lyndametref Thank you for checking. #39 has these changes pending to be merged. First, I want to fix some deprecation errors before updating the project to 4.3.

I have not worked with the S2 or C3 models. You might consider adding information to the esp32_module_comparison.csv. More info: #33. It would be very useful for everyone to be able to compare different ESP32 models in one place. Thanks!

Judgement9882 commented 2 years ago

for active_sta, you can modify it like this (line 148):

//ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));

for active_ap, you can modify line 115 like:

//ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config));

Those two constants are different in version 4.3.

@StevenMHernandez Please let me know if I should submit a PR.

Thanks! It really helped a lot!!

kallu1294 commented 2 years ago

for active_sta, you can modify it like this (line 148):

//ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));

for active_ap, you can modify line 115 like:

//ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config));

Those two constants are different in version 4.3.

@StevenMHernandez Please let me know if I should submit a PR.

it's really helped me too run with some warnings that's it but I'm not able to connect mobile in AP mode and could not able to scan the wifi devices in STA mode

StevenMHernandez commented 2 years ago

This project is now using esp-idf v4.3 which should have solved this issue. If the problem still persists, please reopen the issue and let me know. Thanks.