Skip to content

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

Closed
henrykotze wants to merge 1 commit intoPX4:px4_firmware_nuttx-10.3.0+from
henrykotze:autonosky/esp32-support-patch
Closed

arch/esp32_spi.c & esp32_wifi_adapter.c amendments#342
henrykotze wants to merge 1 commit intoPX4:px4_firmware_nuttx-10.3.0+from
henrykotze:autonosky/esp32-support-patch

Conversation

@henrykotze
Copy link
Copy Markdown

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

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
Copy Markdown

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
Copy Markdown
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.

@henrykotze
Copy link
Copy Markdown
Author

Closing, since I managed to find the problem during linking in PX4 side

@henrykotze henrykotze closed this Aug 15, 2025
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