Serialize sensor measurements with BLE sessions - #76
Merged
MacNite merged 2 commits intoSep 8, 2026
Merged
Conversation
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.
Motivation
Description
session_gateand APIslink_measurement_begin()/link_measurement_end()to serialise an entire powered measurement cycle against BLE sessions so a session either starts before a cycle or waits for it to finish.link_claim()non-blocking (returns busy when the gate is unavailable) and transferring long work to session threads; move audio rail enable +mic_stream_start()out of the GATT write callback into the audio capture thread.sensor_rail_userswithsensor_rail_lock) so each successfulpower_sensor_rail_enable()increments an owner count and the hardware is disabled only when the last matchingpower_sensor_rail_disable()runs.mic.hto state that the session gate guarantees exclusivity between the one-shot measurement path and streaming PDM capture, and ensure the main measurement loop now holds the session gate for the full cycle.Testing
git diff --checkand repository integrity checks were executed and reported no issues.west --sysbuildimages were not built becausewestwas unavailable in the execution environment, so the three configured build profiles and the firmware size delta could not be measured.Codex Task