-
Notifications
You must be signed in to change notification settings - Fork 7.6k
WiFiGeneric: add fallback Network‑event typedefs (ESP32‑C6 fix) #11266
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
base: master
Are you sure you want to change the base?
Conversation
// COMPATIBILITY SHIM for ESP32‑C6 / Arduino‑Core v3.x // If the NetworkEvent typedefs are not visible at this point, // provide minimal stand‑ins so the compilation succeeds.
👋 Hello OneNeutrino, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
@OneNeutrino Why not just change the include order ? Can you give an example where this might be an issue ? |
|
Please provide minimal example sketch to demonstrate the issue you are trying to fix |
|
|
@me-no-dev, |
@OneNeutrino given that you now use pioarduino and latest cores, can you still encounter an error? If so, can you provide a new example so we can also reproduce it? |
@me-no-dev I switched the platform in my [env:esp32c6]
# platform = [email protected]
# platform_packages =
# framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.17
platform = pioarduino
board = esp32-c6-devkitc-1
board_build.flash_mode = dio
upload_speed = 921600
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-D MQTT_MAX_PACKET_SIZE=1024
-D MQTT_MAX_TRANSFER_SIZE=1024
-DASYNC_TCP_SSL_ENABLED=0
-D LOG_LEVEL=DEBUG
-D MQTT_DISABLE_ENCRYPTION
-D ESP32
lib_deps =
https://github.com/ESPresense/ESPAsyncWebServer.git
https://github.com/ESPresense/qrcode.git
ESP Async WebServer
PubSubClient
ArduinoJson
Preferences
Update
build_type = debug Unfortunately, the build still fails with the same type of compilation errors as when using the standard In file included from C:/Users/Stark/.platformio/packages/framework-arduinoespressif32@src-6738aaddd9fb901216d5f60e093380b6/libraries/WiFi/src/WiFiGeneric.h:33,
from C:/Users/Stark/.platformio/packages/framework-arduinoespressif32@src-6738aaddd9fb901216d5f60e093380b6/libraries/WiFi/src/WiFiSTA.h:28,
from C:/Users/Stark/.platformio/packages/framework-arduinoespressif32@src-6738aaddd9fb901216d5f60e093380b6/libraries/WiFi/src/WiFi.h:32,
from lib/ESPAsyncWebServer/src/ESPAsyncWebServer.h:40,
from lib/ESPAsyncWebServer/src/AsyncWebSocket.h:32,
from lib/ESPAsyncWebServer/src/AsyncWebSocket.cpp:30:
C:/Users/Stark/.platformio/packages/framework-arduinoespressif32@src-6738aaddd9fb901216d5f60e093380b6/libraries/Ethernet/src/ETH.h:154:42: error: expected class-name before '{' token
154 | class EthernetNetworkInterface : public NetworkInterface {
| ^~~~~~~~~~~~~~~~
C:/Users/Stark/.platformio/packages/framework-arduinoespressif32@src-6738aaddd9fb901216d5f60e093380b6/libraries/Ethernet/src/ETH.h:254:3: error: 'network_event_handle_t' does not name a type; did you mean 'network_prov_event_handler_t'?
254 | network_event_handle_t _network_event_handle;
| ^~~~~~~~~~~~~~~~~~~~~~
| network_prov_event_handler_t ... and many similar errors related to networking classes and types in This confirms what others have found (e.g., in ESPresense Issue #1270: Support for ESP32-C6):
The project needs code-level updates to adapt to the Arduino Core v3 API changes before it can compile successfully for the ESP32-C6. For completeness, I also confirmed that forcing the standard It looks like the path forward requires code modifications within ESPresense to achieve Core v3 compatibility. Issue #1270 seems to be the main place tracking C6 support. |
Description
ESP32-C6 builds using Arduino Core v3.x can fail when
WiFiGeneric.h
is included beforeNetworkEvents.h
(e.g., ifWiFi.h
is included directly withoutNetwork.h
orETH.h
first). This leaves network event types likeNetworkEventCb
andarduino_event_id_t
undefined. Projects like ESPresense can encounter this scenario.This patch adds minimal, compatible fallback typedefs directly within
<WiFiGeneric.h>
, guarded by#if ESP_ARDUINO_VERSION_MAJOR >= 3
. These fallbacks ensure the types have some definition known to the preprocessor when the#define
aliases (like#define WiFiEventCb NetworkEventCb
) are encountered, regardless of whether<NetworkEvents.h>
was included first.This prevents the "not declared" errors and ensures wider compatibility for projects compiling against Core v3.x, especially on newer targets like the C6, with no effect on other chips/cores where
<NetworkEvents.h>
is included normally.Additional Context (PlatformIO Users)
Based on feedback from @me-no-dev, it's important to note that the Arduino-ESP32 core team no longer officially supports the standard PlatformIO
espressif32
platform package.Users encountering general build failures (like
"Error: This board doesn't support arduino framework!"
) when trying to use Arduino Core v3.x with PlatformIO, especially for newer chips (C6, S3, C3, etc.), are advised to switch to the community-maintainedpioarduino
platform package: https://github.com/pioarduino/platform-espressif32This specific PR addresses the typedef issue within the Arduino core files themselves, which is relevant regardless of the PlatformIO platform used, but the
pioarduino
package is the recommended way to use the latest Arduino cores within the PlatformIO ecosystem.