Skip to content

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

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

chore(radio): remove 20% deadband for low volume#7347
3djc wants to merge 5 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

    • Standardized per-target maximum 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b3583a2-2f8f-4f98-8336-d3e10da769d6

📥 Commits

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

📒 Files selected for processing (3)
  • radio/src/hal/audio_driver.h
  • radio/src/targets/tx15/hal.h
  • radio/src/targets/tx16smk3/hal.h
✅ Files skipped from review due to trivial changes (1)
  • radio/src/hal/audio_driver.h
🚧 Files skipped from review as they are similar to previous changes (2)
  • radio/src/targets/tx15/hal.h
  • radio/src/targets/tx16smk3/hal.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 comment about undefining/redefining VOLUME_LEVEL_MAX per target; tx15 and tx16smk3 now #undef and #define VOLUME_LEVEL_MAX 20. I2S DMA macros reformatted.
Core Volume Input Processing
radio/src/edgetx.cpp
calcVolumeValue() replaced hysteresis/stateful update with a deadzone-based computation using VOLUME_SOURCE_DEADZONE; removed requiredSpeakerVolumeRawLast.
TAS2505 Driver Volume Control
radio/src/drivers/tas2505.cpp
VOLUME_MIN_DB changed from 60 to 45; added TRACE logging in tas2505_set_volume() for volume and headphone_mode.
Audio Board Driver Integration
radio/src/boards/rm-h750/audio_driver.cpp
Removed unused timers_driver.h include; audioSetVolume() now passes the unscaled volume directly to tas2505_set_volume() (headphone detection unchanged).

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 | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: removing a 20% deadband for low volume, which directly matches the core modification in calcVolumeValue() and related volume handling updates across multiple files.
Description check ✅ Passed The description adequately explains the changes: it specifies the improvement to sound level behavior, clarifies the deadband reduction from -80% to 0%, and mentions simplification of hardware volume limitation mechanics. While it doesn't follow the template structure exactly, it provides sufficient context for understanding the PR intent.
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