From ad7b9b8be9c503afa9680c81d29bb1aa808a8d4f Mon Sep 17 00:00:00 2001 From: PhosphorosVR Date: Sat, 6 Sep 2025 16:25:21 +0200 Subject: [PATCH] unify advertised name for mDNS and USB, update configuration settings, and enhance setup tool prompts. --- .../ProjectConfig/ProjectConfig/Models.hpp | 10 ++- components/UVCStream/UVCStream/UVCStream.cpp | 17 +---- main/Kconfig.projbuild | 15 +++-- sdkconfig | 1 - sdkconfig.board.facefocusvr_eye | 3 +- sdkconfig.board.facefocusvr_face | 3 +- sdkconfig.board.xiao-esp32s3 | 62 +++++++++++++++++++ tools/openiris_setup.py | 54 +++++++++------- 8 files changed, 110 insertions(+), 55 deletions(-) create mode 100644 sdkconfig.board.xiao-esp32s3 diff --git a/components/ProjectConfig/ProjectConfig/Models.hpp b/components/ProjectConfig/ProjectConfig/Models.hpp index 9261ade..448f625 100644 --- a/components/ProjectConfig/ProjectConfig/Models.hpp +++ b/components/ProjectConfig/ProjectConfig/Models.hpp @@ -103,9 +103,13 @@ struct MDNSConfig_t : BaseConfigModel void load() { - // by default, this will be openiris - // but we can override it at compile time - std::string default_hostname = CONFIG_WIFI_MDNS_HOSTNAME; + // Default hostname comes from GENERAL_ADVERTISED_NAME (unified advertised name) + std::string default_hostname = +#ifdef CONFIG_GENERAL_ADVERTISED_NAME + CONFIG_GENERAL_ADVERTISED_NAME; +#else + "openiristracker"; +#endif if (default_hostname.empty()) { diff --git a/components/UVCStream/UVCStream/UVCStream.cpp b/components/UVCStream/UVCStream/UVCStream.cpp index 87b0ea2..4fcc853 100644 --- a/components/UVCStream/UVCStream/UVCStream.cpp +++ b/components/UVCStream/UVCStream/UVCStream.cpp @@ -1,6 +1,5 @@ #include "UVCStream.hpp" #include // for snprintf -#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" // no deps on main globals here; handover is performed in main before calling setup when needed @@ -13,21 +12,7 @@ extern "C" const char *get_uvc_device_name() { - // Prefer explicit UVC name from Kconfig, fallback to mDNS hostname when empty - static std::string cached_name; - if (cached_name.empty()) - { - const char *cfg_name = CONFIG_GENERAL_UVC_NAME; - if (cfg_name && cfg_name[0] != '\0') - { - cached_name = cfg_name; - } - else - { - cached_name = deviceConfig->getMDNSConfig().hostname; - } - } - return cached_name.c_str(); + return deviceConfig->getMDNSConfig().hostname.c_str(); } const char *get_serial_number(void) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 2436dd5..20f62f9 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -50,12 +50,14 @@ menu "OpenIris: General Configuration" help A firmware version string exposed via the get_info command. - config GENERAL_UVC_NAME - string "UVC device name" + config GENERAL_ADVERTISED_NAME + string "Advertised device name (UVC + mDNS)" default "openiristracker" help - Default name reported for the UVC interface/device over USB. - This is independent from the mDNS hostname used on Wi‑Fi. + Human-readable device name advertised uniformly across interfaces. + Used as the default mDNS hostname and (indirectly) the UVC USB + device name via get_uvc_device_name(). Users can still override + the runtime hostname through preferences. endmenu @@ -78,10 +80,7 @@ menu "OpenIris: Camera Configuration" endmenu menu "OpenIris: WiFi Configuration" - - config WIFI_MDNS_HOSTNAME - string "mDNS hostname" - default "openiristracker" + # mDNS hostname now derives from GENERAL_ADVERTISED_NAME (no separate Kconfig) config WIFI_SSID string "WiFi network name (SSID)" diff --git a/sdkconfig b/sdkconfig index f64ebfb..4f2d28c 100644 --- a/sdkconfig +++ b/sdkconfig @@ -576,7 +576,6 @@ CONFIG_GENERAL_STARTUP_DELAY=30 CONFIG_GENERAL_ENABLE_WIRELESS=y CONFIG_GENERAL_WHO_AM_I="facefocusvr_face" CONFIG_GENERAL_Version="0.0.1" -CONFIG_GENERAL_UVC_NAME="FFVR Face" # end of OpenIris: General Configuration # diff --git a/sdkconfig.board.facefocusvr_eye b/sdkconfig.board.facefocusvr_eye index 74e3594..589c7d4 100644 --- a/sdkconfig.board.facefocusvr_eye +++ b/sdkconfig.board.facefocusvr_eye @@ -76,5 +76,4 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=80 CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80=y # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set -CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80 -CONFIG_GENERAL_UVC_NAME="FFVR Eye" \ No newline at end of file +CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80 \ No newline at end of file diff --git a/sdkconfig.board.facefocusvr_face b/sdkconfig.board.facefocusvr_face index 6ac3a42..54c435b 100644 --- a/sdkconfig.board.facefocusvr_face +++ b/sdkconfig.board.facefocusvr_face @@ -76,5 +76,4 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=80 CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80=y # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set # CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set -CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80 -CONFIG_GENERAL_UVC_NAME="FFVR Face" \ No newline at end of file +CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80 \ No newline at end of file diff --git a/sdkconfig.board.xiao-esp32s3 b/sdkconfig.board.xiao-esp32s3 new file mode 100644 index 0000000..802d196 --- /dev/null +++ b/sdkconfig.board.xiao-esp32s3 @@ -0,0 +1,62 @@ +CONFIG_BLINK_LED_GPIO=y +CONFIG_BLINK_GPIO=21 +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE="8MB" +# Camera sensor pinout configuration +CONFIG_CAMERA_MODULE_NAME="ESP32S3_XIAO_SENSE" +CONFIG_PWDN_GPIO_NUM=-1 +CONFIG_RESET_GPIO_NUM=-1 +CONFIG_XCLK_GPIO_NUM=10 +CONFIG_SIOD_GPIO_NUM=40 +CONFIG_SIOC_GPIO_NUM=39 +CONFIG_Y9_GPIO_NUM=48 +CONFIG_Y8_GPIO_NUM=11 +CONFIG_Y7_GPIO_NUM=12 +CONFIG_Y6_GPIO_NUM=14 +CONFIG_Y5_GPIO_NUM=16 +CONFIG_Y4_GPIO_NUM=18 +CONFIG_Y3_GPIO_NUM=17 +CONFIG_Y2_GPIO_NUM=15 +CONFIG_VSYNC_GPIO_NUM=38 +CONFIG_HREF_GPIO_NUM=47 +CONFIG_PCLK_GPIO_NUM=13 +# end of Camera sensor pinout configuration +# CONFIG_FLASHMODE_QIO is not set +# CONFIG_FLASHMODE_QOUT is not set +CONFIG_FLASHMODE_DIO=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 +# CONFIG_SPIRAM_XIP_FROM_PSRAM is not set +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +# CONFIG_SPIRAM_XIP_FROM_PSRAM is not set +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED=80 +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_LED_EXTERNAL_CONTROL is not set +CONFIG_CAMERA_USB_XCLK_FREQ=23000000 +CONFIG_GENERAL_INCLUDE_UVC_MODE=y +# CONFIG_START_IN_UVC_MODE is not set +# CONFIG_MONITORING_LED_CURRENT is not set +CONFIG_GENERAL_WHO_AM_I="xiao_esp32s3" \ No newline at end of file diff --git a/tools/openiris_setup.py b/tools/openiris_setup.py index 5eb1a88..b0af91f 100644 --- a/tools/openiris_setup.py +++ b/tools/openiris_setup.py @@ -707,11 +707,9 @@ def configure_wifi(device: OpenIrisDevice, args = None): def configure_mdns(device: OpenIrisDevice, args = None): current_name = device.get_mdns_name() - print(f"\n📍 Current device name: {current_name} \n") - print("💡 Please enter your preferred device name, your board will be accessible under http://.local/") - print("💡 Please avoid spaces and special characters") - print(" To back out, enter `back`") - print("\n Note, this will also modify the name of the UVC device") + print(f"\n📍 Current advertised name: {current_name} \n") + print("💡 This single name is used for both: mDNS (http://.local/) and USB UVC device descriptor.") + print("💡 Avoid spaces / special chars. Enter 'back' to cancel.") while True: name_choice = input("\nDevice name: ").strip() @@ -991,6 +989,11 @@ def _probe_info(device: OpenIrisDevice) -> Dict: return {"who_am_i": None, "version": None, "error": str(e)} return {"who_am_i": None, "version": None} +def _probe_advertised_name(device: OpenIrisDevice) -> Dict: + # Currently the advertised name == mdns hostname + name = device.get_mdns_name() + return {"advertised_name": name} + def _probe_led_pwm(device: OpenIrisDevice) -> Dict: duty = device.get_led_duty_cycle() @@ -1029,10 +1032,11 @@ def get_settings(device: OpenIrisDevice, args=None): print("\n🧩 Collecting device settings...\n") probes = [ - ("Identity", _probe_serial), - ("Info", _probe_info), + ("Identity", _probe_serial), + ("AdvertisedName", _probe_advertised_name), + ("Info", _probe_info), ("LED", _probe_led_pwm), - ("Current", _probe_led_current), + ("Current", _probe_led_current), ("Mode", _probe_mode), ("WiFi", _probe_wifi_status), ] @@ -1058,7 +1062,13 @@ def get_settings(device: OpenIrisDevice, args=None): if not serial and not mac: print("🔑 Serial/MAC: unavailable") - # LED + # Advertised Name + adv = summary.get("AdvertisedName", {}) + adv_name = adv.get("advertised_name") + if adv_name: + print(f"📛 Name: {adv_name}") + + # Info info = summary.get("Info", {}) who = info.get("who_am_i") ver = info.get("version") @@ -1106,12 +1116,11 @@ def get_settings(device: OpenIrisDevice, args=None): COMMANDS_MAP = { "1": wifi_menu, "2": configure_mdns, - "3": configure_mdns, - "4": start_streaming, - "5": switch_device_mode, - "6": set_led_duty_cycle, - "7": monitor_logs, - "8": get_settings, + "3": start_streaming, + "4": switch_device_mode, + "5": set_led_duty_cycle, + "6": monitor_logs, + "7": get_settings, } @@ -1201,15 +1210,14 @@ def main(): while True: print("\n🔧 Setup Options:") print(f"{str(1):>2} 📶 WiFi settings") - print(f"{str(2):>2} 🌐 Configure MDNS") - print(f"{str(3):>2} 💻 Configure UVC Name") - print(f"{str(4):>2} 🚀 Start streaming mode") - print(f"{str(5):>2} 🔄 Switch device mode (WiFi/UVC/Setup)") - print(f"{str(6):>2} 💡 Update PWM Duty Cycle") - print(f"{str(7):>2} 📖 Monitor logs") - print(f"{str(8):>2} 🧩 Get settings summary") + print(f"{str(2):>2} 📛 Configure advertised name (mDNS + UVC)") + print(f"{str(3):>2} 🚀 Start streaming mode") + print(f"{str(4):>2} 🔄 Switch device mode (WiFi/UVC/Setup)") + print(f"{str(5):>2} 💡 Update PWM Duty Cycle") + print(f"{str(6):>2} 📖 Monitor logs") + print(f"{str(7):>2} 🧩 Get settings summary") print("exit 🚪 Exit") - choice = input("\nSelect option (1-8): ").strip() + choice = input("\nSelect option (1-7): ").strip() if choice == "exit": break