kopia lustrzana https://github.com/OpenRTX/OpenRTX
Moved audio management in FM opmode handler to audio path system
rodzic
ebc7be39ab
commit
edf864337a
|
@ -21,6 +21,7 @@
|
||||||
#ifndef OPMODE_FM_H
|
#ifndef OPMODE_FM_H
|
||||||
#define OPMODE_FM_H
|
#define OPMODE_FM_H
|
||||||
|
|
||||||
|
#include <audio_path.h>
|
||||||
#include "OpMode.hpp"
|
#include "OpMode.hpp"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,9 +91,11 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool rfSqlOpen; ///< Flag for RF squelch status (analog squelch).
|
bool rfSqlOpen; ///< Flag for RF squelch status (analog squelch).
|
||||||
bool sqlOpen; ///< Flag for squelch status.
|
bool sqlOpen; ///< Flag for squelch status.
|
||||||
bool enterRx; ///< Flag for RX management.
|
bool enterRx; ///< Flag for RX management.
|
||||||
|
pathId rxAudioPath; ///< Audio path ID for RX
|
||||||
|
pathId txAudioPath; ///< Audio path ID for TX
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* OPMODE_FM_H */
|
#endif /* OPMODE_FM_H */
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <interfaces/platform.h>
|
#include <interfaces/platform.h>
|
||||||
#include <interfaces/delays.h>
|
#include <interfaces/delays.h>
|
||||||
#include <interfaces/radio.h>
|
#include <interfaces/radio.h>
|
||||||
#include <interfaces/audio.h>
|
|
||||||
#include <OpMode_FM.hpp>
|
#include <OpMode_FM.hpp>
|
||||||
#include <rtx.h>
|
#include <rtx.h>
|
||||||
|
|
||||||
|
@ -45,14 +44,8 @@ void _setVolume()
|
||||||
uint8_t volume = platform_getVolumeLevel();
|
uint8_t volume = platform_getVolumeLevel();
|
||||||
volume >>= 3;
|
volume >>= 3;
|
||||||
|
|
||||||
// Mute volume when knob is set below 10%
|
if(volume >= 1)
|
||||||
if(volume < 1)
|
|
||||||
{
|
{
|
||||||
audio_disableAmp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
audio_enableAmp();
|
|
||||||
// Setting HR_C6000 volume to 0 = max volume
|
// Setting HR_C6000 volume to 0 = max volume
|
||||||
HR_C6000::instance().setDacGain(volume);
|
HR_C6000::instance().setDacGain(volume);
|
||||||
}
|
}
|
||||||
|
@ -80,8 +73,8 @@ void OpMode_FM::disable()
|
||||||
// Clean shutdown.
|
// Clean shutdown.
|
||||||
platform_ledOff(GREEN);
|
platform_ledOff(GREEN);
|
||||||
platform_ledOff(RED);
|
platform_ledOff(RED);
|
||||||
audio_disableAmp();
|
audioPath_release(rxAudioPath);
|
||||||
audio_disableMic();
|
audioPath_release(txAudioPath);
|
||||||
radio_disableRtx();
|
radio_disableRtx();
|
||||||
rfSqlOpen = false;
|
rfSqlOpen = false;
|
||||||
sqlOpen = false;
|
sqlOpen = false;
|
||||||
|
@ -112,13 +105,13 @@ void OpMode_FM::update(rtxStatus_t *const status, const bool newCfg)
|
||||||
// Audio control
|
// Audio control
|
||||||
if((sqlOpen == false) && (rfSql || toneSql))
|
if((sqlOpen == false) && (rfSql || toneSql))
|
||||||
{
|
{
|
||||||
audio_enableAmp();
|
rxAudioPath = audioPath_request(SOURCE_RTX, SINK_SPK, PRIO_RX);
|
||||||
sqlOpen = true;
|
if(rxAudioPath > 0) sqlOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((sqlOpen == true) && (rfSql == false) && (toneSql == false))
|
if((sqlOpen == true) && (rfSql == false) && (toneSql == false))
|
||||||
{
|
{
|
||||||
audio_disableAmp();
|
audioPath_release(rxAudioPath);
|
||||||
sqlOpen = false;
|
sqlOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +134,10 @@ void OpMode_FM::update(rtxStatus_t *const status, const bool newCfg)
|
||||||
if(platform_getPttStatus() && (status->opStatus != TX) &&
|
if(platform_getPttStatus() && (status->opStatus != TX) &&
|
||||||
(status->txDisable == 0))
|
(status->txDisable == 0))
|
||||||
{
|
{
|
||||||
audio_disableAmp();
|
audioPath_release(rxAudioPath);
|
||||||
radio_disableRtx();
|
radio_disableRtx();
|
||||||
|
|
||||||
audio_enableMic();
|
txAudioPath = audioPath_request(SOURCE_MIC, SINK_RTX, PRIO_TX);
|
||||||
radio_enableTx();
|
radio_enableTx();
|
||||||
|
|
||||||
status->opStatus = TX;
|
status->opStatus = TX;
|
||||||
|
@ -152,7 +145,7 @@ void OpMode_FM::update(rtxStatus_t *const status, const bool newCfg)
|
||||||
|
|
||||||
if(!platform_getPttStatus() && (status->opStatus == TX))
|
if(!platform_getPttStatus() && (status->opStatus == TX))
|
||||||
{
|
{
|
||||||
audio_disableMic();
|
audioPath_release(txAudioPath);
|
||||||
radio_disableRtx();
|
radio_disableRtx();
|
||||||
|
|
||||||
status->opStatus = OFF;
|
status->opStatus = OFF;
|
||||||
|
|
Ładowanie…
Reference in New Issue