diff --git a/components/CommandManager/CommandManager/CommandManager.cpp b/components/CommandManager/CommandManager/CommandManager.cpp index 4ffed9d..ca1b68d 100644 --- a/components/CommandManager/CommandManager/CommandManager.cpp +++ b/components/CommandManager/CommandManager/CommandManager.cpp @@ -26,7 +26,8 @@ std::unordered_map commandTypeMap = { {"set_led_duty_cycle", CommandType::SET_LED_DUTY_CYCLE}, {"get_led_duty_cycle", CommandType::GET_LED_DUTY_CYCLE}, {"get_serial", CommandType::GET_SERIAL}, - {"get_led_current", CommandType::GET_LED_CURRENT}, + {"get_led_current", CommandType::GET_LED_CURRENT}, + {"get_who_am_i", CommandType::GET_WHO_AM_I}, }; std::function CommandManager::createCommand(const CommandType type, std::string_view json) const @@ -107,6 +108,9 @@ std::function CommandManager::createCommand(const CommandType t case CommandType::GET_LED_CURRENT: return [this] { return getLEDCurrentCommand(this->registry); }; + case CommandType::GET_WHO_AM_I: + return [this] + { return getInfoCommand(this->registry); }; default: return nullptr; } diff --git a/components/CommandManager/CommandManager/CommandManager.hpp b/components/CommandManager/CommandManager/CommandManager.hpp index 9a5fd7d..9e8886a 100644 --- a/components/CommandManager/CommandManager/CommandManager.hpp +++ b/components/CommandManager/CommandManager/CommandManager.hpp @@ -48,6 +48,7 @@ enum class CommandType GET_LED_DUTY_CYCLE, GET_SERIAL, GET_LED_CURRENT, + GET_WHO_AM_I, }; class CommandManager diff --git a/components/CommandManager/CommandManager/commands/device_commands.cpp b/components/CommandManager/CommandManager/commands/device_commands.cpp index 751af1d..e0b2a2d 100644 --- a/components/CommandManager/CommandManager/commands/device_commands.cpp +++ b/components/CommandManager/CommandManager/commands/device_commands.cpp @@ -248,3 +248,14 @@ CommandResult getLEDCurrentCommand(std::shared_ptr registry) return CommandResult::getErrorResult("Monitoring disabled"); #endif } + +CommandResult getInfoCommand(std::shared_ptr /*registry*/) +{ + const char* who = CONFIG_GENERAL_WHO_AM_I; + const char* ver = CONFIG_GENERAL_Version; + // Ensure non-null strings + if (!who) who = ""; + if (!ver) ver = ""; + auto result = std::format("{{ \"who_am_i\": \"{}\", \"version\": \"{}\" }}", who, ver); + return CommandResult::getSuccessResult(result); +} diff --git a/components/CommandManager/CommandManager/commands/device_commands.hpp b/components/CommandManager/CommandManager/commands/device_commands.hpp index a01798d..e744af5 100644 --- a/components/CommandManager/CommandManager/commands/device_commands.hpp +++ b/components/CommandManager/CommandManager/commands/device_commands.hpp @@ -25,4 +25,7 @@ CommandResult getDeviceModeCommand(std::shared_ptr registry) CommandResult getSerialNumberCommand(std::shared_ptr registry); // Monitoring -CommandResult getLEDCurrentCommand(std::shared_ptr registry); \ No newline at end of file +CommandResult getLEDCurrentCommand(std::shared_ptr registry); + +// General info +CommandResult getInfoCommand(std::shared_ptr registry); \ No newline at end of file diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 86e0f5b..92946c4 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -38,6 +38,18 @@ menu "OpenIris: General Configuration" and any Bluetooth memory (if present on the SoC) should be left released. This can reduce power consumption when operating solely in UVC mode or without networking. + config GENERAL_WHO_AM_I + string "Who am I (device identifier)" + default "OpenIris" + help + A human-readable product or device identifier exposed via the get_info command. + + config GENERAL_Version + string "Firmware version" + default "0.0.0" + help + A firmware version string exposed via the get_info command. + endmenu menu "OpenIris: Camera Configuration" diff --git a/sdkconfig b/sdkconfig index 7e7ffdb..7c8f979 100644 --- a/sdkconfig +++ b/sdkconfig @@ -574,6 +574,8 @@ CONFIG_ENV_GPIO_OUT_RANGE_MAX=48 CONFIG_GENERAL_INCLUDE_UVC_MODE=y CONFIG_GENERAL_STARTUP_DELAY=30 CONFIG_GENERAL_ENABLE_WIRELESS=y +CONFIG_GENERAL_WHO_AM_I="facefocusvr_face" +CONFIG_GENERAL_Version="0.0.1" # end of OpenIris: General Configuration # diff --git a/sdkconfig.base_defaults b/sdkconfig.base_defaults index 4271bcb..f108e34 100644 --- a/sdkconfig.base_defaults +++ b/sdkconfig.base_defaults @@ -573,6 +573,7 @@ CONFIG_ENV_GPIO_OUT_RANGE_MAX=48 # CONFIG_GENERAL_INCLUDE_UVC_MODE is not set # CONFIG_START_IN_UVC_MODE is not set # CONFIG_GENERAL_STARTUP_DELAY is not set +CONFIG_GENERAL_Version="0.0.1" # end of OpenIris: General Configuration # diff --git a/sdkconfig.board.facefocusvr_eye b/sdkconfig.board.facefocusvr_eye index 5cca0bf..c7dad68 100644 --- a/sdkconfig.board.facefocusvr_eye +++ b/sdkconfig.board.facefocusvr_eye @@ -60,4 +60,11 @@ CONFIG_LED_EXTERNAL_PWM_FREQ=20000 CONFIG_LED_EXTERNAL_PWM_DUTY_CYCLE=50 CONFIG_CAMERA_USB_XCLK_FREQ=23000000 CONFIG_GENERAL_INCLUDE_UVC_MODE=y -CONFIG_START_IN_UVC_MODE=y \ No newline at end of file +CONFIG_START_IN_UVC_MODE=y +CONFIG_MONITORING_LED_CURRENT=y +CONFIG_MONITORING_LED_ADC_GPIO=3 +CONFIG_MONITORING_LED_GAIN=11 +CONFIG_MONITORING_LED_SHUNT_MILLIOHM=22000 +CONFIG_MONITORING_LED_SAMPLES=10 +CONFIG_MONITORING_LED_INTERVAL_MS=500 +CONFIG_GENERAL_WHO_AM_I="facefocusvr_eye" \ No newline at end of file diff --git a/sdkconfig.board.facefocusvr_face b/sdkconfig.board.facefocusvr_face index 891ff96..e129199 100644 --- a/sdkconfig.board.facefocusvr_face +++ b/sdkconfig.board.facefocusvr_face @@ -60,4 +60,11 @@ CONFIG_LED_EXTERNAL_PWM_FREQ=20000 CONFIG_LED_EXTERNAL_PWM_DUTY_CYCLE=100 CONFIG_CAMERA_USB_XCLK_FREQ=23000000 CONFIG_GENERAL_INCLUDE_UVC_MODE=y -CONFIG_START_IN_UVC_MODE=y \ No newline at end of file +CONFIG_START_IN_UVC_MODE=y +CONFIG_MONITORING_LED_CURRENT=y +CONFIG_MONITORING_LED_ADC_GPIO=3 +CONFIG_MONITORING_LED_GAIN=11 +CONFIG_MONITORING_LED_SHUNT_MILLIOHM=22000 +CONFIG_MONITORING_LED_SAMPLES=10 +CONFIG_MONITORING_LED_INTERVAL_MS=500 +CONFIG_GENERAL_WHO_AM_I="facefocusvr_face" \ No newline at end of file diff --git a/sdkconfig.board.project_babble b/sdkconfig.board.project_babble index 3eade99..60efadd 100644 --- a/sdkconfig.board.project_babble +++ b/sdkconfig.board.project_babble @@ -52,4 +52,6 @@ CONFIG_LED_EXTERNAL_PWM_DUTY_CYCLE=100 CONFIG_LED_EXTERNAL_GPIO=1 CONFIG_CAMERA_USB_XCLK_FREQ=23000000 CONFIG_GENERAL_INCLUDE_UVC_MODE=y -# CONFIG_START_IN_UVC_MODE is not set \ No newline at end of file +# CONFIG_START_IN_UVC_MODE is not set +# CONFIG_MONITORING_LED_CURRENT is not set +CONFIG_GENERAL_WHO_AM_I="project_babble" \ No newline at end of file diff --git a/sdkconfig.board.xiao-esp32s3 b/sdkconfig.board.xiao_esp32s3 similarity index 94% rename from sdkconfig.board.xiao-esp32s3 rename to sdkconfig.board.xiao_esp32s3 index b3f7fb1..802d196 100644 --- a/sdkconfig.board.xiao-esp32s3 +++ b/sdkconfig.board.xiao_esp32s3 @@ -57,4 +57,6 @@ 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 \ No newline at end of file +# 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 c6a0380..5721d8f 100644 --- a/tools/openiris_setup.py +++ b/tools/openiris_setup.py @@ -975,6 +975,22 @@ def _probe_serial(device: OpenIrisDevice) -> Dict: serial, mac = info return {"serial": serial, "mac": mac} +def _probe_info(device: OpenIrisDevice) -> Dict: + resp = device.send_command("get_who_am_i") + if "error" in resp: + return {"who_am_i": None, "version": None, "error": resp["error"]} + try: + results = resp.get("results", []) + if results: + result_data = json.loads(results[0]) + payload = result_data["result"] + if isinstance(payload, str): + payload = json.loads(payload) + return {"who_am_i": payload.get("who_am_i"), "version": payload.get("version")} + except Exception as e: + return {"who_am_i": None, "version": None, "error": str(e)} + return {"who_am_i": None, "version": None} + def _probe_led_pwm(device: OpenIrisDevice) -> Dict: duty = device.get_led_duty_cycle() @@ -1013,7 +1029,8 @@ def get_settings(device: OpenIrisDevice, args=None): print("\n🧩 Collecting device settings...\n") probes = [ - ("Identity", _probe_serial), + ("Identity", _probe_serial), + ("Info", _probe_info), ("LED", _probe_led_pwm), ("Current", _probe_led_current), ("Mode", _probe_mode), @@ -1041,6 +1058,15 @@ def get_settings(device: OpenIrisDevice, args=None): if not serial and not mac: print("šŸ”‘ Serial/MAC: unavailable") + # LED + info = summary.get("Info", {}) + who = info.get("who_am_i") + ver = info.get("version") + if who: + print(f"šŸ·ļø Device: {who}") + if ver: + print(f"🧭 Version: {ver}") + # LED led = summary.get("LED", {}) duty = led.get("led_external_pwm_duty_cycle")