Skip to content

Feature/audio response#228

Open
DennisMoschina wants to merge 14 commits into
2.2.4from
feature/audio-response
Open

Feature/audio response#228
DennisMoschina wants to merge 14 commits into
2.2.4from
feature/audio-response

Conversation

@DennisMoschina

Copy link
Copy Markdown
Collaborator

No description provided.

DennisMoschina and others added 7 commits June 9, 2026 11:36
…Service

- Removed the seal_check_service.c and seal_check_service.h files.
- Added audio_response_service.h to define the audio response service interface.
- Updated main.cpp to initialize the audio response service instead of the seal check service.
@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@github-actions

Copy link
Copy Markdown

Build output available:
openearable_v2_firmware.elf.zip
openearable_v2_fota.zip

@DennisMoschina
DennisMoschina marked this pull request as ready for review July 27, 2026 07:26
@DennisMoschina
DennisMoschina requested a review from Copilot July 27, 2026 07:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new BLE “audio response” measurement feature that uploads an audio buffer over GATT, plays it through the codec, captures microphone data, and reports a frequency response result; it also introduces supporting audio-system suspend/resume and decimator refactors to make the measurement run safely alongside existing audio features.

Changes:

  • Added a new audio_response_service GATT service, including Kconfig limits for upload size and response points, and initialization wiring.
  • Refactored audio decimation to avoid dynamic allocation and added audio-system suspension APIs used by the measurement flow.
  • Tightened error handling/logging and performed small cleanups across SD logging, power/battery code, and CI checkout (submodules).

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
unicast_server/main.cpp Initializes the new audio response service at boot.
src/SensorManager/SensorManager.cpp Adds error logging when SDLogger start fails.
src/SD_Card/SDLogger/SDLogger.h Removes dead commented code and improves API docs.
src/ParseInfo/ParseType.h Makes parseTypeSizes internal (static) to avoid multiple definitions.
src/modules/hw_codec_adau1860.cpp Adds settle delays around codec enable/stop for stability.
src/bluetooth/Kconfig Adds Kconfig options for audio response buffer sizing and points limit.
src/bluetooth/gatt_services/led_service.cpp Removes stale commented debug prints.
src/bluetooth/gatt_services/CMakeLists.txt Builds the new audio_response_service.c.
src/bluetooth/gatt_services/audio_response_service.h Declares audio response service init + capture completion hook.
src/bluetooth/gatt_services/audio_response_service.c Implements upload/commit/abort + measurement orchestration + notifications.
src/Battery/PowerManager.cpp Removes large commented-out block; minor formatting cleanup.
src/Battery/BQ25120a.cpp Removes commented debug lines.
src/audio/streamctrl.c Updates call site to handle audio_system_start() returning an error.
src/audio/decimation_filter.h Refactors decimator types (fixed-capacity), adds compile-time sizing checks.
src/audio/decimation_filter.cpp Implements new fixed-capacity decimator config/cleanup and processing path.
src/audio/audio_system.h Adds suspend/resume APIs and changes audio_system_start() to return int.
src/audio/audio_system.c Implements suspend/resume state handling and improved startup error propagation.
src/audio/audio_datapath.h Adds buffer play/record APIs + auxiliary suspend/resume; fixes audio_datapath_release(void).
src/audio/audio_datapath.c Adds buffer record/play and auxiliary suspend/resume state preservation.
src/audio/audio_datapath_decimator.cpp Removes heap allocation; uses fixed-capacity CascadedDecimator.
prj.conf Enables CMSIS-DSP features; sets audio response max samples.
prj_fota.conf Enables CMSIS-DSP features; sets audio response max samples.
include/openearable_common.h Removes stray blank line.
CMakeLists.txt Adds protocol generated C subdir and links protocol library into app.
.gitmodules Adds protocol git submodule.
.github/workflows/build_firmware.yaml Ensures CI checks out submodules recursively.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +145 to +147
/* Stage output alternates between this buffer and the caller's output. */
int16_t intermediate_buffer_[MAX_FRAMES];
float32_t processing_buffer_[MAX_FRAMES * 2];
Comment on lines 213 to 216
if (num_stages_ == 0) {
memcpy(output, input, num_frames * 2 * sizeof(int16_t));
return num_frames;
}
Comment on lines +759 to +770
}
LOG_DBG("Audio datapath acquired: id=%u", pending_config.id);
audio_session.datapath_acquired = true;
audio_session.measurement_codec_enabled = true;
ret = hw_codec_default_conf_enable();
if (ret != 0) {
LOG_ERR("Failed to enable codec for audio response measurement: %d", ret);
goto fail;
}
LOG_DBG("Codec enabled for audio response measurement: id=%u", pending_config.id);
ret = audio_datapath_buffer_play(transfer.samples, transfer.total_samples, false,
pending_config.volume, NULL);
Comment on lines +285 to +293
_record_buffer[buffer_index * 2] = decimated_audio[2 * i]; // Left
_record_buffer[buffer_index * 2 + 1] = decimated_audio[2 * i + 1]; // Right
}
} else if (_record_left) {
// Left channel only
_record_buffer[buffer_index] = decimated_audio[2 * i];
} else if (_record_right) {
// Right channel only
_record_buffer[buffer_index] = decimated_audio[2 * i + 1];
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