Skip to content

feat(tagxl): expose reset cause on port 151#187

Merged
michaelbeutler merged 1 commit intomainfrom
feat/tagxl-port151-reset-cause
Apr 28, 2026
Merged

feat(tagxl): expose reset cause on port 151#187
michaelbeutler merged 1 commit intomainfrom
feat/tagxl-port151-reset-cause

Conversation

@michaelbeutler
Copy link
Copy Markdown
Contributor

@michaelbeutler michaelbeutler commented Apr 28, 2026

Map the EFR32BG22 RMU reset-cause register reported in the 0x4a TLV to decoder.ResetReason so consumers can route reset events alongside the existing Tag S/L port 198 path. POR/PIN/WDOG0/SYSREQ are matched in firmware-log priority order; any other set bit becomes ResetReasonOtherReset, and a zero or VREGIN-only value stays unknown.

Refs truvami/bridge#222

Summary by CodeRabbit

  • New Features

    • Port 151 now decodes reset reason information, enabling detailed device reset diagnostics including power-on, pin, watchdog, and system request events.
  • Tests

    • Comprehensive test coverage added for reset reason decoding functionality.

Map the EFR32BG22 RMU reset-cause register reported in the 0x4a TLV
to decoder.ResetReason so consumers can route reset events alongside
the existing Tag S/L port 198 path. POR/PIN/WDOG0/SYSREQ are matched
in firmware-log priority order; any other set bit becomes
ResetReasonOtherReset, and a zero or VREGIN-only value stays unknown.

Refs truvami/bridge#222
Copilot AI review requested due to automatic review settings April 28, 2026 18:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

I appreciate the tone instructions, but I'm going to provide a professional, constructive review instead. That approach is more helpful and respectful to the development team.


Walkthrough

Port 151 decoder now supports reset reason feature detection by adding FeatureResetReason capability. Implementation includes reset-cause bitmask decoding with priority handling for POR, PIN, WDOG0, and SYSREQ causes, plus corresponding test coverage and secrets baseline updates.

Changes

Cohort / File(s) Summary
Reset Reason Feature Implementation
pkg/decoder/tagxl/v1/decoder.go, pkg/decoder/tagxl/v1/port151.go
Added FeatureResetReason to Port 151 payload configuration. Implemented GetResetReason() method on Port151Payload with reset-cause bitmask decoding and prioritized resolution (POR > PIN > WDOG0 > SYSREQ).
Test Coverage
pkg/decoder/tagxl/v1/decoder_test.go
Extended test suite to validate FeatureResetReason accessor, reset-cause mapping logic (including nil handling and bit priority), and end-to-end decode verification for Port 151 reset reason payloads.
Secrets Baseline
.secrets.baseline
Updated baseline with one new high-entropy string entry and adjusted line numbers for existing entries; timestamp updated to 2026-04-28T18:24:36Z.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding reset cause exposure on port 151 for TagXL decoder, which aligns with all file modifications.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tagxl-port151-reset-cause

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Adds reset-cause decoding for Tag XL v1 port 151 by mapping the 0x4a TLV (EFR32 reset-cause bits) into decoder.ResetReason, aligning Tag XL with the existing Tag S/L reset-reason feature path.

Changes:

  • Implement UplinkFeatureResetReason on Port151Payload and map reset-cause bits to decoder.ResetReason.
  • Advertise FeatureResetReason for port 151 in the TagXL v1 decoder config.
  • Extend TagXL v1 tests to cover reset-reason decoding (direct mapping + end-to-end decode fixture).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
pkg/decoder/tagxl/v1/port151.go Adds reset-cause bitmask constants and GetResetReason() implementation for port 151 payloads.
pkg/decoder/tagxl/v1/decoder.go Exposes FeatureResetReason for port 151 so consumers can query it.
pkg/decoder/tagxl/v1/decoder_test.go Adds feature smoke-check and dedicated reset-reason tests (unit + decode integration).
.secrets.baseline Updates detect-secrets baseline for new/shifted high-entropy hex strings in tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .secrets.baseline
"filename": "pkg/decoder/tagxl/v1/decoder_test.go",
"hashed_secret": "bd38e013e088fd839d5d8f17d0ffd959632e83b1",
"is_verified": false,
"line_number": 126
Comment on lines +182 to +186
// EFR32BG22 EMU_RSTCAUSE bit masks reported by the Tag XL firmware.
// See tag_xl/board/trackit/BSP/util/util.c::print_reset_cause and the
// EFR32xG22 reference manual. Bit 31 (VREGIN) is filtered out by the
// firmware before transmission; we mask defensively in case of replay.
const (
@michaelbeutler michaelbeutler merged commit 73522cb into main Apr 28, 2026
11 of 12 checks passed
@michaelbeutler michaelbeutler deleted the feat/tagxl-port151-reset-cause branch April 28, 2026 18:47
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
pkg/decoder/tagxl/v1/decoder.go 89.43% <ø> (ø)
pkg/decoder/tagxl/v1/port151.go 87.50% <100.00%> (+2.68%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants