walmis/blackmagic-espidf

Compiling with Station configuration results in compiler error

Closed this issue · 1 comments

I used make menuconfig to reconfigure the project to connect to my home wifi rather than operating as an AP. With this configuration the compilation fails.

blackmagic-espidf/main/platform.c:471:3: error: implicit declaration of function 'wifi_init_softap' [-Werror=implicit-function-declaration]
   wifi_init_softap();

I believe there is a mismatch between the Wifi options configured by menuconfig and what is expected in platform.c.
e.g. configuring for station mode results in the following in sdkconfig:

# CONFIG_ESP_WIFI_IS_SOFTAP is not set
CONFIG_ESP_WIFI_IS_STATION=y
# CONFIG_ESP_WIFI_MODE_AP is not set

Configuring for AP mode results in:

CONFIG_ESP_WIFI_IS_SOFTAP=y
# CONFIG_ESP_WIFI_IS_STATION is not set
CONFIG_ESP_WIFI_MODE_AP=y

Looking in platform.c, it is looking for CONFIG_ESP_WIFI_MODE_AP and CONFIG_ESP_WIFI_MODE_STA starting at line 382. In AP mode, the correct function gets included by virtue of the MODE_AP configuration setting, rather than the IS_SOFTAP setting.

At line 468, however, an #if / #else is used:

#if CONFIG_ESP_WIFI_MODE_STA
  wifi_init_sta();
#else
  wifi_init_softap();
#endif

which results in this always calling wifi_init_softap since there is no code that defines CONFIG_ESP_WIFI_MODE_STA in any configuration that I can find.

Changing the section at 468 to:

#if CONFIG_ESP_WIFI_IS_STATION
  wifi_init_sta();
#else
  wifi_init_softap();
#endif

allows you to compile in station mode successfully although I'm unable to connect due to a MAC address problem that I will submit a different issue for.

Submitted PR #5