Skip to content

chore(radio): remove 20% deadband for low volume#7347

Open
3djc wants to merge 6 commits into
mainfrom
3djc/improve-audio-volume
Open

chore(radio): remove 20% deadband for low volume#7347
3djc wants to merge 6 commits into
mainfrom
3djc/improve-audio-volume

Conversation

@3djc
Copy link
Copy Markdown
Collaborator

@3djc 3djc commented May 8, 2026

This improves settings sound level by special function or sound settings by source. It reduces the dead band before any sound can be played (previously volume was set a 0 until at least -80%)

This also simplifies the mechanic when hardware needs a fixed volume limitation

Summary by CodeRabbit

  • Bug Fixes

    • More immediate speaker volume updates by replacing hysteresis with a deadzone-based input filter.
    • Removed internal volume scaling so headphone volume matches the user-set level.
    • Lowered minimum volume threshold for improved low-volume audio fidelity.
  • New Features

    • Added trace logging for volume changes to aid diagnostics.
  • Chores

    • Introduced configurable/default max volume handling and standardized per-target max volume to 20 for affected transmitters.

Review Change Stack

@3djc 3djc changed the title chore: remove 20% deadband for low volume chore(radio): remove 20% deadband for low volume May 8, 2026
@3djc 3djc added enhancement ✨ New feature or request backport/2.12 To be backported to a 2.12 release also. labels May 8, 2026
@pfeerick pfeerick added the firmware General radio firmware issue, not colorlcd or B&W specific label May 11, 2026
@pfeerick pfeerick added this to the 2.12.2 milestone May 11, 2026
@pfeerick
Copy link
Copy Markdown
Member

@coderabbitai review please

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

@pfeerick Sure, I'll review the changes in this PR now!

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f4d725c6-aa29-4c1d-9fda-920a7655474f

📥 Commits

Reviewing files that changed from the base of the PR and between ea083b5 and 952abfa.

📒 Files selected for processing (1)
  • radio/src/hal/audio_driver.h

📝 Walkthrough

Walkthrough

Refactors speaker volume input from hysteresis to a deadzone-based mapping, adds per-target VOLUME_LEVEL_MAX overrides, lowers TAS2505 VOLUME_MIN_DB with added trace logging, and has the board driver pass unscaled volume to the TAS2505 driver.

Changes

Audio Volume Control Refactor

Layer / File(s) Summary
Volume Configuration & Constants
radio/src/hal/audio_driver.h, radio/src/targets/tx15/hal.h, radio/src/targets/tx16smk3/hal.h
Added guidance comment and made VOLUME_LEVEL_MAX/VOLUME_LEVEL_DEF conditional (#ifndef) so targets can override; tx15 and tx16smk3 now #undef/#define VOLUME_LEVEL_MAX 20. I2S DMA macros reformatted.
Core Volume Input Processing
radio/src/edgetx.cpp
calcVolumeValue() replaced hysteresis-based, stateful update with a deadzone-based computation using VOLUME_SOURCE_DEADZONE; removed requiredSpeakerVolumeRawLast.
TAS2505 Driver Volume Control
radio/src/drivers/tas2505.cpp
Lowered VOLUME_MIN_DB from 60 to 45 and added a TRACE log at start of tas2505_set_volume() showing volume and headphone_mode; clamping/register writes unchanged.
Audio Board Driver Integration
radio/src/boards/rm-h750/audio_driver.cpp
Removed unused timers_driver.h include; audioSetVolume() now forwards the unscaled volume to tas2505_set_volume() (headphone detection unchanged).
sequenceDiagram
  participant Input as User/Input
  participant EdgeTX as edgetx::calcVolumeValue
  participant Board as rm-h750::audioSetVolume
  participant Driver as tas2505::tas2505_set_volume
  participant Chip as TAS2505_IC

  Input->>EdgeTX: centered input (1024 + getValue)
  EdgeTX->>EdgeTX: apply deadzone -> compute requiredSpeakerVolume
  EdgeTX->>Board: audioSetVolume(requiredSpeakerVolume)
  Board->>Driver: tas2505_set_volume(volume, audioHeadphoneDetect())
  Driver->>Chip: set digital volume / write registers
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped along the audio stream,
Found deadzones where the signals dream,
The driver hums with quieter dB,
Boards pass volumes true and free,
A tiny rabbit claps—hooray, sound gleams! 🎶

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. It lacks the required 'Fixes #' section from the template and does not follow the standard 'Summary of changes:' structure. Add 'Fixes #' issue reference and structure the description to match the template format with 'Summary of changes:' section.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing the volume deadband that prevented sound at low levels.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 3djc/improve-audio-volume

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

coderabbitai[bot]

This comment was marked as resolved.

@pfeerick

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/2.12 To be backported to a 2.12 release also. enhancement ✨ New feature or request firmware General radio firmware issue, not colorlcd or B&W specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants