Skip to content

Updates for Audio System#36

Merged
KenVanHoeylandt merged 4 commits into
TactilityProject:mainfrom
Shadowtrance:updates-fixes
Jul 19, 2026
Merged

Updates for Audio System#36
KenVanHoeylandt merged 4 commits into
TactilityProject:mainfrom
Shadowtrance:updates-fixes

Conversation

@Shadowtrance

@Shadowtrance Shadowtrance commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

And fix media keys after BT disabled change.

Summary by CodeRabbit

  • New Features
    • Added EspNowBridge app for ESP-NOW co-processor firmware updates with on-device UI, including version validation, status, and progress.
  • Bug Fixes
    • Media Keys now more reliably handles Bluetooth/HID startup and cleanup when switching the app on/off.
    • Sound enable/disable is applied immediately on app startup.
  • Changes
    • Sound playback now uses the device/system output volume for loudness (no in-engine volume presets).
  • Documentation
    • Updated sound engine guidance to reflect system-controlled volume handling.

And fix media keys after BT disabled change.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03709d18-811c-4df3-828a-7aa6761109d3

📥 Commits

Reviewing files that changed from the base of the PR and between cf6167b and 1a31db9.

📒 Files selected for processing (4)
  • .github/workflows/main.yml
  • Apps/EspNowBridge/main/Source/EspNowBridge.cpp
  • Apps/EspNowBridge/main/Source/EspNowBridge.h
  • Libraries/SfxEngine/Source/SfxEngine.cpp
🚧 Files skipped from review as they are similar to previous changes (3)
  • Apps/EspNowBridge/main/Source/EspNowBridge.h
  • Libraries/SfxEngine/Source/SfxEngine.cpp
  • Apps/EspNowBridge/main/Source/EspNowBridge.cpp

📝 Walkthrough

Walkthrough

SfxEngine now uses the platform audio stream output instead of I2S, scales audio using cached system volume and enabled state, and removes app-level volume controls. Breakout and TamaTac no longer apply volume presets. MediaKeys centralizes Bluetooth cleanup, tracks device startup state, initializes devices through generic device APIs, responds to existing radio state, and auto-enables Bluetooth handling when shown. A new EspNowBridge application adds firmware validation, asynchronous co-processor OTA transfers, LVGL progress handling, WiFi lifecycle integration, build configuration, registration, and manifest metadata.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the changes, but it is too broad to convey the main scope of the pull request. Use a more specific title that mentions the audio backend overhaul and MediaKeys Bluetooth cleanup, e.g. 'Switch SfxEngine to audio_stream and refactor MediaKeys Bluetooth teardown.'
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8ced6a1c-6bda-48ab-bbe9-b7785c2b79fb

📥 Commits

Reviewing files that changed from the base of the PR and between 8721a65 and 63b647a.

📒 Files selected for processing (7)
  • Apps/Breakout/main/Source/Breakout.cpp
  • Apps/MediaKeys/main/Source/MediaKeys.cpp
  • Apps/MediaKeys/main/Source/MediaKeys.h
  • Apps/TamaTac/main/Source/TamaTac.cpp
  • Libraries/SfxEngine/Include/SfxEngine.h
  • Libraries/SfxEngine/README.md
  • Libraries/SfxEngine/Source/SfxEngine.cpp
💤 Files with no reviewable changes (2)
  • Apps/TamaTac/main/Source/TamaTac.cpp
  • Apps/Breakout/main/Source/Breakout.cpp

Comment thread Libraries/SfxEngine/Source/SfxEngine.cpp

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
Apps/EspNowBridge/main/Source/EspNowBridge.h (1)

88-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider using std::function for UI dispatch.

Using std::function<void(EspNowBridge&)> instead of C-style callbacks allows callers to use capturing lambdas. This eliminates the need for manual void* context management, custom freeContext cleanup functions, and boilerplate static wrapper functions, significantly improving type safety and readability.

♻️ Proposed refactor

Update the header to include <functional> and change the signature:

 `#include` <optional>
 `#include` <string>
+#include <functional>
 
 `#include` <freertos/FreeRTOS.h>
     /** Marshal a UI-touching closure onto the LVGL task. Only ever invoked if liveInstance_ is
      *  still this instance (checked at dispatch time and again right before running, on the LVGL
      *  task) and isShown_ is true (this app's widget tree exists). */
-    void dispatchToUi(void (*work)(EspNowBridge&, void*), void* context, void (*freeContext)(void*));
+    void dispatchToUi(std::function<void(EspNowBridge&)> work);

For reference, the implementation in EspNowBridge.cpp can be updated as follows:

void EspNowBridge::dispatchToUi(std::function<void(EspNowBridge&)> work) {
    struct UiDispatchPayload {
        EspNowBridge* instance;
        std::function<void(EspNowBridge&)> work;
    };
    
    auto* payload = new UiDispatchPayload{this, std::move(work)};
    
    bool locked = tt_lvgl_lock(TT_LVGL_DEFAULT_LOCK_TIME);
    lv_result_t result = lv_async_call([](void* userData) {
        auto* payload = static_cast<UiDispatchPayload*>(userData);
        if (EspNowBridge::liveInstance_.load() == payload->instance && payload->instance->isShown_.load()) {
            payload->work(*payload->instance);
        }
        delete payload;
    }, payload);
    
    if (locked) {
        tt_lvgl_unlock();
    }
    
    if (!locked || result != LV_RESULT_OK) {
        delete payload;
    }
}

This allows callers to write simple capturing lambdas like dispatchToUi([parseError](EspNowBridge& app) { app.setStatus(parseError); });.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8a3985e1-b760-4c68-abeb-17fb91681744

📥 Commits

Reviewing files that changed from the base of the PR and between 63b647a and cf6167b.

⛔ Files ignored due to path filters (1)
  • Apps/EspNowBridge/assets/espnow_bridge_slave_c6.bin is excluded by !**/*.bin
📒 Files selected for processing (6)
  • Apps/EspNowBridge/CMakeLists.txt
  • Apps/EspNowBridge/main/CMakeLists.txt
  • Apps/EspNowBridge/main/Source/EspNowBridge.cpp
  • Apps/EspNowBridge/main/Source/EspNowBridge.h
  • Apps/EspNowBridge/main/Source/main.cpp
  • Apps/EspNowBridge/manifest.properties

Comment thread Apps/EspNowBridge/main/Source/EspNowBridge.cpp
Comment thread Apps/EspNowBridge/main/Source/EspNowBridge.cpp
Comment thread Apps/EspNowBridge/main/Source/EspNowBridge.cpp
@KenVanHoeylandt

KenVanHoeylandt commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Looks good, thanks!

@KenVanHoeylandt
KenVanHoeylandt merged commit 25b966a into TactilityProject:main Jul 19, 2026
21 checks passed
@Shadowtrance
Shadowtrance deleted the updates-fixes branch July 19, 2026 20:06
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