Skip to content

Audio module dev#10043

Open
aseiger wants to merge 6 commits intomeshtastic:developfrom
aseiger:audio_module_dev
Open

Audio module dev#10043
aseiger wants to merge 6 commits intomeshtastic:developfrom
aseiger:audio_module_dev

Conversation

@aseiger
Copy link
Copy Markdown

@aseiger aseiger commented Mar 31, 2026

This is a significant re-work of the audio module, explicitly to support the Lilygo T3S3 SX1280 + MVSR board. I will unabashedly admit that alot of this was done using an LLM, but I have alot of experience with I2S audio and heavily directed it's actions to properly function.

The end result works quite well, if I may say so. I'm very pleased - and my pie-in-the-sky hope is that this enables an off-the-shelf board to work as a neato mesh walkie-talkie.

NOTE - this did require changes to the protobuf definitions - I have submitted a secondary PR for this as well.

🤝 Attestations

  • [-] I have tested that my proposed changes behave as described.
  • [] I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • [] Heltec (Lora32) V3
    • [] LilyGo T-Deck
    • [] LilyGo T-Beam
    • [] RAK WisBlock 4631
    • [] Seeed Studio T-1000E tracker card
    • [] - Other (please specify below)

aseiger added 6 commits March 20, 2026 01:44
- Lower codec2 task priority from 20 to 1 and speaker task from 22 to 2
  to prevent preemption of the main loop on PTT press, which was blocking
  screen updates for ~2 seconds
- Remove unnecessary i2s_zero_dma_buffer call on RX-only PDM mic port
- Reorder PTT handler: update screen before audio cleanup so display
  responds immediately
- Add MVSR variant (tlora_t3s3_v1_mvsr) with dual I2S PDM mic + MAX98357
  speaker configuration
…play improvements

- Add speaker_gain, mic_gain, audio_target fields to AudioConfig protobuf
- Update nanopb generated header (module_config.pb.h) with new fields
- Add on-screen audio settings menu via long-press SELECT on audio frame
  - Mic Gain / Speaker Gain submenus with labeled levels (Quiet/Low/Default/High/Loud/Max)
  - Target submenu with dynamic node list for DM or Broadcast selection
  - Settings persist to flash via nodeDB->saveToDisk()
- Replace static 'Receive' idle text with informative display:
  - Mic/Speaker gain labels and target info shown using FONT_SMALL
- Fix menu flash (pendingMenu suppression in drawFrame)
- Fix inconsistent menu triggering (lastDrawMs threshold 200->1000ms)
- Add AUDIO_DEFAULT_GAIN constant, runtime gain helpers (getMicGain/getSpeakerGain)
- Audio defaults initialization in NodeDB::installDefaultModuleConfig()
- variant.h: PCF85063A RTC on Wire1, vibration motor GPIO 46, PTT GPIO 47
- platformio.ini: add SensorLib@0.3.4 dependency
- NodeDB.cpp: fix HAS_I2S nag_timeout overwriting PIN_VIBRATION config
Direct-message audio packets were failing because the audio payload (224 bytes)
plus protobuf overhead (~6 bytes) plus header (16 bytes) plus PKI overhead
(12 bytes) exceeded the MAX_LORA_PAYLOAD_LEN of 255 bytes.

Instead of excluding AUDIO_APP from PKI encryption (which would lose
end-to-end Curve25519 encryption for DMs), reduce MAX_AUDIO_DATA from
224 to 212 bytes so audio packets fit within the PKI-encrypted frame.

Trade-off: ~5-7% fewer codec frames per packet (e.g., CODEC2_1600 goes
from 28 to 26 frames per packet, 1120ms to 1040ms), which is barely
noticeable. Broadcast audio is unaffected since PKI only applies to
non-broadcast packets.
…display, codec rate menu, default 1200

- Combined Target + Channel selection into single menu (broadcast channels + DM nodes)
- Changed mic/speaker gain menus and idle display to numeric 1-12 range
- Added RX source indicator: 'RX DM' for direct messages, 'RX [ChannelName]' for broadcast
- Added codec rate menu with live reinit (3200/2400/1600/1400/1300/1200/700)
- Fixed codec rate change garbled audio (memcpy tx_encode_frame after mode update)
- Changed default codec rate from 1600 to 1200
- Added audio_channel protobuf field (tag 11) for broadcast channel persistence
- Display long_name for DM targets, channel names in header and idle screen
@github-actions github-actions bot added needs-review Needs human review hardware-support Hardware related: new devices or modules, problems specific to hardware labels Mar 31, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 31, 2026

CLA assistant check
All committers have signed the CLA.

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

Labels

hardware-support Hardware related: new devices or modules, problems specific to hardware needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants