Added configurable phase inversion to M17 demodulator. Forced enabling of phase inversion for MD3x0 VHF radios.
This commit is contained in:
parent
bfa3494777
commit
4d4ebae2f3
|
|
@ -109,6 +109,13 @@ public:
|
|||
*/
|
||||
bool isLocked();
|
||||
|
||||
/**
|
||||
* Invert baseband signal phase before decoding.
|
||||
*
|
||||
* @param status: if set to true signal phase is inverted.
|
||||
*/
|
||||
void invertPhase(const bool status);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
|
@ -150,6 +157,7 @@ private:
|
|||
bool newFrame; ///< A new frame has been fully decoded.
|
||||
int16_t basebandBridge[M17_BRIDGE_SIZE] = { 0 }; ///< Bridge buffer
|
||||
int16_t phase; ///< Phase of the signal w.r.t. sampling
|
||||
bool invPhase; ///< Invert signal phase
|
||||
|
||||
/*
|
||||
* State variables
|
||||
|
|
|
|||
|
|
@ -55,8 +55,9 @@ typedef struct
|
|||
uint8_t rxCan : 4, /**< M17 Channel Access Number for RX squelch */
|
||||
txCan : 4; /**< M17 Channel Access Number for TX squelch */
|
||||
|
||||
char source_address[10]; /**< M17 call source address */
|
||||
char source_address[10]; /**< M17 call source address */
|
||||
char destination_address[10]; /**< M17 call routing address */
|
||||
bool invertRxPhase; /**< M17 RX phase inversion */
|
||||
}
|
||||
rtxStatus_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -103,12 +103,13 @@ void *ui_task(void *arg)
|
|||
rtx_cfg.rxTone = ctcss_tone[state.channel.fm.rxTone];
|
||||
rtx_cfg.txToneEn = state.channel.fm.txToneEn;
|
||||
rtx_cfg.txTone = ctcss_tone[state.channel.fm.txTone];
|
||||
pthread_mutex_unlock(&rtx_mutex);
|
||||
|
||||
// Copy new M17 source and destination addresses
|
||||
strncpy(rtx_cfg.source_address, state.settings.callsign, 10);
|
||||
strncpy(rtx_cfg.destination_address, state.m17_data.dst_addr, 10);
|
||||
|
||||
pthread_mutex_unlock(&rtx_mutex);
|
||||
|
||||
rtx_configure(&rtx_cfg);
|
||||
sync_rtx = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -435,7 +435,8 @@ bool M17Demodulator::update()
|
|||
for(size_t i = 0; i < baseband.len; i++)
|
||||
{
|
||||
float elem = static_cast< float >(baseband.data[i]);
|
||||
baseband.data[i] = static_cast< int16_t >(M17::rrc_24k(elem));
|
||||
if(invPhase) elem = 0.0f - elem;
|
||||
baseband.data[i] = static_cast< int16_t >(M17::rrc_24k(elem));
|
||||
}
|
||||
|
||||
// Process the buffer
|
||||
|
|
@ -574,3 +575,8 @@ bool M17Demodulator::update()
|
|||
|
||||
return newFrame;
|
||||
}
|
||||
|
||||
void M17Demodulator::invertPhase(const bool status)
|
||||
{
|
||||
invPhase = status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,12 @@ void OpMode_M17::update(rtxStatus_t *const status, const bool newCfg)
|
|||
{
|
||||
(void) newCfg;
|
||||
|
||||
// Force inversion of RX phase for MD3x0 VHF radios
|
||||
#ifdef PLATFORM_MD3x0
|
||||
const hwInfo_t* hwinfo = platform_getHwInfo();
|
||||
status->invertRxPhase |= hwinfo->vhf_band;
|
||||
#endif
|
||||
|
||||
// Main FSM logic
|
||||
switch(status->opStatus)
|
||||
{
|
||||
|
|
@ -135,6 +141,7 @@ void OpMode_M17::rxState(rtxStatus_t *const status)
|
|||
{
|
||||
decoder.reset();
|
||||
demodulator.startBasebandSampling();
|
||||
demodulator.invertPhase(status->invertRxPhase);
|
||||
|
||||
audio_enableAmp();
|
||||
codec_startDecode(SINK_SPK);
|
||||
|
|
|
|||
|
|
@ -46,18 +46,19 @@ void rtx_init(pthread_mutex_t *m)
|
|||
/*
|
||||
* Default initialisation for rtx status
|
||||
*/
|
||||
rtxStatus.opMode = OPMODE_NONE;
|
||||
rtxStatus.bandwidth = BW_25;
|
||||
rtxStatus.txDisable = 0;
|
||||
rtxStatus.opStatus = OFF;
|
||||
rtxStatus.rxFrequency = 430000000;
|
||||
rtxStatus.txFrequency = 430000000;
|
||||
rtxStatus.txPower = 0.0f;
|
||||
rtxStatus.sqlLevel = 1;
|
||||
rtxStatus.rxToneEn = 0;
|
||||
rtxStatus.rxTone = 0;
|
||||
rtxStatus.txToneEn = 0;
|
||||
rtxStatus.txTone = 0;
|
||||
rtxStatus.opMode = OPMODE_NONE;
|
||||
rtxStatus.bandwidth = BW_25;
|
||||
rtxStatus.txDisable = 0;
|
||||
rtxStatus.opStatus = OFF;
|
||||
rtxStatus.rxFrequency = 430000000;
|
||||
rtxStatus.txFrequency = 430000000;
|
||||
rtxStatus.txPower = 0.0f;
|
||||
rtxStatus.sqlLevel = 1;
|
||||
rtxStatus.rxToneEn = 0;
|
||||
rtxStatus.rxTone = 0;
|
||||
rtxStatus.txToneEn = 0;
|
||||
rtxStatus.txTone = 0;
|
||||
rtxStatus.invertRxPhase = false;
|
||||
currMode = &noMode;
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue