diff --git a/components/CommandManager/CommandManager/commands/device_commands.cpp b/components/CommandManager/CommandManager/commands/device_commands.cpp index 2e3aa31..42a098b 100644 --- a/components/CommandManager/CommandManager/commands/device_commands.cpp +++ b/components/CommandManager/CommandManager/commands/device_commands.cpp @@ -212,12 +212,7 @@ CommandResult getLEDCurrentCommand(std::shared_ptr registry) return CommandResult::getErrorResult("MonitoringManager unavailable"); } float ma = mon->getCurrentMilliAmps(); - const auto json = nlohmann::json - { - { - "led_current_ma", std::format("{:.3f}", static_cast(ma)) - } - } + const auto json = nlohmann::json{{"led_current_ma", std::format("{:.3f}", static_cast(ma))}}; return CommandResult::getSuccessResult(json); #else return CommandResult::getErrorResult("Monitoring disabled"); diff --git a/main/openiris_main.cpp b/main/openiris_main.cpp index eaff621..c57a3ea 100644 --- a/main/openiris_main.cpp +++ b/main/openiris_main.cpp @@ -264,11 +264,8 @@ extern "C" void app_main(void) dependencyRegistry->registerService(DependencyType::monitoring_manager, monitoringManager); // add endpoint to check firmware version - // add firmware version somewhere // setup CI and building for other boards - // finish todos, overhaul stuff a bit - // todo - do we need logs over CDC? Or just commands and their results? // esp_log_set_vprintf(&websocket_logger); Logo::printASCII(); initNVSStorage(); diff --git a/tools/setup_openiris.py b/tools/setup_openiris.py index a5138bd..7d1b1a2 100644 --- a/tools/setup_openiris.py +++ b/tools/setup_openiris.py @@ -328,6 +328,15 @@ def get_wifi_status(device: OpenIrisDevice) -> dict: return {"wifi_status": response["results"][0]["result"]["data"]} +def get_led_current(device: OpenIrisDevice) -> dict: + response = device.send_command("get_led_current") + if has_command_failed(response): + print(f"āŒ Failed to get LED current: {response}") + return {"led_current_ma": "unknown"} + + return {"led_current_ma": response["results"][0]["result"]["data"]["led_current_ma"]} + + def configure_device_name(device: OpenIrisDevice, *args, **kwargs): current_name = get_mdns_name(device) print(f"\nšŸ“ Current device name: {current_name['name']} \n") @@ -432,8 +441,10 @@ def get_settings_summary(device: OpenIrisDevice, *args, **kwargs): probes = [ ("Identity", get_serial_info), + ("AdvertisedName", get_mdns_name), ("Info", get_device_info), ("LED", get_led_duty_cycle), + ("Current", get_led_current), ("Mode", get_device_mode), ("WiFi", get_wifi_status), ] @@ -445,8 +456,16 @@ def get_settings_summary(device: OpenIrisDevice, *args, **kwargs): print(f"šŸ”‘ Serial: {summary['Identity']}") print(f"šŸ’” LED PWM Duty: {summary['LED']['duty_cycle']}%") - print(f"šŸŽšļø Mode: {summary['Mode']['mode']}") + print(f"šŸŽšļø Mode: {summary['Mode']['mode']}") + current_section = summary.get("Current", {}) + led_current_ma = current_section.get("led_current_ma") + print(f"šŸ”Œ LED Current: {led_current_ma} mA") + + advertised_name_data = summary.get("AdvertisedName", {}) + advertised_name = advertised_name_data.get("name") + print(f"šŸ“› Name: {advertised_name}") + info = summary.get("Info", {}) who = info.get("who_am_i") ver = info.get("version") @@ -457,10 +476,11 @@ def get_settings_summary(device: OpenIrisDevice, *args, **kwargs): wifi = summary.get("WiFi", {}).get("wifi_status", {}) - status = wifi.get("status", "unknown") - ip = wifi.get("ip_address") or "-" - configured = wifi.get("networks_configured", 0) - print(f"šŸ“¶ WiFi: {status} | IP: {ip} | Networks configured: {configured}") + if wifi: + status = wifi.get("status", "unknown") + ip = wifi.get("ip_address") or "-" + configured = wifi.get("networks_configured", 0) + print(f"šŸ“¶ WiFi: {status} | IP: {ip} | Networks configured: {configured}") def scan_networks(wifi_scanner: WiFiScanner, *args, **kwargs):