Add Ethernet Static IP Configuration via Web UI#186
Add Ethernet Static IP Configuration via Web UI#186craigmillard86 wants to merge 18 commits intoCarlosDerSeher:developfrom
Conversation
- Add network_has_ip() function to check if interface has valid IP - Wait for Ethernet to get IP before selecting it (not just link up) - If WiFi connects first, wait up to 5 seconds for Ethernet - Disable WiFi when Ethernet is active to save power - Don't overwrite netif from mDNS results This ensures Ethernet is reliably selected when both interfaces are configured, even if WiFi's DHCP completes faster.
…-snapclient into Ethernet-priority
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add support for configuring Ethernet interface mode (Disabled/DHCP/Static) through the general settings page. Settings are persisted in NVS and applied at boot. Features: - Three Ethernet modes: Disabled, DHCP (default), Static IP - Static IP configuration: IP address, netmask, gateway, DNS - Gateway reachability check with ICMP ping after static IP is applied - Automatic fallback to DHCP if gateway is unreachable - Web UI with IPv4 validation and enable/disable of fields based on mode
…c IP is not enabled.
Make CMakeLists.txt conditionally include eth_interface.c based on CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET or CONFIG_SNAPCLIENT_USE_SPI_ETHERNET so the project builds when ethernet is disabled in menuconfig.
- Removed GPIO noise prevention block (removed upstream in CarlosDerSeher#135/CarlosDerSeher#138) - Removed commented out dead code - Kept ethernet priority and static IP features
|
Hey @craigmillard86 , looks interesting, would you like to include a screenshot "after" changes? |
No Problem, attached:
Static option:
|
|
This assumes SPI Ethernet is configured in sdkconfig, right? Pinouts and everything. Just thinking, with this change and other one is it safe to enable Ethernet in sdkconfig by default? My goal is to make things as simple as possible for people attaching w5500 eth to the Louder-ESP32 boards. Plug-and-play would be ideal. |
Yeah currently needs all configured in menuconfig - if configured with ethernet but not wired up results in hard reboot, will have a think |
If you can make it survive a missing or failed device, that would be ideal. Squeezelite currently reboots into wifi mode if ethernet init fails, not sure if reboot is necessary, but good to have that resilience. |
Refactored based on anabolyc review comments. UI improvements: - Move restart button to nav-bar (visible on all pages) - Remove per-section restart buttons from general-settings - Add netmask validation (contiguous bits check) - Add required field validation for static IP mode - Add confirmation dialog before saving static IP settings Ethernet robustness: - Change default eth_mode to Disabled (safer boot default) - Auto-disable Ethernet on init failure and persist to NVS - Prevents boot loops when Ethernet hardware unavailable - Better cleanup on driver initialization failure - Non-fatal IPv6 link-local creation error handling
|
Based on the comments above and a few other reasons i have refactored this and merged with the static-IP changes as they interact a fair bit. |


Summary
Features