Skip to content

feat: alarm descriptions and proportional pressure mode fix#18

Merged
eman merged 4 commits intomainfrom
release/0.4.0
Feb 21, 2026
Merged

feat: alarm descriptions and proportional pressure mode fix#18
eman merged 4 commits intomainfrom
release/0.4.0

Conversation

@eman
Copy link
Copy Markdown
Owner

@eman eman commented Feb 20, 2026

Summary

Two bug fixes targeting the 0.4.0 release:

Alarm/warning descriptions from ERROR_CODES (device_info.py, formatters.py)

Previously read_alarms() returned only raw numeric codes in active_alarms/active_warnings. Now alarm_description and warning_description are populated by looking up each active code in ERROR_CODES, joining multiple codes as a comma-separated string. Unknown codes fall back to "Unknown (<code>)".

The CLI alarm panel (format_alarm_panel) was updated in parallel to render each active alarm/warning code with its description, replacing the previous single-code display.

Proportional Pressure mode byte (control.py)

_MODE_BYTE_MAP was missing the entry for PROPORTIONAL_PRESSURE (value 1, byte 0x01). Setting the pump to proportional pressure mode would previously raise a KeyError.

Changes

  • src/alpha_hwr/services/device_info.py – populate alarm_description/warning_description from ERROR_CODES in read_alarms()
  • src/alpha_hwr/services/control.py – add missing 1: 0x01 entry to _MODE_BYTE_MAP
  • src/alpha_hwr/cli/output/formatters.py – render multiple active alarm/warning codes with descriptions in the alarm panel
  • tests/unit/core/test_device_info_service.py – assert description fields and add unknown-code fallback test

GitHub Copilot and others added 2 commits February 14, 2026 19:08
Mode 1 (PROPORTIONAL_PRESSURE) was missing from _MODE_BYTE_MAP, causing
it to default to 0x02 (Constant Speed). The correct mode_byte is 0x01,
matching the entry in _MODE_SUFFIX_MAP. Without this fix, setting
Proportional Pressure mode silently sends a Constant Speed command.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- device_info.py: Populate alarm_description/warning_description fields
  in AlarmInfo using ERROR_CODES lookup from constants.py
- formatters.py: Show per-code descriptions in alarm panel using
  ERROR_CODES lookup, support active_alarms/active_warnings lists
- Fix Proportional Pressure mode_byte (1: 0x01) in _MODE_BYTE_MAP

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves how alarms/warnings and proportional-pressure mode are represented and displayed, supporting the 0.4.0 release by making alarm output more informative and fixing a control-mode mapping.

Changes:

  • Add ERROR_CODES lookups to populate alarm/warning descriptions from active code lists.
  • Fix ControlService mode-byte mapping for PROPORTIONAL_PRESSURE (mode value 1).
  • Update CLI alarm panel formatting to render multiple active alarm/warning codes with descriptions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/alpha_hwr/services/device_info.py Builds alarm_description / warning_description strings from active alarm/warning codes using ERROR_CODES.
src/alpha_hwr/services/control.py Adds missing _MODE_BYTE_MAP entry for proportional pressure (value 1).
src/alpha_hwr/cli/output/formatters.py Formats alarm panels using active_alarms / active_warnings with ERROR_CODES descriptions.

- Fix ruff format violation in device_info.py
- Add assertions for alarm_description/warning_description in test_read_alarms
- Add test_read_alarms_unknown_code_fallback for unmapped error codes
@eman eman changed the title Release/0.4.0 feat: alarm descriptions and proportional pressure mode fix Feb 21, 2026
- Update version in pyproject.toml, __init__.py, mkdocs.yml, docs/index.md, .bumpversion.cfg
- Add CHANGELOG.md entry for 0.5.0 release
@eman eman merged commit 4e0e156 into main Feb 21, 2026
6 checks passed
@eman eman deleted the release/0.4.0 branch February 21, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants