Repository navigation
DEV-1413: Shimmer3R sound level channel (0x38), and keep configuration byte 233 on a full write - #346
Conversation
…a full write Decode the Shimmer3R sound level channel: ID 0x38, a signed 16-bit little-endian count of 0.01 dB(A), LAeq over the microphone's most recent 128 ms block. 0x8000 means no level and calibrates to NaN. The decoder takes the channel's position from the channel list (inquiry response or SD header), like any other channel. A Shimmer3 never sends 0x38 and keeps the unknown-channel handling. The channel is enabled through configuration byte 233 bit 4, not a sensor bitmap bit. A new SensorSoundLevel (Shimmer3R only) owns the byte: its config hooks take the enable from bit 4 and give back bits 0-3 (the audio mode and gain preset) as read. A full configuration write builds its image from zeros, so until now it wrote 0 to byte 233 and also turned off a Shimmer3R's audio recording. Bit 7 set (erased flash) reads as 0, as the firmware reads it. A Shimmer3's byte 233 stays 0. Tests: API_00040 (ShimmerDriver) covers decoding at the spec position and elsewhere, the no-level value, SD, Shimmer3, and every value of byte 233. API_00041 (ShimmerDriverPC) covers the byte surviving deepClone() and decoding with the arrays data structure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…evel SensorSoundLevel's javadoc names LogAndStream_Shimmer3R v1.01.026, and the firmware without byte 233 as the releases before it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…1.026 Releases before v1.01.026 store configuration byte 233 untouched, so on them bit 4 read back set while no channel was sent: the Sound Level tile showed on, and nothing arrived. The bit also stayed in the unit, so a later firmware update would turn the channel on unasked. The sensor's compatibility list is now Shimmer3R LogAndStream v1.01.026 and later, so the tile is offered only there. On older firmware a bit 4 already set reads as off and the next configuration write clears it. Bits 0-3, the audio mode the full write used to wipe, are kept on every Shimmer3R firmware as before. API_00040 runs at v1.01.026 and adds three tests at v1.01.025: the tile is not offered, a stored bit 4 reads off and is cleared on write, and enabling sets nothing. Without the gate all three fail. ShimmerDriver 195/195, ShimmerDriverPC 105/105, on JDK 11. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Pushed a09a0d4: the sound level is now offered only from LogAndStream_Shimmer3R v1.01.026. Why: releases before v1.01.026 store byte 233 untouched, so there bit 4 read back set with no channel behind it. The tile showed on and nothing arrived, which fails DEV-1459's check ("hidden or reads back off" on firmware without the channel). The bit also stayed in the unit, so a later firmware update would switch the channel on unasked. What changed:
One more point, not changed here: the firmware spec (INFOMEM §8.5) and the Rust host library read a byte with a reserved gain preset (bits 2-3 not 0) as 0: nothing recorded, sound level off. This PR treats only bit 7 as invalid, so for example 0x14 reads as sound level on. Firmware with the byte corrects it before it's read back, so the effect is small, but |
…, audio status (#354) The Java Shimmer Capture app gets the microphone half of shimmer-host-core's CAPTURE.md "Event markers and audio recording", on the driver calls DEV-1459 brought to master (#353) and the sound level channel from DEV-1413 (#346). - EventMarkersFrame, now "Event markers and audio": configuration byte 233's audio recording mode (Off, Fingerprint only, Fingerprint and raw audio, Raw audio only) and Sound Level, written with the whole configuration and read back, then an inquiry for the channel list; Read audio status from READY. - Raw audio records speech: Write asks first where the new mode keeps raw audio and the unit's own does not, and writes nothing on No. The driver's raw audio switch is set for that one write and put back. - MicrophoneSettings: byte 233's rules without Swing, so they are tested. - Device tab: the status's Recording audio and Audio fault flags where the unit records audio, and whether the firmware has the event markers and audio recording. - CaptureRulesTest: 11 tests, byte 233 as written checked on a ShimmerPC. - README. Co-authored-by: Claude Opus 5.5 <[email protected]>
DEV-1413. Adds the Shimmer3R sound level channel to the driver. It also fixes an existing defect: a full configuration write zeroed configuration byte 233, which turned off the Shimmer3R's audio recording.
The channel (spec)
0x38, Shimmer3R only. 2 bytes, signed 16-bit little-endian.0x8000(-32768) means no level. That covers about the first 256 ms while capture settles, and capture that is stopped or has failed. CAL isNaN, never -327.68. UNCAL stays the raw count.0x4000) was deliberately not used: the SD path reads it asSDLogHeader.ECG_TO_HR_FW.Firmware that has the byte but not the channel clears bit 4, so support = write and read back.
Byte 233 fix
ShimmerObject.configBytesGenerate()builds the image it writes from zeros, so every full write from Consensys or Android put 0 in byte 233 and switched a Shimmer3R's audio mode off. Byte 233 is now modelled inConfigByteLayoutShimmer3(idxAudioConfig, Shimmer3R only) and owned by the newSensorSoundLevel:0xFF) is treated as 0, as the firmware treats it.Changes
sensors/soundlevel/SensorSoundLevel(new, Shimmer3R only):SHIMMER_SOUND_LEVEL= 45, object-cluster nameSound_Level, unitCHANNEL_UNITS.DECIBELS_A(dB(A), new);LABEL_SENSOR_TILE, so existing ordinals don't move;ShimmerObject:0x38arm ininterpretDataPacketFormat()(i16);buildMsg(), keyed on the channel being in the list rather than on a bitmap bit;I kept this away from the lines #343 (DEV-971, byte 232) and #345 (DEV-1431) touch. A trial merge with each, and with #293, is clean.
Tests
No hardware.
API_00040_SoundLevelChannelTest(ShimmerDriver, 14 tests):0x8000no-level value, signed values, an SD-type packet;0x38;API_00041_SoundLevelShimmerPCTest(ShimmerDriverPC, 2 tests): byte 233 survivesdeepClone(), the copy Consensys writes from, and decoding works with the arrays data structure.Shimmer-Java-Android-API).Sibling APIs (same wire format)
shimmer-web-sdk): done in DEV-1413: Shimmer3R sound-level channel 0x38 and byte 233 bit 4 (0.5.13) shimmer-web-sdk#230, merged. Our internal host library is being updated in parallel too.Shimmer-C-API): the decode is DEV-1413: decode the Shimmer3R sound level channel (0x38) Shimmer-C-API#232. Also check whether its configuration write keeps byte 233. The LabVIEW wrapper follows the C# API.SwiftAPI): the decode is DEV-1413: decode the Shimmer3R sound level channel (0x38) SwiftAPI#29.0x38cannot be decoded there at all.processDataPacket(). It needs a driver release and a pin bump to get this.Not covered
🤖 Generated with Claude Code