Skip to content

Commit

Permalink
Merge remote-tracking branch 'g4klx/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
juribeparada committed Aug 20, 2017
2 parents 8f317fd + 1cee9e1 commit 17007dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions IO.cpp
Expand Up @@ -62,6 +62,7 @@ m_dstarTXLevel(128 * 128),
m_dmrTXLevel(128 * 128),
m_ysfTXLevel(128 * 128),
m_p25TXLevel(128 * 128),
m_txDCOffset(DC_OFFSET),
m_ledCount(0U),
m_ledValue(true),
m_detect(false),
Expand Down Expand Up @@ -299,7 +300,7 @@ void CIO::write(MMDVM_STATE mode, q15_t* samples, uint16_t length, const uint8_t
for (uint16_t i = 0U; i < length; i++) {
q31_t res1 = samples[i] * txLevel;
q15_t res2 = q15_t(__SSAT((res1 >> 15), 16));
uint16_t res3 = uint16_t(res2 + DC_OFFSET);
uint16_t res3 = uint16_t(res2 + m_txDCOffset);

// Detect DAC overflow
if (res3 > 4095U)
Expand Down Expand Up @@ -340,7 +341,7 @@ void CIO::setMode()
#endif
}

void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel)
void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, int16_t txDCOffset)
{
m_pttInvert = pttInvert;

Expand All @@ -350,6 +351,8 @@ void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rx
m_dmrTXLevel = q15_t(dmrTXLevel * 128);
m_ysfTXLevel = q15_t(ysfTXLevel * 128);
m_p25TXLevel = q15_t(p25TXLevel * 128);

m_txDCOffset = DC_OFFSET + txDCOffset;

if (rxInvert)
m_rxLevel = -m_rxLevel;
Expand Down
4 changes: 3 additions & 1 deletion IO.h
Expand Up @@ -42,7 +42,7 @@ class CIO {

void interrupt();

void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel);
void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, int16_t txDCOffset);

void getOverflow(bool& adcOverflow, bool& dacOverflow);

Expand Down Expand Up @@ -79,6 +79,8 @@ class CIO {
q15_t m_ysfTXLevel;
q15_t m_p25TXLevel;

uint16_t m_txDCOffset;

uint32_t m_ledCount;
bool m_ledValue;

Expand Down
6 changes: 4 additions & 2 deletions SerialPort.cpp
Expand Up @@ -221,7 +221,7 @@ void CSerialPort::getVersion()

uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
{
if (length < 13U)
if (length < 14U)
return 4U;

bool rxInvert = (data[0U] & 0x01U) == 0x01U;
Expand Down Expand Up @@ -268,6 +268,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
uint8_t ysfTXLevel = data[11U];
uint8_t p25TXLevel = data[12U];

int16_t txDCOffset = int16_t(data[13U]) - 128;

m_modemState = modemState;

m_dstarEnable = dstarEnable;
Expand All @@ -289,7 +291,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)

ysfTX.setLoDev(ysfLoDev);

io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel);
io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, txDCOffset);

io.start();

Expand Down

0 comments on commit 17007dd

Please sign in to comment.