Modified radio drivers so that bandwidth parameter in radio configuration is ignored for operating modes different from analog FM. Fixes #100

This commit is contained in:
Silvano Seva 2022-08-01 18:29:20 +02:00
parent 9a00b4e837
commit 1fa13d63d8
3 changed files with 46 additions and 20 deletions

View File

@ -118,6 +118,8 @@ void radio_setOpmode(const enum opmode mode)
gpio_clearPin(RX_AUDIO_MUX); // Audio out to HR_C6000 gpio_clearPin(RX_AUDIO_MUX); // Audio out to HR_C6000
gpio_setPin(TX_AUDIO_MUX); // Audio in from HR_C6000 gpio_setPin(TX_AUDIO_MUX); // Audio in from HR_C6000
at1846s.setOpMode(AT1846S_OpMode::DMR); at1846s.setOpMode(AT1846S_OpMode::DMR);
at1846s.setBandwidth(AT1846S_BW::_12P5);
at1846s.setTxDeviation(calData->data[currTxBand].mixGainNarrowband);
break; break;
default: default:
@ -316,16 +318,25 @@ void radio_updateConfiguration()
float apc = pwrLo + (pwrHi - pwrLo)/4.0f*(power - 1.0f); float apc = pwrLo + (pwrHi - pwrLo)/4.0f*(power - 1.0f);
apcVoltage = static_cast< uint16_t >(apc) * 16; apcVoltage = static_cast< uint16_t >(apc) * 16;
// Set bandwidth and TX deviation, force 12.5kHz for DMR mode // Set bandwidth, only for analog FM mode
if((config->bandwidth == BW_12_5) || (config->opMode == OPMODE_DMR)) if(config->opMode == OPMODE_FM)
{ {
at1846s.setBandwidth(AT1846S_BW::_12P5); switch(config->bandwidth)
at1846s.setTxDeviation(calData->data[currTxBand].mixGainNarrowband); {
} case BW_12_5:
else at1846s.setBandwidth(AT1846S_BW::_12P5);
{ at1846s.setTxDeviation(calData->data[currTxBand].mixGainNarrowband);
at1846s.setBandwidth(AT1846S_BW::_25); break;
at1846s.setTxDeviation(calData->data[currTxBand].mixGainWideband);
case BW_20:
case BW_25:
at1846s.setBandwidth(AT1846S_BW::_25);
at1846s.setTxDeviation(calData->data[currTxBand].mixGainWideband);
break;
default:
break;
}
} }
/* /*

View File

@ -207,12 +207,14 @@ void radio_setOpmode(const enum opmode mode)
case OPMODE_DMR: case OPMODE_DMR:
gpio_clearPin(FM_SW); // Disable analog RX stage after superhet gpio_clearPin(FM_SW); // Disable analog RX stage after superhet
gpio_setPin(DMR_SW); // Enable analog paths for DMR gpio_setPin(DMR_SW); // Enable analog paths for DMR
_setBandwidth(BW_12_5); // Set bandwidth to 12.5kHz
//C5000_dmrMode(); //C5000_dmrMode();
break; break;
case OPMODE_M17: case OPMODE_M17:
gpio_clearPin(DMR_SW); // Disconnect analog paths for DMR gpio_clearPin(DMR_SW); // Disconnect analog paths for DMR
gpio_setPin(FM_SW); // Enable analog RX stage after superhet gpio_setPin(FM_SW); // Enable analog RX stage after superhet
_setBandwidth(BW_25); // Set bandwidth to 25kHz for proper deviation
C5000.fmMode(); // HR_C5000 in FM mode C5000.fmMode(); // HR_C5000 in FM mode
C5000.setInputGain(-3); // Input gain in dB, found experimentally C5000.setInputGain(-3); // Input gain in dB, found experimentally
break; break;
@ -352,10 +354,12 @@ void radio_updateConfiguration()
C5000.setModAmplitude(I, Q); C5000.setModAmplitude(I, Q);
// Set bandwidth, force 12.5kHz for DMR mode // Set bandwidth, only for analog FM mode
enum bandwidth bandwidth = static_cast< enum bandwidth >(config->bandwidth); if(config->opMode == OPMODE_FM)
if(config->opMode == OPMODE_DMR) bandwidth = BW_12_5; {
_setBandwidth(bandwidth); enum bandwidth bw = static_cast< enum bandwidth >(config->bandwidth);
_setBandwidth(bw);
}
// Set CTCSS tone // Set CTCSS tone
float tone = static_cast< float >(config->txTone) / 10.0f; float tone = static_cast< float >(config->txTone) / 10.0f;

View File

@ -120,11 +120,13 @@ void radio_setOpmode(const enum opmode mode)
case OPMODE_DMR: case OPMODE_DMR:
at1846s.setOpMode(AT1846S_OpMode::DMR); at1846s.setOpMode(AT1846S_OpMode::DMR);
at1846s.setBandwidth(AT1846S_BW::_12P5);
// C6000.dmrMode(); // C6000.dmrMode();
break; break;
case OPMODE_M17: case OPMODE_M17:
at1846s.setOpMode(AT1846S_OpMode::DMR); // AT1846S in DMR mode, disables RX filter at1846s.setOpMode(AT1846S_OpMode::DMR); // AT1846S in DMR mode, disables RX filter
at1846s.setBandwidth(AT1846S_BW::_25); // Set bandwidth to 25kHz for proper deviation
C6000.fmMode(); // HR_C6000 in FM mode C6000.fmMode(); // HR_C6000 in FM mode
C6000.setInputGain(+6); // Input gain in dB, found experimentally C6000.setInputGain(+6); // Input gain in dB, found experimentally
break; break;
@ -312,14 +314,23 @@ void radio_updateConfiguration()
calPoints); calPoints);
C6000.setModAmplitude(0, Q); C6000.setModAmplitude(0, Q);
// Set bandwidth, force 12.5kHz for DMR mode // Set bandwidth, only for analog FM mode
if((config->bandwidth == BW_12_5) || (config->opMode == OPMODE_DMR)) if(config->opMode == OPMODE_FM)
{ {
at1846s.setBandwidth(AT1846S_BW::_12P5); switch(config->bandwidth)
} {
else case BW_12_5:
{ at1846s.setBandwidth(AT1846S_BW::_12P5);
at1846s.setBandwidth(AT1846S_BW::_25); break;
case BW_20:
case BW_25:
at1846s.setBandwidth(AT1846S_BW::_25);
break;
default:
break;
}
} }
/* /*