Skip to content

bug(capabilities): Core never reads protobuf field 22, so its enabled-channel view can drift from the device and stale the rate cap #409

Description

@tylerkron

Summary

Core's idea of which analog channels are enabled is purely what Core itself commanded. It never reads the device's own answer — protobuf field 22, analog_in_port_enabled — so the two can drift, and anything derived from the enabled set is then wrong.

This is scope item 7 of #390, split out because #390 is now closed by #404 and item 7 was deliberately left out of that PR.

Trace (current main, verified after #404 merged)

  • No reference to analog_in_port_enabled / AnalogInPortEnabled anywhere outside the generated protobuf class.
  • Channels are always constructed disabled — DaqifiDevice.cs:1905 and :1988 both set IsEnabled = false.
  • So IsEnabled only ever becomes true because Core set it.

Why it matters

#404 landed the capability document, whose current_max_rate_hz is computed by the device from the device's enabled set. Core caches that value. If Core's enabled view and the device's disagree — a channel enabled by another session, state surviving a reconnect, a partially-applied command — the cached cap is wrong, and Core will either refuse a rate the device would accept or accept one it will reject with SCPI -222.

The drift window is real now in a way it was not before #404: previously the enabled set was only used for Core's own bookkeeping; now a device-computed number depends on it.

Suggested direction

Either:

  1. Parse field 22 from the status message and use it as the source of truth for IsEnabled, the way part numbers already drive DeviceCapabilities; or
  2. Re-read the capability document at every point the enabled set changes, so the cap is never stale relative to the enabled set.

(1) is the cheaper and more direct answer — the data is already arriving in every status frame and is simply being dropped. (2) costs a SCPI round-trip per change.

Worth confirming on the bench that field 22 is actually populated by firmware ≥ v3.5.0 before building on it.

Refs: #390 (scope item 7), #404, #256, ADR 0001, daqifi-desktop#118.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions