Repository navigation
DEV-1163 Read the Shimmer3R LN accel range from the SD header - #215
Merged
Merged
Conversation
The Shimmer3R branch of ProcessSDLogHeader never called SetLNAccelRange, so GetLNAccelRange() reported +/-2g for every SD log. The range is in header byte 11, bits 7:6. A populated LN calibration block in the header was used as-is, so those numbers were right. A blank block (all 0x00, or -1 sensitivity) fell back to the default for LNAccelRange, the +/-2g sensitivity, so LN values came out 2x, 4x or 8x too small at +/-4g, +/-8g or +/-16g. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the header format and is covered across all supported ranges and calibration paths.
0 open findings
What changed in this PR
Fixes Shimmer3R SD-log parsing so LN accelerometer range and fallback calibration match the recorded configuration.
Changes:
- Parses LN range from header byte 11.
- Adds coverage for all ranges, blank calibration, and custom calibration.
- Registers the new tests.
Sibling check: Java fixes are referenced; no duplicate C# SD parser requires updating.
| File | Description |
|---|---|
ShimmerAPI/ShimmerAPI/ShimmerSDLog.cs |
Reads the Shimmer3R LN range before calibration parsing. |
ShimmerAPI/ShimmerUnitTests/ShimmerSDLogLnAccelRangeTest.cs |
Tests range parsing and calibration behavior. |
ShimmerAPI/ShimmerUnitTests/ShimmerUnitTests.csproj |
Includes the new test file. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Shimmer3R branch of
ShimmerSDLog.ProcessSDLogHeadernever calledSetLNAccelRange, soGetLNAccelRange()reported ±2g for every Shimmer3R SD log whatever range the low-noise accel (LSM6DSV) was recorded at. The range is in config setup byte 3 (header byte 11), bits 7:6. The fix reads it there, before the LN calibration block is parsed.Effect before this fix
RetrieveKinematicCalibrationParametersFromPacketfalls back to the default sensitivity forLNAccelRange. That was always the ±2g value (1672), so LN values came out 2×, 4× or 8× too small at ±4g, ±8g or ±16g.The Java parser had the same defect. It is fixed in ShimmerResearch/Shimmer-Advance-API#499 and ShimmerResearch/Shimmer-Java-Android-API#322.
Testing
New
ShimmerSDLogLnAccelRangeTest(added toShimmerUnitTests.csproj) builds Shimmer3R SD files by hand and checks three things:All three fail without the fix. The full
ShimmerAPITest.slnsuite (31 tests) passes with MSBuild and VSTest, as in CI.Shimmer-Labview-API wraps this API and picks the fix up on its next rebuild.
🤖 Generated with Claude Code