Skip to content

feat(tagxl): ts2 GPS receiver config and port 10 hAcc/speed - #215

Open
StefanSmile wants to merge 3 commits into
mainfrom
feat/tagxl-ts2-gps-updates
Open

StefanSmile wants to merge 3 commits into
mainfrom
feat/tagxl-ts2-gps-updates

Conversation

@StefanSmile

@StefanSmile StefanSmile commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two ts2 firmware additions for Loros, both backwards compatible with older firmware.

Port 10 (active GNSS uplink): optional hAcc and speed

ts2 appends two bytes to the 20-byte payload:

Byte Field Notes
20 accuracy: horizontal accuracy estimate (hAcc) metres, capped at 255; also returned by GetAccuracy()
21 speed: speed over ground km/h

Both are optional fields: 20-byte uplinks decode as before with accuracy/speed = null; a 21-byte uplink gets only accuracy.

Why this is urgent: the released v1.6.0-rc4 rejects the new uplinks (payload length 22 is greater than maximum allowed length 20), so Loros on the hAcc firmware currently loses its active-GNSS positions. Port 10's max length is derived from the configured fields, so any byte added in future firmware will be rejected the same way until the decoder knows it (a test documents this).

The bridge stores GetAccuracy() as the position accuracy, so after the bridge bump Loros port 10 positions get a real accuracy.

Port 151 0xD2: GPS receiver config grows from 2 to 5 bytes

  • gpsDynamicModel: u-blox CFG-NAVSPG-DYNMODEL (0 portable, 2 stationary, 3 pedestrian, 4 automotive, 5 sea, 6–8 airborne, 9 wrist, 10 bike)
  • gpsStaticHoldSpeed: CFG-MOT speed threshold, cm/s (0 = off)
  • gpsStaticHoldDistance: CFG-MOT exit distance, m

The 2-byte reply from older firmware still decodes (new fields null); partial lengths fill only what's present; extra bytes are ignored.

Known firmware issue (unchanged here)

The new PUBX,00 parser reads fields 15/16/17 as PDOP/HDOP/VDOP, but in PUBX,00 they are HDOP/VDOP/TDOP. So the port 10 pdop byte currently carries HDOP. A firmware fix is pending; the decoder keeps decoding the byte as before.

Testing

  • Unit tests:
    • port 10 at 20/21/22 bytes, the 255 cap with speed 0, a 23-byte uplink rejected, JSON output
    • 0xD2 at 2/3/5/6 bytes
  • Locally green: go mod tidy -diff, gofmt, go vet ./..., staticcheck, make check-json-tags, make check-metrics, go test ./... (all packages)
  • Coverage: port10.go 100%, port151.go 92.1%, decoder.go 81.9% (threshold 75%)
  • End-to-end through the CLI for all lengths above, and confirmed rc4 rejects the 22-byte uplink
  • golangci-lint runs in CI only (not installed locally)

Summary by CodeRabbit

  • New Features
    • Port 10 payloads can now include horizontal accuracy and speed, displayed in meters and km/h. Older payloads without these values remain supported.
    • GPS receiver configuration reports now include dynamic model and static-hold settings when available, while retaining support for older reports.
  • Bug Fixes
    • Accuracy is now available through the payload’s accuracy accessor when included in a report.

ts2 firmware extends the 0xD2 GPS receiver reply from 2 to 5 bytes:
- gpsDynamicModel: u-blox CFG-NAVSPG-DYNMODEL (0 portable, 3 pedestrian, 4 automotive, ...)
- gpsStaticHoldSpeed: CFG-MOT speed threshold in cm/s (0 = off)
- gpsStaticHoldDistance: CFG-MOT exit distance in m

The 2-byte reply from older firmware still decodes; the new fields stay null.
ts2 firmware appends two bytes to the active GNSS uplink:
- byte 20: horizontal accuracy estimate (hAcc) in m, exposed via GetAccuracy
- byte 21: speed over ground in km/h

Both are optional: 20-byte uplinks from older firmware decode as before
with accuracy and speed left nil.
- port 10: hAcc capped at 255 with speed 0, and a 23-byte uplink rejected
  as too long (documents the max-length check)
- 0xD2: 3-byte reply (dynamic model only) and 6-byte reply (extra byte ignored)
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: e755c532-b1a4-4ee9-a7df-c5ce2d066151
📥 Commits

Reviewing files that changed from the base of the PR and between a9a361c and 11dbf95.

📒 Files selected for processing: 5
  • pkg/decoder/tagxl/v1/decoder.go
  • pkg/decoder/tagxl/v1/port10.go
  • pkg/decoder/tagxl/v1/port10_test.go
  • pkg/decoder/tagxl/v1/port151.go
  • pkg/decoder/tagxl/v1/port151_lte_gnss_test.go

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📝 Walkthrough

The Tag XL v1 decoder now reads optional accuracy and speed values from port 10 payloads. It also decodes additional GPS configuration values from port 151 reports.

Changes: Port 10 position data

Layer / File(s) Summary
Decode and expose optional position fields
pkg/decoder/tagxl/v1/decoder.go, pkg/decoder/tagxl/v1/port10.go, pkg/decoder/tagxl/v1/port10_test.go
Port 10 decodes optional accuracy and speed bytes. The payload exposes both values, JSON formats them as whole-number strings, and GetAccuracy returns accuracy. Tests cover missing fields, present fields, and unknown trailing bytes.

Port 151 GPS configuration

Layer / File(s) Summary
Decode optional GPS configuration
pkg/decoder/tagxl/v1/port151.go, pkg/decoder/tagxl/v1/port151_lte_gnss_test.go
The GPS constellation TLV decodes optional dynamic-model, static-hold speed, and static-hold distance values. Tests cover 2-, 3-, 5-, and 6-byte reports.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Possibly related issues

  • truvami/api issue 943: The decoder documentation and changes add payload details for accuracy and GPS configuration fields.
  • truvami/api issue 942: Port 10 now provides decoded accuracy for position data quality metrics.

Suggested reviewers: simylein

Merge Risk: ⚪ Minimal · up to 11dbf

No unresolved issue in the reviewed payload changes prevents merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 clearly and concisely identifies both main changes: TS2 GPS receiver configuration support and Port 10 horizontal accuracy and speed fields.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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 91.55% <100.00%> (+0.03%) ⬆️
pkg/decoder/tagxl/v1/port10.go 100.00% <100.00%> (ø)
pkg/decoder/tagxl/v1/port151.go 92.02% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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