Skip to content

Read back ASTRO A50 Gen 5 headset volume - #615

Merged
Sapd merged 2 commits into
Sapd:masterfrom
Mihuy1:feature/astro-a50-gen5-volume-readback
Oct 28, 2026
Merged

Sapd merged 2 commits into
Sapd:masterfrom
Mihuy1:feature/astro-a50-gen5-volume-readback

Conversation

@Mihuy1

@Mihuy1 Mihuy1 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Changes made

Reads back the ASTRO A50 Gen 5's hardware volume, using the readable-capabilities bitmask from #605. This is the read-back half of the plan agreed in #599; #600 added the setter.

  • ASTRO A50 Gen 5 (046d:0b1c): getHeadsetVolume() sends the GET 02 0c 03 00 08 0c and reads the level from byte 8 of the reply, 02 0c 06 00 08 0c <raw> 00 <0..21>. It's mapped back to 0–128 with mapDiscreteToSidetone<22>(), so a read-back round-trips through the setter. CAP_HEADSET_VOLUME is now in the A50's getReadableCapabilities().
  • Reply matching: frames with no payload are now skipped while waiting for a reply. A fire-and-forget SET leaves its bare ack (02 0c 03 00 08 1b) for the next reader, and without this a --volume right after a --volume 64 read that ack as level 0.
  • Validation: a level past 21, or a volume frame too short to hold byte 8, is a protocol error instead of a clamped or zero level.
  • Volume wheel: turning the wheel pushes the same frame with handle 0x00 (captured on hardware). A push that lands during a read carries the current level, so it's accepted; a test pins this down with a captured frame.
  • The README device table is regenerated with --readme-helper (A50 headset volume x → r).

Tested on a real A50 Gen 5: --volume reads level 9 (47), follows a SET down to level 7 (37) and back, and the wheel pushes were captured with --dev -- --receive while turning it both ways.

The PR has two commits: the read-back itself, and the wheel-push test.

Checklist

  • I adjusted the README (if needed)
  • For new features in HeadsetControl: I discussed it beforehand in Issues or Discussions and adhered to the wiki

Add getHeadsetVolume() for the A50 Gen 5 (CMD 0x08 GET, level 0..21 in
reply byte 8) and list CAP_HEADSET_VOLUME as readable.

Replies without a payload are now skipped when polling, so a previous
SET's ack isn't taken for the GET reply, and a volume reply too short to
hold byte 8 is a protocol error instead of level 0.

Verified on hardware: --volume reads level 9 and follows a SET to 7 and
back.
Turning the volume wheel pushes 02 0c 06 00 08 00 <raw> 00 <level>, the
GET reply layout with handle 0x00 (captured on hardware). A push that
lands during a read is taken as the current level; document that and add
a test with a captured frame.
@github-actions github-actions Bot added the awaiting-maintainer The author replied or pushed - our move label Oct 28, 2026
@Sapd

Sapd commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Thanks. The bare-ack skip is the right call, and LEN > 3 is safe for the other two readers - battery and chatmix both read a payload byte, so neither can legitimately answer with an empty frame.

One residual worth knowing, not worth changing: a wheel push accepted as the GET reply leaves the real reply queued, so a turn during a read can make the next --volume one frame behind. Same shape as the ack problem this fixes, and there's no clean fix while the handle is only an echo token - a GUI polling this should not treat a single read as authoritative.

Merging.

@Sapd
Sapd merged commit 50e5ca5 into Sapd:master Oct 28, 2026
7 checks passed
@github-actions github-actions Bot removed the awaiting-maintainer The author replied or pushed - our move label Oct 28, 2026
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