unify advertised name for mDNS and USB, update configuration settings, and enhance setup tool prompts.

This commit is contained in:
PhosphorosVR
2025-09-06 16:25:21 +02:00
parent 8138ffa36d
commit ad7b9b8be9
8 changed files with 110 additions and 55 deletions

View File

@@ -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())
{

View File

@@ -1,6 +1,5 @@
#include "UVCStream.hpp"
#include <cstdio> // for snprintf
#include <string>
#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)

View File

@@ -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 WiFi.
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)"

View File

@@ -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
#

View File

@@ -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"
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80

View File

@@ -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"
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=80

View File

@@ -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"

View File

@@ -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://<name>.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://<name>.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