From cdfac072245116511bdab3f86f7a4ca5072a6c16 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Sat, 12 Mar 2022 23:19:01 -0500 Subject: [PATCH] implement new logic to store some tuning parameters in the modem flash as a backup to config.yml (if this is buggy use ignoreModemConfigArea in the config.yml to disable); --- Defines.h | 3 +- config.example.yml | 1 + host/Host.cpp | 18 ++--- host/calibrate/HostCal.cpp | 111 +++++++++++++++++++++++++++---- modem/Modem.cpp | 130 ++++++++++++++++++++++++++++++++----- modem/Modem.h | 10 ++- network/Network.cpp | 4 +- 7 files changed, 234 insertions(+), 43 deletions(-) diff --git a/Defines.h b/Defines.h index 8cce8b2b..942afe80 100644 --- a/Defines.h +++ b/Defines.h @@ -94,6 +94,7 @@ typedef unsigned long long ulong64_t; // --------------------------------------------------------------------------- #define __PROG_NAME__ "Digital Voice Modem Host" +#define __NET_NAME__ "DVM_DMR_P25" #define __EXE_NAME__ "dvmhost" #define __VER__ "R01.00.00" #define __BUILD__ __DATE__ " " __TIME__ @@ -103,7 +104,7 @@ typedef unsigned long long ulong64_t; #if defined(_WIN32) || defined(_WIN64) #define DEFAULT_CONF_FILE "config.yml" #else -#define DEFAULT_CONF_FILE "/opt/DVM/bin/config.yml" +#define DEFAULT_CONF_FILE "/opt/dvm/config.yml" #endif // defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64) #define DEFAULT_LOCK_FILE "dvm.lock" diff --git a/config.example.yml b/config.example.yml index db039eae..2da70f0e 100644 --- a/config.example.yml +++ b/config.example.yml @@ -142,6 +142,7 @@ system: rssiMappingFile: RSSI.dat packetPlayoutTime: 10 disableOFlowReset: false + ignoreModemConfigArea: false trace: false debug: false cwId: diff --git a/host/Host.cpp b/host/Host.cpp index e823bd24..f6a00782 100644 --- a/host/Host.cpp +++ b/host/Host.cpp @@ -1528,6 +1528,7 @@ bool Host::createModem() } uint8_t packetPlayoutTime = (uint8_t)modemConf["packetPlayoutTime"].as(10U); bool disableOFlowReset = modemConf["disableOFlowReset"].as(false); + bool ignoreModemConfigArea = modemConf["ignoreModemConfigArea"].as(false); bool trace = modemConf["trace"].as(false); bool debug = modemConf["debug"].as(false); @@ -1624,10 +1625,6 @@ bool Host::createModem() LogInfo(" UDP Port: %u", udpPort); } - // apply the frequency tuning offsets - uint32_t rxActualFreq = m_rxFrequency + rxTuning; - uint32_t txActualFreq = m_txFrequency + txTuning; - LogInfo(" RX Invert: %s", rxInvert ? "yes" : "no"); LogInfo(" TX Invert: %s", txInvert ? "yes" : "no"); LogInfo(" PTT Invert: %s", pttInvert ? "yes" : "no"); @@ -1640,8 +1637,8 @@ bool Host::createModem() LogInfo(" TX DC Offset: %d", txDCOffset); LogInfo(" RX Tuning Offset: %dhz", rxTuning); LogInfo(" TX Tuning Offset: %dhz", txTuning); - LogInfo(" RX Effective Frequency: %uhz", rxActualFreq); - LogInfo(" TX Effective Frequency: %uhz", txActualFreq); + LogInfo(" RX Effective Frequency: %uhz", m_rxFrequency + rxTuning); + LogInfo(" TX Effective Frequency: %uhz", m_txFrequency + txTuning); LogInfo(" RF Power Level: %u", rfPower); LogInfo(" RX Level: %.1f%%", rxLevel); LogInfo(" CW Id TX Level: %.1f%%", cwIdTXLevel); @@ -1650,16 +1647,21 @@ bool Host::createModem() LogInfo(" Packet Playout Time: %u ms", packetPlayoutTime); LogInfo(" Disable Overflow Reset: %s", disableOFlowReset ? "yes" : "no"); + if (ignoreModemConfigArea) { + LogInfo(" Ignore Modem Configuration Area: yes"); + } + if (debug) { LogInfo(" Debug: yes"); } - m_modem = new Modem(modemPort, m_duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, p25CorrCount, packetPlayoutTime, disableOFlowReset, trace, debug); + m_modem = new Modem(modemPort, m_duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, p25CorrCount, + packetPlayoutTime, disableOFlowReset, ignoreModemConfigArea, trace, debug); m_modem->setModeParams(m_dmrEnabled, m_p25Enabled); m_modem->setLevels(rxLevel, cwIdTXLevel, dmrTXLevel, p25TXLevel); m_modem->setSymbolAdjust(dmrSymLevel3Adj, dmrSymLevel1Adj, p25SymLevel3Adj, p25SymLevel1Adj); m_modem->setDCOffsetParams(txDCOffset, rxDCOffset); - m_modem->setRFParams(rxActualFreq, txActualFreq, rfPower, dmrDiscBWAdj, p25DiscBWAdj, dmrPostBWAdj, p25PostBWAdj, adfGainMode); + m_modem->setRFParams(m_rxFrequency, m_txFrequency, rxTuning, txTuning, rfPower, dmrDiscBWAdj, p25DiscBWAdj, dmrPostBWAdj, p25PostBWAdj, adfGainMode); m_modem->setDMRColorCode(m_dmrColorCode); m_modem->setP25NAC(m_p25NAC); diff --git a/host/calibrate/HostCal.cpp b/host/calibrate/HostCal.cpp index 49f9efe6..5ab2e96c 100644 --- a/host/calibrate/HostCal.cpp +++ b/host/calibrate/HostCal.cpp @@ -317,6 +317,8 @@ int HostCal::run() m_dmrRxDelay = (uint8_t)modemConf["dmrRxDelay"].as(7U); m_p25CorrCount = (uint8_t)modemConf["p25CorrCount"].as(5U); + bool ignoreModemConfigArea = modemConf["ignoreModemConfigArea"].as(false); + yaml::Node modemProtocol = modemConf["protocol"]; std::string portType = modemProtocol["type"].as("null"); @@ -386,6 +388,10 @@ int HostCal::run() LogInfo(" TX Effective Frequency: %uhz", m_txAdjustedFreq); LogInfo(" RX Level: %.1f%%", m_rxLevel); LogInfo(" TX Level: %.1f%%", m_txLevel); + + if (ignoreModemConfigArea) { + LogInfo(" Ignore Modem Configuration Area: yes"); + } } else if (portType == UDP_PORT) { ::LogError(LOG_HOST, "Calibration mode is unsupported with a remote modem!"); @@ -397,7 +403,11 @@ int HostCal::run() return 2; } - m_modem = new Modem(modemPort, false, false, false, false, true, false, 80, 7, 4, 10, false, false, false); + m_modem = new Modem(modemPort, false, m_rxInvert, m_txInvert, m_pttInvert, m_dcBlocker, false, m_fdmaPreamble, m_dmrRxDelay, m_p25CorrCount, 10U, false, ignoreModemConfigArea, false, false); + m_modem->setLevels(m_rxLevel, m_txLevel, m_txLevel, m_txLevel); + m_modem->setSymbolAdjust(m_dmrSymLevel3Adj, m_dmrSymLevel1Adj, m_p25SymLevel3Adj, m_p25SymLevel1Adj); + m_modem->setDCOffsetParams(m_txDCOffset, m_rxDCOffset); + m_modem->setRFParams(m_rxFrequency, m_txFrequency, m_rxTuning, m_txTuning, 100U, m_dmrDiscBWAdj, m_p25DiscBWAdj, m_dmrPostBWAdj, m_p25PostBWAdj, m_adfGainMode); m_modem->setOpenHandler(MODEM_OC_PORT_HANDLER_BIND(HostCal::portModemOpen, this)); m_modem->setCloseHandler(MODEM_OC_PORT_HANDLER_BIND(HostCal::portModemClose, this)); @@ -1147,7 +1157,7 @@ bool HostCal::portModemHandler(Modem* modem, uint32_t ms, RESP_TYPE_DVM rspType, LogError(LOG_MODEM, "HostCal::portModemHandler(), invalid version for configuration area, %02X != %02X", DVM_CONF_AREA_VER, confAreaVersion); } else { - processFlashConfig(buffer + 3U); + processFlashConfig(buffer); // reset update config flag if its set if (m_updateConfigFromModem) { @@ -2163,7 +2173,76 @@ void HostCal::processFlashConfig(const uint8_t *buffer) if (m_updateConfigFromModem) { LogMessage(LOG_CAL, " - Restoring local configuration from configuration area on modem"); - // TODO TODO TODO + // general config + m_rxInvert = (buffer[3U] & 0x01U) == 0x01U; + m_conf["system"]["modem"]["rxInvert"] = __BOOL_STR(m_rxInvert); + m_txInvert = (buffer[3U] & 0x02U) == 0x02U; + m_conf["system"]["modem"]["txInvert"] = __BOOL_STR(m_txInvert); + m_pttInvert = (buffer[3U] & 0x04U) == 0x04U; + m_conf["system"]["modem"]["pttInvert"] = __BOOL_STR(m_pttInvert); + + m_dcBlocker = (buffer[4U] & 0x01U) == 0x01U; + m_conf["system"]["modem"]["dcBlocker"] = __BOOL_STR(m_dcBlocker); + + m_fdmaPreamble = buffer[5U]; + m_conf["system"]["modem"]["fdmaPreamble"] = __INT_STR(m_fdmaPreamble); + + // levels + m_rxLevel = (float(buffer[7U]) - 0.5F) / 2.55F; + m_conf["system"]["modem"]["rxLevel"] = __FLOAT_STR(m_rxLevel); + m_txLevel = (float(buffer[8U]) - 0.5F) / 2.55F; + m_conf["system"]["modem"]["txLevel"] = __FLOAT_STR(m_txLevel); + + m_dmrRxDelay = buffer[10U]; + m_conf["system"]["modem"]["dmrRxDelay"] = __INT_STR(m_dmrRxDelay); + + m_p25CorrCount = buffer[11U]; + m_conf["system"]["modem"]["p25CorrCount"] = __INT_STR(m_p25CorrCount); + + m_txDCOffset = int(buffer[16U]) - 128; + m_conf["system"]["modem"]["txDCOffset"] = __INT_STR(m_txDCOffset); + m_rxDCOffset = int(buffer[17U]) - 128; + m_conf["system"]["modem"]["rxDCOffset"] = __INT_STR(m_rxDCOffset); + + writeConfig(); + sleep(500); + + // symbol adjust + m_dmrSymLevel3Adj = int(buffer[35U]) - 128; + m_conf["system"]["modem"]["dmrSymLvl3Adj"] = __INT_STR(m_dmrSymLevel3Adj); + m_dmrSymLevel1Adj = int(buffer[36U]) - 128; + m_conf["system"]["modem"]["dmrSymLvl1Adj"] = __INT_STR(m_dmrSymLevel1Adj); + + m_p25SymLevel3Adj = int(buffer[37U]) - 128; + m_conf["system"]["modem"]["p25SymLvl3Adj"] = __INT_STR(m_p25SymLevel3Adj); + m_p25SymLevel1Adj = int(buffer[38U]) - 128; + m_conf["system"]["modem"]["p25SymLvl1Adj"] = __INT_STR(m_p25SymLevel1Adj); + + writeSymbolAdjust(); + sleep(500); + + // RF parameters + m_dmrDiscBWAdj = int8_t(buffer[20U]) - 128; + m_conf["system"]["modem"]["dmrDiscBWAdj"] = __INT_STR(m_dmrDiscBWAdj); + m_p25DiscBWAdj = int8_t(buffer[21U]) - 128; + m_conf["system"]["modem"]["p25DiscBWAdj"] = __INT_STR(m_p25DiscBWAdj); + m_dmrPostBWAdj = int8_t(buffer[22U]) - 128; + m_conf["system"]["modem"]["dmrPostBWAdj"] = __INT_STR(m_dmrPostBWAdj); + m_p25PostBWAdj = int8_t(buffer[23U]) - 128; + m_conf["system"]["modem"]["p25PostBWAdj"] = __INT_STR(m_p25PostBWAdj); + + m_adfGainMode = (ADF_GAIN_MODE)buffer[24U]; + m_conf["system"]["modem"]["adfGainMode"] = __INT_STR((int)m_adfGainMode); + + m_txTuning = int(buffer[25U]) - 128; + m_conf["system"]["modem"]["txTuning"] = __INT_STR(m_txTuning); + m_txAdjustedFreq = m_txFrequency + m_txTuning; + m_rxTuning = int(buffer[26U]) - 128; + m_conf["system"]["modem"]["rxTuning"] = __INT_STR(m_rxTuning); + m_rxAdjustedFreq = m_rxFrequency + m_rxTuning; + + writeRFParams(); + sleep(500); } } @@ -2230,11 +2309,6 @@ bool HostCal::writeFlash() if (m_dcBlocker) buffer[4U] |= 0x01U; - if (m_dmrEnabled) - buffer[4U] |= 0x02U; - if (m_p25Enabled) - buffer[4U] |= 0x08U; - buffer[5U] = m_fdmaPreamble; buffer[7U] = (uint8_t)(m_rxLevel * 2.55F + 0.5F); @@ -2257,15 +2331,24 @@ bool HostCal::writeFlash() buffer[24U] = (uint8_t)m_adfGainMode; - buffer[25U] = (uint8_t)(m_txTuning + 128); - buffer[26U] = (uint8_t)(m_rxTuning + 128); + uint32_t txTuning = (uint32_t)m_txTuning; + __SET_UINT32(txTuning, buffer, 25U); + uint32_t rxTuning = (uint32_t)m_rxTuning; + __SET_UINT32(rxTuning, buffer, 29U); // symbol adjust - buffer[30U] = (uint8_t)(m_dmrSymLevel3Adj + 128); - buffer[31U] = (uint8_t)(m_dmrSymLevel1Adj + 128); + buffer[35U] = (uint8_t)(m_dmrSymLevel3Adj + 128); + buffer[36U] = (uint8_t)(m_dmrSymLevel1Adj + 128); - buffer[32U] = (uint8_t)(m_p25SymLevel3Adj + 128); - buffer[33U] = (uint8_t)(m_p25SymLevel1Adj + 128); + buffer[37U] = (uint8_t)(m_p25SymLevel3Adj + 128); + buffer[38U] = (uint8_t)(m_p25SymLevel1Adj + 128); + + // software signature + std::string software; + software.append(__NET_NAME__ " " __VER__ " (built " __BUILD__ ")"); + for (uint8_t i = 0; i < software.length(); i++) { + buffer[192U + i] = software[i]; + } // configuration version buffer[DVM_CONF_AREA_LEN] = DVM_CONF_AREA_VER; diff --git a/modem/Modem.cpp b/modem/Modem.cpp index 038ded3f..e75c2b7c 100644 --- a/modem/Modem.cpp +++ b/modem/Modem.cpp @@ -53,6 +53,28 @@ using namespace modem; #include #endif +// --------------------------------------------------------------------------- +// Constants +// --------------------------------------------------------------------------- + +#define CONFIG_OPT_MISMATCH_STR "Configuration option mismatch; " +#define CONFIG_OPT_ALTERED_STR "Configuration option manually altered; " +#define MODEM_CONFIG_AREA_DISAGREE_STR "modem configuration area disagreement, " + +// --------------------------------------------------------------------------- +// Macros +// --------------------------------------------------------------------------- +// Check flash configuration value against class value. +#define FLASH_VALUE_CHECK(_CLASS_VAL, _FLASH_VAL, _DEFAULT, _STR) \ + if (_CLASS_VAL == _DEFAULT && _CLASS_VAL != _FLASH_VAL) { \ + LogWarning(LOG_MODEM, CONFIG_OPT_MISMATCH_STR MODEM_CONFIG_AREA_DISAGREE_STR _STR " = %u, " _STR " (flash) = %u", _CLASS_VAL, _FLASH_VAL); \ + _CLASS_VAL = _FLASH_VAL; \ + } else { \ + if (_CLASS_VAL != _DEFAULT && _CLASS_VAL != _FLASH_VAL) { \ + LogWarning(LOG_MODEM, CONFIG_OPT_ALTERED_STR MODEM_CONFIG_AREA_DISAGREE_STR _STR " = %u, " _STR " (flash) = %u", _CLASS_VAL, _FLASH_VAL); \ + } \ + } + // --------------------------------------------------------------------------- // Public Class Members // --------------------------------------------------------------------------- @@ -69,12 +91,14 @@ using namespace modem; /// Count of FDMA preambles to transmit before data. (P25/DMR DMO) /// Compensate for delay in receiver audio chain in ms. Usually DSP based. /// P25 Correlation Countdown. -/// Flag indicating whether the ADC/DAC overflow reset logic is disabled. /// Length of time in MS between packets to send to modem. +/// Flag indicating whether the ADC/DAC overflow reset logic is disabled. +/// Flag indicating whether the modem configuration area is ignored. /// Flag indicating whether air interface modem trace is enabled. /// Flag indicating whether air interface modem debug is enabled. -Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, - bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug) : +Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, bool cosLockout, + uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, uint8_t packetPlayoutTime, bool disableOFlowReset, + bool ignoreModemConfigArea, bool trace, bool debug) : m_port(port), m_dmrColorCode(0U), m_p25NAC(0x293U), @@ -98,7 +122,9 @@ Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, m_txDCOffset(0), m_isHotspot(false), m_rxFrequency(0U), + m_rxTuning(0), m_txFrequency(0U), + m_txTuning(0), m_rfPower(0U), m_dmrDiscBWAdj(0), m_p25DiscBWAdj(0), @@ -136,6 +162,7 @@ Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, m_cd(false), m_lockout(false), m_error(false), + m_ignoreModemConfigArea(ignoreModemConfigArea), m_flashDisabled(false), m_trace(trace), m_debug(debug), @@ -237,13 +264,15 @@ void Modem::setSymbolAdjust(int dmrSymLevel3Adj, int dmrSymLevel1Adj, int p25Sym /// /// /// -void Modem::setRFParams(uint32_t rxFreq, uint32_t txFreq, uint8_t rfPower, int8_t dmrDiscBWAdj, int8_t p25DiscBWAdj, - int8_t dmrPostBWAdj, int8_t p25PostBWAdj, ADF_GAIN_MODE gainMode) +void Modem::setRFParams(uint32_t rxFreq, uint32_t txFreq, int rxTuning, int txTuning, uint8_t rfPower, + int8_t dmrDiscBWAdj, int8_t p25DiscBWAdj, int8_t dmrPostBWAdj, int8_t p25PostBWAdj, ADF_GAIN_MODE gainMode) { m_adfGainMode = gainMode; m_rfPower = rfPower; m_rxFrequency = rxFreq; + m_rxTuning = rxTuning; m_txFrequency = txFreq; + m_txTuning = txTuning; m_dmrDiscBWAdj = dmrDiscBWAdj; m_p25DiscBWAdj = p25DiscBWAdj; @@ -1511,15 +1540,17 @@ bool Modem::writeRFParams() 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; + uint32_t rxActualFreq = m_rxFrequency + m_rxTuning; + buffer[4U] = (rxActualFreq >> 0) & 0xFFU; + buffer[5U] = (rxActualFreq >> 8) & 0xFFU; + buffer[6U] = (rxActualFreq >> 16) & 0xFFU; + buffer[7U] = (rxActualFreq >> 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; + uint32_t txActualFreq = m_txFrequency + m_txTuning; + buffer[8U] = (txActualFreq >> 0) & 0xFFU; + buffer[9U] = (txActualFreq >> 8) & 0xFFU; + buffer[10U] = (txActualFreq >> 16) & 0xFFU; + buffer[11U] = (txActualFreq >> 24) & 0xFFU; buffer[12U] = (unsigned char)(m_rfPower * 2.55F + 0.5F); @@ -1609,7 +1640,7 @@ bool Modem::readFlash() LogError(LOG_MODEM, "Modem::readFlash(), invalid version for configuration area, %02X != %02X", DVM_CONF_AREA_VER, confAreaVersion); } else { - processFlashConfig(m_buffer + 3U); + processFlashConfig(m_buffer); } } else { @@ -1639,7 +1670,76 @@ bool Modem::readFlash() /// void Modem::processFlashConfig(const uint8_t *buffer) { - // TODO TODO TODO + if (m_ignoreModemConfigArea) { + LogMessage(LOG_MODEM, "Modem configuration area checking is disabled!"); + return; + } + + // general config + bool rxInvert = (buffer[3U] & 0x01U) == 0x01U; + FLASH_VALUE_CHECK(m_rxInvert, rxInvert, false, "rxInvert"); + bool txInvert = (buffer[3U] & 0x02U) == 0x02U; + FLASH_VALUE_CHECK(m_txInvert, txInvert, false, "txInvert"); + bool pttInvert = (buffer[3U] & 0x04U) == 0x04U; + FLASH_VALUE_CHECK(m_pttInvert, pttInvert, false, "pttInvert"); + + bool dcBlocker = (buffer[4U] & 0x01U) == 0x01U; + FLASH_VALUE_CHECK(m_dcBlocker, dcBlocker, true, "dcBlocker"); + + uint8_t fdmaPreamble = buffer[5U]; + FLASH_VALUE_CHECK(m_fdmaPreamble, fdmaPreamble, 80U, "fdmaPreamble"); + + // levels + float rxLevel = (float(buffer[7U]) - 0.5F) / 2.55F; + FLASH_VALUE_CHECK(m_rxLevel, rxLevel, 50.0F, "rxLevel"); + + float txLevel = (float(buffer[8U]) - 0.5F) / 2.55F; + FLASH_VALUE_CHECK(m_cwIdTXLevel, txLevel, 50.0F, "cwIdTxLevel"); + FLASH_VALUE_CHECK(m_dmrTXLevel, txLevel, 50.0F, "dmrTxLevel"); + FLASH_VALUE_CHECK(m_p25TXLevel, txLevel, 50.0F, "p25TxLevel"); + + uint8_t dmrRxDelay = buffer[10U]; + FLASH_VALUE_CHECK(m_dmrRxDelay, dmrRxDelay, 7U, "dmrRxDelay"); + + uint8_t p25CorrCount = buffer[11U]; + FLASH_VALUE_CHECK(m_p25CorrCount, p25CorrCount, 8U, "p25CorrCount"); + + int txDCOffset = int(buffer[16U]) - 128; + FLASH_VALUE_CHECK(m_txDCOffset, txDCOffset, 0, "txDCOffset"); + + int rxDCOffset = int(buffer[17U]) - 128; + FLASH_VALUE_CHECK(m_rxDCOffset, rxDCOffset, 0, "rxDCOffset"); + + // RF parameters + int8_t dmrDiscBWAdj = int8_t(buffer[20U]) - 128; + FLASH_VALUE_CHECK(m_dmrDiscBWAdj, dmrDiscBWAdj, 0, "dmrDiscBWAdj"); + int8_t p25DiscBWAdj = int8_t(buffer[21U]) - 128; + FLASH_VALUE_CHECK(m_p25DiscBWAdj, p25DiscBWAdj, 0, "p25DiscBWAdj"); + int8_t dmrPostBWAdj = int8_t(buffer[22U]) - 128; + FLASH_VALUE_CHECK(m_dmrPostBWAdj, dmrPostBWAdj, 0, "dmrPostBWAdj"); + int8_t p25PostBWAdj = int8_t(buffer[23U]) - 128; + FLASH_VALUE_CHECK(m_p25PostBWAdj, p25PostBWAdj, 0, "p25PostBWAdj"); + + ADF_GAIN_MODE adfGainMode = (ADF_GAIN_MODE)buffer[24U]; + FLASH_VALUE_CHECK(m_adfGainMode, adfGainMode, ADF_GAIN_AUTO, "adfGainMode"); + + uint32_t txTuningRaw = __GET_UINT32(buffer, 25U); + int txTuning = int(txTuningRaw); + FLASH_VALUE_CHECK(m_txTuning, txTuning, 0, "txTuning"); + uint32_t rxTuningRaw = __GET_UINT32(buffer, 29U); + int rxTuning = int(rxTuningRaw); + FLASH_VALUE_CHECK(m_rxTuning, rxTuning, 0, "rxTuning"); + + // symbol adjust + int dmrSymLevel3Adj = int(buffer[35U]) - 128; + FLASH_VALUE_CHECK(m_dmrSymLevel3Adj, dmrSymLevel3Adj, 0, "dmrSymLevel3Adj"); + int dmrSymLevel1Adj = int(buffer[36U]) - 128; + FLASH_VALUE_CHECK(m_dmrSymLevel1Adj, dmrSymLevel1Adj, 0, "dmrSymLevel1Adj"); + + int p25SymLevel3Adj = int(buffer[37U]) - 128; + FLASH_VALUE_CHECK(m_p25SymLevel3Adj, p25SymLevel3Adj, 0, "p25SymLevel3Adj"); + int p25SymLevel1Adj = int(buffer[38U]) - 128; + FLASH_VALUE_CHECK(m_p25SymLevel1Adj, p25SymLevel1Adj, 0, "p25SymLevel1Adj"); } /// diff --git a/modem/Modem.h b/modem/Modem.h index 9c4253a8..82a5b10e 100644 --- a/modem/Modem.h +++ b/modem/Modem.h @@ -199,8 +199,9 @@ namespace modem class HOST_SW_API Modem { public: /// Initializes a new instance of the Modem class. - Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, - bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug); + Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, bool cosLockout, + uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, uint8_t packetPlayoutTime, bool disableOFlowReset, + bool ignoreModemConfigArea, bool trace, bool debug); /// Finalizes a instance of the Modem class. ~Modem(); @@ -213,7 +214,7 @@ namespace modem /// Sets the symbol adjustment levels. void setSymbolAdjust(int dmrSymLevel3Adj, int dmrSymLevel1Adj, int p25SymLevel3Adj, int p25SymLevel1Adj); /// Sets the RF parameters. - void setRFParams(uint32_t rxFreq, uint32_t txFreq, uint8_t rfPower, int8_t dmrDiscBWAdj, int8_t p25DiscBWAdj, + void setRFParams(uint32_t rxFreq, uint32_t txFreq, int rxTuning, int txTuning, uint8_t rfPower, int8_t dmrDiscBWAdj, int8_t p25DiscBWAdj, int8_t dmrPostBWAdj, int8_t p25PostBWAdj, ADF_GAIN_MODE gainMode); /// Sets the DMR color code. void setDMRColorCode(uint32_t colorCode); @@ -343,7 +344,9 @@ namespace modem bool m_isHotspot; uint32_t m_rxFrequency; // hotspot modem - Rx Frequency + int m_rxTuning; // hotspot modem - Rx Frequency Offset uint32_t m_txFrequency; // hotspot modem - Tx Frequency + int m_txTuning; // hotspot modem - Tx Frequency Offset uint8_t m_rfPower; // hotspot modem - RF power int8_t m_dmrDiscBWAdj; // hotspot modem - DMR discriminator BW adjustment @@ -393,6 +396,7 @@ namespace modem bool m_lockout; bool m_error; + bool m_ignoreModemConfigArea; bool m_flashDisabled; /// Retrieve the air interface modem version. diff --git a/network/Network.cpp b/network/Network.cpp index 602ba529..70e0a79a 100644 --- a/network/Network.cpp +++ b/network/Network.cpp @@ -493,7 +493,7 @@ bool Network::writeAuthorisation() /// bool Network::writeConfig() { - const char* software = "DVM_DMR_P25"; + const char* software = __NET_NAME__; json::object config = json::object(); @@ -513,7 +513,7 @@ bool Network::writeConfig() // channel data json::object channel = json::object(); - channel["txPower"].set(m_power); // Tx Power + channel["txPower"].set(m_power); // Tx Power channel["txOffsetMhz"].set(m_txOffsetMhz); // Tx Offset (Mhz) channel["chBandwidthKhz"].set(m_chBandwidthKhz); // Ch. Bandwidth (khz) channel["channelId"].set(m_channelId); // Channel ID