Skip to content

arch/esp32_spi.c & esp32_wifi_adapter.c amendments #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: px4_firmware_nuttx-10.3.0+
Choose a base branch
from

Conversation

henrykotze
Copy link

This PR is working alongside PX4/PX4-Autopilot#24887, to get PX4 running on the ESP32.

  • esp32_wifi_adapted.c: ESP32 SoftAP Mode depends on some STA mode functions. Moved those dependent functions out of the include guard of the ESP32_WLAN_HAS_STA

  • esp32_spi.c : resolved compiler error: taking the absolute value of unsigned type 'uint32_t' {aka 'unsigned int'} has no effect

  • The compiler cannot find the enum value of ESP_IF_WIFI_AP. This enum is dependent on the esp-wireless-drivers-3rdparty repo. The files of interest to resolve this issue are:
    /src/include/esp_wifi_types.h

typedef enum {
    WIFI_MODE_NULL = 0,  /**< null mode */
    WIFI_MODE_STA,       /**< WiFi station mode */
    WIFI_MODE_AP,        /**< WiFi soft-AP mode */
    WIFI_MODE_APSTA,     /**< WiFi station + soft-AP mode */
    WIFI_MODE_MAX
} wifi_mode_t;

typedef enum {
    WIFI_IF_STA = ESP_IF_WIFI_STA,
    WIFI_IF_AP  = ESP_IF_WIFI_AP,
} wifi_interface_t;

The other file of interest to resolve this would be /src/include/esp_wifi_interface.h:

typedef enum {
    ESP_IF_WIFI_STA = 0,     /**< ESP32 station interface */
    ESP_IF_WIFI_AP,          /**< ESP32 soft-AP interface */
    ESP_IF_ETH,              /**< ESP32 ethernet interface */
    ESP_IF_MAX
} esp_interface_t;

To resolve the compiler not being able to find WIFI_IF_AP. I just hardcoded it for now to 1. Any guidance on getting it to compiled via the correct header would be appreciated. (I have tried including both esp_wifi_interface.h and esp_wifi_types.h with no success.

- esp32_wifi_adapted.c: ESP32 SoftAP Mode depends on some STA mode functions. Moved those
  dependent functions out of the include guard of the ESP32_WLAN_HAS_STA

- esp32_spi.c : resolved: compiler error: taking the absolute value of
 unsigned type 'uint32_t' {aka 'unsigned int'} has no effect
@@ -6016,7 +6020,8 @@ int esp_wifi_softap_register_recv_cb(int (*recv_cb)(void *buffer,
{
int ret;

ret = esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, (wifi_rxcb_t)recv_cb);
// ret = esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, (wifi_rxcb_t)recv_cb);
ret = esp_wifi_internal_reg_rxcb(1, (wifi_rxcb_t)recv_cb);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the value of 1, true? Or is that something else?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of 1 refers to the enum ESP_IF_WIFI_AP, which means the ESP's WiFi is operating soft-AP mode.

copied from the PR description:
The compiler cannot find the enum value of ESP_IF_WIFI_AP. This enum is dependent on the esp-wireless-drivers-3rdparty repo. (More on this in the description)

That is also why i commented out the original code, since this issue will either be solved in upstream, and thus we can revert it once we pull in the newer Nuttx versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants