add offset setting + fix build errors

pull/1/head
Nat Moore 4 years ago
parent 7cf50e1765
commit 3575a295ec

@ -99,8 +99,6 @@ system:
sysId: 001
rfssId: 1
siteId: 1
txTuning: 0 # freq offset for the hotspot, in hz
rxTuning: 0
modem:
protocol:
type: "uart" # Valid values are "null", "uart", and "udp"
@ -123,6 +121,8 @@ system:
txDCOffset: 0
rxLevel: 50
txLevel: 50
txTuning: 0 # freq offset for the hotspot, in hz
rxTuning: 0
# cwIdTxLevel: 50
# dmrTxLevel: 50
# p25TxLevel: 50

Binary file not shown.

@ -1505,6 +1505,8 @@ bool Host::createModem()
uint8_t p25CorrCount = (uint8_t)modemConf["p25CorrCount"].as<uint32_t>(4U);
int rxDCOffset = modemConf["rxDCOffset"].as<int>(0);
int txDCOffset = modemConf["txDCOffset"].as<int>(0);
int rxTuning = modemConf["rxTuning"].as<int>(0);
int txTuning = modemConf["txTuning"].as<int>(0);
uint8_t rfPower = (uint8_t)modemConf["rfPower"].as<uint32_t>(100U);
int dmrSymLevel3Adj = modemConf["dmrSymLvl3Adj"].as<int>(0);
int dmrSymLevel1Adj = modemConf["dmrSymLvl1Adj"].as<int>(0);
@ -1608,6 +1610,10 @@ bool Host::createModem()
LogInfo(" UDP Port: %u", udpPort);
}
// apply the frequency tuning offsets
int adjustedRx = m_rxFrequency + rxTuning;
int adjustedTx = m_txFrequency + txTuning;
LogInfo(" RX Invert: %s", rxInvert ? "yes" : "no");
LogInfo(" TX Invert: %s", txInvert ? "yes" : "no");
LogInfo(" PTT Invert: %s", pttInvert ? "yes" : "no");
@ -1618,6 +1624,10 @@ bool Host::createModem()
LogInfo(" P25 Corr. Count: %u (%.1fms)", p25CorrCount, float(p25CorrCount) * 0.667F);
LogInfo(" RX DC Offset: %d", rxDCOffset);
LogInfo(" TX DC Offset: %d", txDCOffset);
LogInfo(" RX Tuning Offset: %dhz", rxTuning);
LogInfo(" TX Tuning Offset: %dhz", txTuning);
LogInfo(" RX Effective Frequency: %dhz", adjustedRx);
LogInfo(" TX Effective Frequency: %dhz", adjustedTx);
LogInfo(" RF Power Level: %u", rfPower);
LogInfo(" RX Level: %.1f%%", rxLevel);
LogInfo(" CW Id TX Level: %.1f%%", cwIdTXLevel);
@ -1635,7 +1645,7 @@ bool Host::createModem()
m_modem->setLevels(rxLevel, cwIdTXLevel, dmrTXLevel, p25TXLevel);
m_modem->setSymbolAdjust(dmrSymLevel3Adj, dmrSymLevel1Adj, p25SymLevel3Adj, p25SymLevel1Adj);
m_modem->setDCOffsetParams(txDCOffset, rxDCOffset);
m_modem->setRFParams(m_rxFrequency, m_txFrequency, rfPower);
m_modem->setRFParams(adjustedRx, adjustedTx, rfPower);
m_modem->setDMRColorCode(m_dmrColorCode);
m_modem->setP25NAC(m_p25NAC);

@ -152,10 +152,8 @@ Modem::~Modem()
/// </summary>
/// <param name="txDCOffset"></param>
/// <param name="rxDCOffset"></param>
void Modem::setRFParams(unsigned int rxFrequency, unsigned int txFrequency, int txDCOffset, int rxDCOffset)
void Modem::setDCOffsetParams(int txDCOffset, int rxDCOffset)
{
m_rxFrequency = rxFrequency;
m_txFrequency = txFrequency;
m_txDCOffset = txDCOffset;
m_rxDCOffset = rxDCOffset;
}
@ -1324,65 +1322,6 @@ bool Modem::getStatus()
return write(buffer, 3U) == 3;
}
bool Modem::writeFrequency()
{
unsigned char buffer[20U];
unsigned char len;
//buffer[12U] = (unsigned char)(m_rfLevel * 2.55F + 0.5F);
// RF level 100 is probably fine, i'm too lazy to implement it rn
buffer[12U] = (unsigned char)(100 * 2.55F + 0.5F);
len = 17U;
buffer[0U] = DVM_FRAME_START;
buffer[1U] = len;
buffer[2U] = CMD_SET_FREQUENCY;
buffer[3U] = 0x00U;
buffer[4U] = (m_rxFrequency >> 0) & 0xFFU;
buffer[5U] = (m_rxFrequency >> 8) & 0xFFU;
buffer[6U] = (m_rxFrequency >> 16) & 0xFFU;
buffer[7U] = (m_rxFrequency >> 24) & 0xFFU;
buffer[8U] = (m_txFrequency >> 0) & 0xFFU;
buffer[9U] = (m_txFrequency >> 8) & 0xFFU;
buffer[10U] = (m_txFrequency >> 16) & 0xFFU;
buffer[11U] = (m_txFrequency >> 24) & 0xFFU;
// CUtils::dump(1U, "Written", buffer, len);
int ret = m_port->write(buffer, len);
if (ret != len)
return false;
unsigned int count = 0U;
RESP_TYPE_DVM resp;
do {
Thread::sleep(10U);
resp = getResponse();
if (resp == RTM_OK && m_buffer[2U] != RSN_OK && m_buffer[2U] != RSN_NAK) {
count++;
if (count >= MAX_RESPONSES) {
LogError(LOG_MODEM, "The MMDVM is not responding to the SET_FREQ command");
return false;
}
}
} while (resp == RTM_OK && m_buffer[2U] != RSN_OK && m_buffer[2U] != RSN_NAK);
// CUtils::dump(1U, "Response", m_buffer, m_length);
if (resp == RTM_OK && m_buffer[2U] == RSN_NAK) {
LogError(LOG_MODEM, "Received a NAK to the SET_FREQ command from the modem");
return false;
}
return true;
}
/// <summary>
/// Write configuration to the air interface modem.
/// </summary>

@ -185,7 +185,7 @@ namespace modem
~Modem();
/// <summary>Sets the RF DC offset parameters.</summary>
void setRFParams(unsigned int rxFrequency, unsigned int txFrequency, int txDCOffset, int rxDCOffset);
void setDCOffsetParams(int txDCOffset, int rxDCOffset);
/// <summary>Sets the enabled modes.</summary>
void setModeParams(bool dmrEnabled, bool p25Enabled);
/// <summary>Sets the RF deviation levels.</summary>

Loading…
Cancel
Save

Powered by TurnKey Linux.