Problem
Several async log streaming methods (_stream_motors in FlightTab, _stream_battery in MainUI, _stream_loop in PoseLogger) add log variables unconditionally via block.add_variable(). If a variable is missing from the firmware's log TOC (e.g. due to firmware version differences or custom builds), this will raise an exception inside a create_task() coroutine, which can crash the tab or silently kill the streaming task.
Currently only supervisor.info has a TOC guard:
if self.LOG_NAME_SUPERVISOR_INFO in log.names():
await block.add_variable(self.LOG_NAME_SUPERVISOR_INFO)
But other variables like sys.canfly, stabilizer.thrust, motor.m1-m4, pm.vbat, pm.state, and the stateEstimate.* pose variables are added without checking.
Suggestion
Add log.names() checks before adding variables, or wrap the setup in a try/except that gracefully disables the corresponding UI elements when variables are unavailable. This would make the client more robust against firmware variations.
Affected locations
src/cfclient/ui/tabs/FlightTab.py — _stream_motors()
src/cfclient/ui/main.py — _stream_battery()
src/cfclient/ui/pose_logger.py — _stream_loop()
Context
Raised during Copilot review of PR #792.
Problem
Several async log streaming methods (
_stream_motorsin FlightTab,_stream_batteryin MainUI,_stream_loopin PoseLogger) add log variables unconditionally viablock.add_variable(). If a variable is missing from the firmware's log TOC (e.g. due to firmware version differences or custom builds), this will raise an exception inside acreate_task()coroutine, which can crash the tab or silently kill the streaming task.Currently only
supervisor.infohas a TOC guard:But other variables like
sys.canfly,stabilizer.thrust,motor.m1-m4,pm.vbat,pm.state, and thestateEstimate.*pose variables are added without checking.Suggestion
Add
log.names()checks before adding variables, or wrap the setup in a try/except that gracefully disables the corresponding UI elements when variables are unavailable. This would make the client more robust against firmware variations.Affected locations
src/cfclient/ui/tabs/FlightTab.py—_stream_motors()src/cfclient/ui/main.py—_stream_battery()src/cfclient/ui/pose_logger.py—_stream_loop()Context
Raised during Copilot review of PR #792.