Skip to content

Use WIFI_IF_STA / WIFI_IF_AP for esp_wifi_get_protocol / esp_wifi_get… - #96

Merged
luc-github merged 1 commit into
luc-github:masterfrom
ellensp:fix-wifi-interface-idf4
Oct 20, 2026
Merged

luc-github merged 1 commit into
luc-github:masterfrom
ellensp:fix-wifi-interface-idf4

Conversation

@ellensp

@ellensp ellensp commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Title: Use WIFI_IF_STA / WIFI_IF_AP for esp_wifi_get_protocol / esp_wifi_get_config

ESP3DLib doesn't compile with arduino-esp32 2.x (ESP-IDF 4.4), for example PlatformIO espressif32@6.1.0:

src/command.cpp:1265: error: cannot convert 'esp_interface_t' to 'wifi_interface_t'
src/command.cpp:1313: error: cannot convert 'esp_interface_t' to 'wifi_interface_t'
In ESP-IDF 4.x, esp_wifi_get_protocol() and esp_wifi_get_config() take a wifi_interface_t, so ESP_IF_WIFI_STA / ESP_IF_WIFI_AP (esp_interface_t) no longer convert. This PR uses WIFI_IF_STA / WIFI_IF_AP instead. Those names exist in every core version tested:

arduino-esp32 1.0.4 and 1.0.6 (ESP-IDF 3.x) define them as aliases of ESP_IF_WIFI_STA / ESP_IF_WIFI_AP, so nothing changes there.
arduino-esp32 2.0.7 (ESP-IDF 4.4) defines them as the wifi_interface_t enum.
Tested with Marlin bugfix-2.1.x on an MKS TinyBee:

builds with espressif32@~3.5.0 and @6.1.0;
on 6.1.0, [ESP420] reports the access point (SSID, mode), which goes through the patched esp_wifi_get_config() line.
Station mode, which uses the patched esp_wifi_get_protocol() line, wasn't tested.

…_config

ESP-IDF 4.x (arduino-esp32 2.x) changed these functions to take a
wifi_interface_t, so ESP_IF_WIFI_STA / ESP_IF_WIFI_AP (esp_interface_t)
no longer compile. WIFI_IF_STA / WIFI_IF_AP exist in both IDF 3.3
(as defines of ESP_IF_WIFI_*) and IDF 4.4 (as the enum), so this
builds on arduino-esp32 1.0.x and 2.x.
@luc-github

luc-github commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Thank you for the fix:
Yes ESP3DLIB V1.0 was following existing idf version used until now, espressif break many things at each release.
So there is a plan to move to new core just for tinybee V1 ? or for also support ESP32-S3 based printer boards ?

FYI:
ESP3DLIB V3.0 is already compatible idf 5.X (Arduino-esp32 3.X) but this version need some Marlin update and use
https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
because of lack of support
My fork is outdated but have all changes and work on all esp32 boards: https://github.com/luc-github/Marlin/tree/2.1.2.5-ESP3DLib-3.0.0.2b1
the esp32-S3 based boards need more changes

EDIT: seems platformio resume support for arduino-esp32 starting IDF 5.5.5 with release 8.0, I will add update support when necessary

@luc-github
luc-github merged commit dfbe385 into luc-github:master Oct 20, 2026
1 check passed
@luc-github

This comment was marked as off-topic.

@allcontributors

This comment was marked as off-topic.

ellensp added a commit to ellensp/Marlin that referenced this pull request Oct 20, 2026
The WIFI_IF_STA / WIFI_IF_AP fix for ESP-IDF 4.4 is merged upstream,
so pin ESP3DLib to that merge instead of the fork.
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