Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/embeddedci/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog — `embeddedci`

## Unreleased

- `Capabilities.scope` is False on the digital-only board. Current firmware lists `signal` on every
board; it only stands for the scope on firmware without the `analog` flag.

## 2.13.0

- `generate()` on firmware 3.9.1+ (`Capabilities.generate16`) sends the volts (or microamps on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ def from_status(cls, status: Mapping[str, Any]) -> "Capabilities":
caps = status.get("caps")
if isinstance(caps, (list, tuple)):
names = {str(x).lower() for x in caps}
c.scope = c.scope or ("signal" in names or "scope" in names)
# "signal" stood for the scope on firmware that predates the analog flag. Current
# firmware lists it on every board, the digital-only one included, and names "scope"
# itself, so it only counts when the status has no analog flag.
legacy = _as_bool(status, "analog") is None
c.scope = c.scope or "scope" in names or (legacy and "signal" in names)
c.analyzer = c.analyzer or ("la" in names or "analyzer" in names)
c.serial = c.serial or ("uart" in names or "serial" in names)
# The DAC/gateware features. Firmware advertises these in status.caps[] built from
Expand Down
21 changes: 21 additions & 0 deletions packages/embeddedci/tests/test_capabilities_scope.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Capabilities.scope from a pod's status: the digital-only board has no scope."""

from embeddedci.benchpod.capabilities import Capabilities


def test_digital_board_has_no_scope():
# Firmware 3.6+ lists "signal" on every board and names "scope" itself on the analog one.
status = {"board": "stm32h563", "adc_bits": 16, "analog": False,
"caps": ["signal", "gpio", "power", "la", "analyzer", "command"]}
assert Capabilities.from_status(status).scope is False


def test_analog_board_has_the_scope():
status = {"board": "stm32h563", "adc_bits": 16, "analog": True,
"caps": ["signal", "la", "analog", "scope", "dac"]}
assert Capabilities.from_status(status).scope is True


def test_firmware_without_the_analog_flag_keeps_signal_as_scope():
status = {"board": "stm32h563", "adc_bits": 16, "caps": ["signal", "la"]}
assert Capabilities.from_status(status).scope is True