fix(tx15): headphone detection (#6686)

This commit is contained in:
3djc
2025-10-18 20:39:13 +10:00
committed by GitHub
parent e904da89e7
commit f4ecf03a9e
6 changed files with 33 additions and 6 deletions
+10
View File
@@ -47,6 +47,9 @@
#if defined(AUDIO)
uint8_t currentSpeakerVolume = 255;
uint8_t requiredSpeakerVolume = 255;
#if defined(AUDIO_HP_DETECT_PIN)
bool hpDetected = false;
#endif
#endif
uint8_t currentBacklightBright = 0;
@@ -207,6 +210,13 @@ void handleUsbConnection()
void checkSpeakerVolume()
{
#if defined(AUDIO_HP_DETECT_PIN)
// volume needs to be set on plug/unplug to set the the right volume on each device
if (hpDetected != audioHeadphoneDetect()) {
hpDetected = !hpDetected;
audioSetVolume(currentSpeakerVolume);
}
#endif
#if defined(AUDIO)
if (currentSpeakerVolume != requiredSpeakerVolume) {
currentSpeakerVolume = requiredSpeakerVolume;