Skip to content

Fix ESP32 station-IP lookup - correction to the esp_netif migration just merged in #80 - #81

Merged
davidchatting merged 1 commit into
interactionresearchstudio:masterfrom
davidchatting-bot:fix/esp32-tcpip-adapter-migration
Aug 6, 2026
Merged

Fix ESP32 station-IP lookup - correction to the esp_netif migration just merged in #80#81
davidchatting merged 1 commit into
interactionresearchstudio:masterfrom
davidchatting-bot:fix/esp32-tcpip-adapter-migration

Conversation

@davidchatting-bot

Copy link
Copy Markdown
Contributor

#80 merged before my correction landed (same race as #76/#78/#79 before it, but this time the merged commit doesn't actually compile) - `master` currently has the broken first attempt from #80, which guessed `esp_netif_get_sta_list()`/`esp_netif_sta_list_t` as a same-shaped rename of the removed `tcpip_adapter_get_sta_list()`. That guess was wrong and CI failed on it:
```
YoYoWiFiManager.h:183:5: error: 'esp_netif_sta_list_t' does not name a type; did you mean 'esp_netif_flags_t'?
```

This PR is the correction, verified against the actual ESP-IDF v5.1 source this time rather than guessed:

  • `esp_wifi_ap_get_sta_list()` only returns MAC addresses, no IPs.
  • The real replacement for getting each station's IP is `esp_netif_dhcps_get_clients_by_mac()`, which looks up IPs from the AP's DHCP server lease table by MAC - a differently-shaped API (caller pre-fills an array of MACs, the call fills in the IPs) rather than a drop-in rename of the old single call.
  • Needs an `esp_netif_t*` handle for the AP interface, via `esp_netif_get_handle_from_ifkey("WIFI_AP_DEF")` - the ifkey Arduino's `WiFi.softAP()` registers under.

Also decouples `adapter_sta_list` from any ESP-IDF struct entirely: promoted this library's own `wifi_sta.h` shim (previously ESP8266-only, since ESP8266 never had real `tcpip_adapter` types to begin with) into a shared `YoYoStaInfo`/`YoYoStaList` type used on both platforms, so a future ESP-IDF rename can't break this the same way again.

Testing

Still not hardware/toolchain-tested (no ESP32 SDK available in this environment - not enough disk space for the full arduino-esp32 toolchain). Verified against the actual ESP-IDF source this time rather than guessed. Watching CI on this PR before considering it done.

…d rename

The first attempt (esp_netif_get_sta_list()/esp_netif_sta_list_t) was
wrong - CI failed with the same shape of error ('esp_netif_sta_list_t'
does not name a type). That name doesn't exist; I'd guessed it as a
same-shaped rename of tcpip_adapter_get_sta_list() without verifying
against the actual ESP-IDF source.

Verified against espressif/esp-idf v5.1 source this time:
- esp_wifi_ap_get_sta_list() only returns MAC addresses, no IPs
- The real replacement is esp_netif_dhcps_get_clients_by_mac(), which
  looks up each MAC's IP from the AP's DHCP server lease table - a
  differently-shaped API (caller pre-fills an array of MACs, function
  fills in the IPs), not a drop-in rename like the old single call
- Needs an esp_netif_t* handle for the AP interface, obtained via
  esp_netif_get_handle_from_ifkey("WIFI_AP_DEF") - the ifkey Arduino's
  WiFi.softAP()/esp_netif_create_default_wifi_ap() registers under

Also decouples adapter_sta_list from any ESP-IDF struct entirely:
promoted this library's own wifi_sta.h shim (previously ESP8266-only,
since ESP8266 never had real tcpip_adapter types) to a shared
YoYoStaInfo/YoYoStaList type used on both platforms, so a future
ESP-IDF rename can't break this again the same way.

Still not hardware/toolchain-tested (no ESP32 SDK available in this
environment) - verified against ESP-IDF source this time rather than
guessed, but relying on CI to confirm compilation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@davidchatting
davidchatting merged commit f8823bd into interactionresearchstudio:master Aug 6, 2026
2 checks passed
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