mirror of
https://github.com/meshtastic/firmware.git
synced 2026-09-22 06:15:25 -04:00
Move the env boilerplate (HAS_USB_NET macro, include/link setup, pinned esp_tinyusb/tinyusb components, and the NCM/DHCP sdkconfig) into a shared [usbnet] section in variants/esp32/usbnet.ini, so enabling the gadget on a board is a short <board>_usbnet env that splices the fragments in. The meshnology_w12_usbnet env becomes the reference consumer, keeping only its board-specific pieces (start delay, coredump-to-flash debugging config). Eligibility is enforced at compile time in USBNetEsp32.cpp: HAS_USB_NET on a SoC without native USB-OTG (C3/C6/H2, classic ESP32) or on a board without BOARD_HAS_PSRAM fails the build with an explanation, since the phone API session's connect-time allocations need PSRAM in the heap and USB-Serial-JTAG parts cannot present a USB device at all.