Repository navigation
DEV-1338: decode a Shimmer3's alt accel as a big-endian int16 - #25
Merged
Merged
Conversation
HighGAccelSensor decoded channels 0x14-0x16 as i12MSB on every hardware. That is right for a Shimmer3R (the ADXL371's 12-bit value, left-justified). A Shimmer3 sends its MPU9x50/ICM-20948 accelerometer on those IDs as a plain big-endian int16 (log-and-stream-common SHIMMER3_STREAMING_DATA_FORMAT.md section 5), so it read at a sixteenth of its value. Decode it as i16MSB on Shimmer3, mirroring GyroSensor's per-hardware branch. Shimmer3R is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…there The int16 decode keys off HighGAccelSensor's HardwareVersion, but createSensors() rebuilt that sensor only for a Shimmer3R. On a Shimmer3 it kept the UNKNOWN default (or a Shimmer3R's from an earlier connection), so the 12-bit decode still ran on a real device. The Shimmer3 branch now builds it with the device's hardware version. A Shimmer3 also got a calibrated value, from the ADXL371 defaults that nothing replaces on that generation. The Java API defines this channel as raw only, since no calibration for it is stored anywhere, so this API now calibrates it on a Shimmer3R only. testSensorHighGAccelCalibratedOnlyOnShimmer3R covers the second change. The createSensors() line is not covered: Shimmer3Protocol cannot be constructed in a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JongChern
approved these changes
Nov 4, 2026
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.
What
HighGAccelSensor.processDatadecoded channels 0x14-0x16 asi12MSBon every hardware.docs/SHIMMER3_STREAMING_DATA_FORMAT.md§5). It was read at 1/16 of its value: -300 came out as -19.The fix decodes them as
i16MSBwhenHardwareVersionis Shimmer3, the same per-hardware branchGyroSensoruses. Shimmer3R is unchanged.Test
SensorTest.testSensorHighGAccelDecodePerGenerationcovers both generations: Shimmer3R resting counts (1, -5, -10) and Shimmer3 int16 values (-300, 1234, -16384).Not built or run locally: there is no Swift toolchain on Windows, so this PR's CI run is the first time the code compiles and the test runs.
Context
This is the same defect fixed in the web SDK (ShimmerResearch/shimmer-web-sdk#211). The log-and-stream-common HIL decoder had the related Shimmer3R byte-order bug (ShimmerResearch/log-and-stream-common#197). Java, C# and shimmer-host-core decode the Shimmer3R correctly, and give a Shimmer3 no width for these IDs at all.
🤖 Generated with Claude Code