-
-
Notifications
You must be signed in to change notification settings - Fork 120
Ethernet Fixes IDFv4 #230
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
Ethernet Fixes IDFv4 #230
Conversation
WalkthroughThis update introduces new Ethernet event definitions and corresponding logic adjustments. In Changes
Sequence Diagram(s)sequenceDiagram
participant ESP as ESP-IDF
participant Event as WiFiEvent Handler
participant Logger as Logger
participant WiFi as WiFi Module
ESP->>Event: SYSTEM_EVENT_ETH_GOT_IP
alt Ethernet active & AP inactive
Event->>WiFi: Invoke WiFi.disconnect()
Event->>Logger: Log disconnection message
else Ethernet active & AP active
Event->>Logger: Log dual connection active message
else No Ethernet
Event->>Logger: Log WiFi-only connection status
end
sequenceDiagram
participant WLED as WLED Class
participant Logger as Logger
participant WiFi as WiFi Module
WLED->>Logger: Print local IP (no newline)
alt Connection is Ethernet
WLED->>Logger: Log "Ethernet connection, disabling WiFi"
WLED->>WiFi: Call WiFi.disconnect(true)
else Connection via WiFi
WLED->>Logger: Log "Connection via WiFi"
end
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
wled00/network.cpp (1)
179-190: Improved Ethernet connection handling logic.The updated ETH_GOT_IP event handler now includes proper detection and management of WiFi and Ethernet coexistence:
- It checks if the network is actually using Ethernet
- It conditionally disconnects WiFi when Ethernet is connected (unless AP is active)
- It provides clear debug messages about the connection state
This approach reduces power consumption and potential conflicts when both connection types are available.
Consider adding a user configurable option to control whether WiFi should be automatically disabled when Ethernet is connected. This would give users flexibility in network setup (e.g., using WiFi as a fallback or for specific services).
if (Network.isEthernet()) { if (!apActive) { DEBUG_PRINTLN(F("WiFi Connected *and* ETH Connected. Disabling WIFi")); + // Only disconnect if auto-disconnect is enabled (could be a user preference) + if (autoDisableWiFi) // New configurable option WiFi.disconnect(true); } else {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
wled00/network.cpp(2 hunks)wled00/wled.cpp(1 hunks)
🔇 Additional comments (2)
wled00/network.cpp (1)
164-169: Adding ESP-IDF v4 compatibility for Ethernet events.These definitions map the ESP-IDF v4 ARDUINO_EVENT_* constants to SYSTEM_EVENT_* constants for Ethernet-related events, ensuring compatibility across different ESP-IDF versions.
wled00/wled.cpp (1)
1373-1381: Improved connection feedback and Ethernet handling.The updated code now:
- Differentiates between Ethernet and WiFi connections in the user output
- Disables WiFi when Ethernet is connected (on ESP32 only)
- Provides clearer messaging about the active connection type
This implementation aligns with the WiFiEvent handler changes in network.cpp, ensuring consistent behavior.
Fixes for IDFv4 Ethernet
Summary by CodeRabbit
New Features
Refactor