mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-26 03:15:40 +08:00
Merge remote-tracking branch 'g4klx/master'
This commit is contained in:
54
Conf.cpp
54
Conf.cpp
@@ -76,6 +76,7 @@ m_logFilePath(),
|
||||
m_logFileRoot(),
|
||||
m_cwIdEnabled(false),
|
||||
m_cwIdTime(10U),
|
||||
m_cwIdCallsign(),
|
||||
m_dmrIdLookupFile(),
|
||||
m_dmrIdLookupTime(0U),
|
||||
m_modemPort(),
|
||||
@@ -91,7 +92,6 @@ m_modemDMRTXLevel(50U),
|
||||
m_modemYSFTXLevel(50U),
|
||||
m_modemP25TXLevel(50U),
|
||||
m_modemRSSIMappingFile(),
|
||||
m_modemSamplesDir(),
|
||||
m_modemDebug(false),
|
||||
m_umpEnabled(false),
|
||||
m_umpPort(),
|
||||
@@ -253,7 +253,7 @@ bool CConf::read()
|
||||
// Convert the callsign to upper case
|
||||
for (unsigned int i = 0U; value[i] != 0; i++)
|
||||
value[i] = ::toupper(value[i]);
|
||||
m_callsign = value;
|
||||
m_cwIdCallsign = m_callsign = value;
|
||||
} else if (::strcmp(key, "Timeout") == 0)
|
||||
m_timeout = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Duplex") == 0)
|
||||
@@ -301,6 +301,12 @@ bool CConf::read()
|
||||
m_cwIdEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Time") == 0)
|
||||
m_cwIdTime = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Callsign") == 0) {
|
||||
// Convert the callsign to upper case
|
||||
for (unsigned int i = 0U; value[i] != 0; i++)
|
||||
value[i] = ::toupper(value[i]);
|
||||
m_cwIdCallsign = value;
|
||||
}
|
||||
} else if (section == SECTION_DMRID_LOOKUP) {
|
||||
if (::strcmp(key, "File") == 0)
|
||||
m_dmrIdLookupFile = value;
|
||||
@@ -335,8 +341,6 @@ bool CConf::read()
|
||||
m_modemP25TXLevel = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "RSSIMappingFile") == 0)
|
||||
m_modemRSSIMappingFile = value;
|
||||
else if (::strcmp(key, "SamplesDir") == 0)
|
||||
m_modemSamplesDir = value;
|
||||
else if (::strcmp(key, "Debug") == 0)
|
||||
m_modemDebug = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_UMP) {
|
||||
@@ -570,22 +574,22 @@ bool CConf::read()
|
||||
|
||||
std::string CConf::getCallsign() const
|
||||
{
|
||||
return m_callsign;
|
||||
return m_callsign;
|
||||
}
|
||||
|
||||
unsigned int CConf::getTimeout() const
|
||||
{
|
||||
return m_timeout;
|
||||
return m_timeout;
|
||||
}
|
||||
|
||||
bool CConf::getDuplex() const
|
||||
{
|
||||
return m_duplex;
|
||||
return m_duplex;
|
||||
}
|
||||
|
||||
unsigned int CConf::getRFModeHang() const
|
||||
{
|
||||
return m_rfModeHang;
|
||||
return m_rfModeHang;
|
||||
}
|
||||
|
||||
unsigned int CConf::getNetModeHang() const
|
||||
@@ -595,7 +599,7 @@ unsigned int CConf::getNetModeHang() const
|
||||
|
||||
std::string CConf::getDisplay() const
|
||||
{
|
||||
return m_display;
|
||||
return m_display;
|
||||
}
|
||||
|
||||
bool CConf::getDaemon() const
|
||||
@@ -660,12 +664,12 @@ unsigned int CConf::getLogFileLevel() const
|
||||
|
||||
std::string CConf::getLogFilePath() const
|
||||
{
|
||||
return m_logFilePath;
|
||||
return m_logFilePath;
|
||||
}
|
||||
|
||||
std::string CConf::getLogFileRoot() const
|
||||
{
|
||||
return m_logFileRoot;
|
||||
return m_logFileRoot;
|
||||
}
|
||||
|
||||
bool CConf::getCWIdEnabled() const
|
||||
@@ -678,6 +682,11 @@ unsigned int CConf::getCWIdTime() const
|
||||
return m_cwIdTime;
|
||||
}
|
||||
|
||||
std::string CConf::getCWIdCallsign() const
|
||||
{
|
||||
return m_cwIdCallsign;
|
||||
}
|
||||
|
||||
std::string CConf::getDMRIdLookupFile() const
|
||||
{
|
||||
return m_dmrIdLookupFile;
|
||||
@@ -753,11 +762,6 @@ std::string CConf::getModemRSSIMappingFile () const
|
||||
return m_modemRSSIMappingFile;
|
||||
}
|
||||
|
||||
std::string CConf::getModemSamplesDir() const
|
||||
{
|
||||
return m_modemSamplesDir;
|
||||
}
|
||||
|
||||
bool CConf::getModemDebug() const
|
||||
{
|
||||
return m_modemDebug;
|
||||
@@ -900,17 +904,17 @@ bool CConf::getDStarNetworkEnabled() const
|
||||
|
||||
std::string CConf::getDStarGatewayAddress() const
|
||||
{
|
||||
return m_dstarGatewayAddress;
|
||||
return m_dstarGatewayAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDStarGatewayPort() const
|
||||
{
|
||||
return m_dstarGatewayPort;
|
||||
return m_dstarGatewayPort;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDStarLocalPort() const
|
||||
{
|
||||
return m_dstarLocalPort;
|
||||
return m_dstarLocalPort;
|
||||
}
|
||||
|
||||
bool CConf::getDStarNetworkDebug() const
|
||||
@@ -925,12 +929,12 @@ bool CConf::getDMRNetworkEnabled() const
|
||||
|
||||
std::string CConf::getDMRNetworkAddress() const
|
||||
{
|
||||
return m_dmrNetworkAddress;
|
||||
return m_dmrNetworkAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetworkPort() const
|
||||
{
|
||||
return m_dmrNetworkPort;
|
||||
return m_dmrNetworkPort;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRNetworkLocal() const
|
||||
@@ -940,7 +944,7 @@ unsigned int CConf::getDMRNetworkLocal() const
|
||||
|
||||
std::string CConf::getDMRNetworkPassword() const
|
||||
{
|
||||
return m_dmrNetworkPassword;
|
||||
return m_dmrNetworkPassword;
|
||||
}
|
||||
|
||||
std::string CConf::getDMRNetworkOptions() const
|
||||
@@ -985,12 +989,12 @@ unsigned int CConf::getFusionNetworkMyPort() const
|
||||
|
||||
std::string CConf::getFusionNetworkGwyAddress() const
|
||||
{
|
||||
return m_fusionNetworkGwyAddress;
|
||||
return m_fusionNetworkGwyAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getFusionNetworkGwyPort() const
|
||||
{
|
||||
return m_fusionNetworkGwyPort;
|
||||
return m_fusionNetworkGwyPort;
|
||||
}
|
||||
|
||||
bool CConf::getFusionNetworkDebug() const
|
||||
@@ -1030,7 +1034,7 @@ bool CConf::getP25OverrideUID() const
|
||||
|
||||
std::string CConf::getTFTSerialPort() const
|
||||
{
|
||||
return m_tftSerialPort;
|
||||
return m_tftSerialPort;
|
||||
}
|
||||
|
||||
unsigned int CConf::getTFTSerialBrightness() const
|
||||
|
||||
4
Conf.h
4
Conf.h
@@ -59,6 +59,7 @@ public:
|
||||
// The CW ID section
|
||||
bool getCWIdEnabled() const;
|
||||
unsigned int getCWIdTime() const;
|
||||
std::string getCWIdCallsign() const;
|
||||
|
||||
// The DMR Id section
|
||||
std::string getDMRIdLookupFile() const;
|
||||
@@ -78,7 +79,6 @@ public:
|
||||
unsigned int getModemYSFTXLevel() const;
|
||||
unsigned int getModemP25TXLevel() const;
|
||||
std::string getModemRSSIMappingFile() const;
|
||||
std::string getModemSamplesDir() const;
|
||||
bool getModemDebug() const;
|
||||
|
||||
// The UMP section
|
||||
@@ -215,6 +215,7 @@ private:
|
||||
|
||||
bool m_cwIdEnabled;
|
||||
unsigned int m_cwIdTime;
|
||||
std::string m_cwIdCallsign;
|
||||
|
||||
std::string m_dmrIdLookupFile;
|
||||
unsigned int m_dmrIdLookupTime;
|
||||
@@ -232,7 +233,6 @@ private:
|
||||
unsigned int m_modemYSFTXLevel;
|
||||
unsigned int m_modemP25TXLevel;
|
||||
std::string m_modemRSSIMappingFile;
|
||||
std::string m_modemSamplesDir;
|
||||
bool m_modemDebug;
|
||||
|
||||
bool m_umpEnabled;
|
||||
|
||||
@@ -29,6 +29,7 @@ FileRoot=MMDVM
|
||||
[CW Id]
|
||||
Enable=1
|
||||
Time=10
|
||||
# Callsign=
|
||||
|
||||
[DMR Id Lookup]
|
||||
File=DMRIds.dat
|
||||
@@ -50,7 +51,6 @@ TXLevel=50
|
||||
# YSFTXLevel=50
|
||||
# P25TXLevel=50
|
||||
RSSIMappingFile=RSSI.dat
|
||||
SamplesDir=.
|
||||
Debug=0
|
||||
|
||||
[UMP]
|
||||
|
||||
@@ -144,7 +144,8 @@ m_ysfEnabled(false),
|
||||
m_p25Enabled(false),
|
||||
m_cwIdTime(0U),
|
||||
m_lookup(NULL),
|
||||
m_callsign()
|
||||
m_callsign(),
|
||||
m_cwCallsign()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -286,9 +287,11 @@ int CMMDVMHost::run()
|
||||
|
||||
if (m_conf.getCWIdEnabled()) {
|
||||
unsigned int time = m_conf.getCWIdTime();
|
||||
m_cwCallsign = m_conf.getCWIdCallsign();
|
||||
|
||||
LogInfo("CW Id Parameters");
|
||||
LogInfo(" Time: %u mins", time);
|
||||
LogInfo(" Callsign: %s", m_cwCallsign.c_str());
|
||||
|
||||
m_cwIdTime = time * 60U;
|
||||
|
||||
@@ -716,7 +719,7 @@ int CMMDVMHost::run()
|
||||
if (m_mode == MODE_IDLE && !m_modem->hasTX()){
|
||||
LogDebug("sending CW ID");
|
||||
m_display->writeCW();
|
||||
m_modem->sendCWId(m_callsign);
|
||||
m_modem->sendCWId(m_cwCallsign);
|
||||
|
||||
m_cwIdTimer.setTimeout(m_cwIdTime);
|
||||
m_cwIdTimer.start();
|
||||
@@ -807,7 +810,6 @@ bool CMMDVMHost::createModem()
|
||||
bool lowDeviation = m_conf.getFusionLowDeviation();
|
||||
unsigned int rxFrequency = m_conf.getRxFrequency();
|
||||
unsigned int txFrequency = m_conf.getTxFrequency();
|
||||
std::string samplesDir = m_conf.getModemSamplesDir();
|
||||
|
||||
LogInfo("Modem Parameters");
|
||||
LogInfo(" Port: %s", port.c_str());
|
||||
@@ -825,7 +827,7 @@ bool CMMDVMHost::createModem()
|
||||
LogInfo(" RX Frequency: %uHz", rxFrequency);
|
||||
LogInfo(" TX Frequency: %uHz", txFrequency);
|
||||
|
||||
m_modem = new CModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, samplesDir, debug);
|
||||
m_modem = new CModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, debug);
|
||||
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled);
|
||||
m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel);
|
||||
m_modem->setRFParams(rxFrequency, txFrequency);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -64,6 +64,7 @@ private:
|
||||
unsigned int m_cwIdTime;
|
||||
CDMRLookup* m_lookup;
|
||||
std::string m_callsign;
|
||||
std::string m_cwCallsign;
|
||||
|
||||
void readParams();
|
||||
bool createModem();
|
||||
|
||||
56
Modem.cpp
56
Modem.cpp
@@ -72,8 +72,6 @@ const unsigned char MMDVM_NAK = 0x7FU;
|
||||
|
||||
const unsigned char MMDVM_SERIAL = 0x80U;
|
||||
|
||||
const unsigned char MMDVM_SAMPLES = 0xF0U;
|
||||
|
||||
const unsigned char MMDVM_DEBUG1 = 0xF1U;
|
||||
const unsigned char MMDVM_DEBUG2 = 0xF2U;
|
||||
const unsigned char MMDVM_DEBUG3 = 0xF3U;
|
||||
@@ -85,7 +83,7 @@ const unsigned int MAX_RESPONSES = 30U;
|
||||
const unsigned int BUFFER_LENGTH = 2000U;
|
||||
|
||||
|
||||
CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, const std::string& samplesDir, bool debug) :
|
||||
CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool debug) :
|
||||
m_port(port),
|
||||
m_dmrColorCode(0U),
|
||||
m_ysfLoDev(false),
|
||||
@@ -101,7 +99,6 @@ m_dstarTXLevel(0U),
|
||||
m_dmrTXLevel(0U),
|
||||
m_ysfTXLevel(0U),
|
||||
m_p25TXLevel(0U),
|
||||
m_samplesDir(samplesDir),
|
||||
m_debug(debug),
|
||||
m_rxFrequency(0U),
|
||||
m_txFrequency(0U),
|
||||
@@ -480,10 +477,6 @@ void CModem::clock(unsigned int ms)
|
||||
printDebug();
|
||||
break;
|
||||
|
||||
case MMDVM_SAMPLES:
|
||||
dumpSamples();
|
||||
break;
|
||||
|
||||
default:
|
||||
LogMessage("Unknown message, type: %02X", m_buffer[2U]);
|
||||
CUtils::dump("Buffer dump", m_buffer, m_length);
|
||||
@@ -1301,50 +1294,3 @@ void CModem::printDebug()
|
||||
LogMessage("Debug: %.*s %d %d %d %d", m_length - 11U, m_buffer + 3U, val1, val2, val3, val4);
|
||||
}
|
||||
}
|
||||
|
||||
void CModem::dumpSamples()
|
||||
{
|
||||
if (m_samplesDir.empty())
|
||||
m_samplesDir = ".";
|
||||
|
||||
time_t now;
|
||||
::time(&now);
|
||||
|
||||
struct tm* tm = ::localtime(&now);
|
||||
|
||||
const char* mode = NULL;
|
||||
switch (m_buffer[5U]) {
|
||||
case MODE_DSTAR:
|
||||
mode = "DStar";
|
||||
break;
|
||||
case MODE_DMR:
|
||||
mode = "DMR";
|
||||
break;
|
||||
case MODE_P25:
|
||||
mode = "P25";
|
||||
break;
|
||||
case MODE_YSF:
|
||||
mode = "YSF";
|
||||
break;
|
||||
default:
|
||||
LogWarning("Unknown protocol passed to samples dump - %u", m_buffer[5U]);
|
||||
return;
|
||||
}
|
||||
|
||||
char filename[150U];
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
::sprintf(filename, "%s\\Samples-%s-%04d%02d%02d.dat", m_samplesDir.c_str(), mode, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
|
||||
#else
|
||||
::sprintf(filename, "%s/Samples-%s-%04d%02d%02d.dat", m_samplesDir.c_str(), mode, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
|
||||
#endif
|
||||
|
||||
FILE* fp = ::fopen(filename, "a+b");
|
||||
if (fp == NULL) {
|
||||
LogWarning("Unable to open samples file for writing - %s", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
::fwrite(m_buffer + 6U, 1U, m_length - 6U, fp);
|
||||
|
||||
::fclose(fp);
|
||||
}
|
||||
|
||||
4
Modem.h
4
Modem.h
@@ -34,7 +34,7 @@ enum RESP_TYPE_MMDVM {
|
||||
|
||||
class CModem {
|
||||
public:
|
||||
CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, const std::string& samplesDir, bool debug = false);
|
||||
CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool debug = false);
|
||||
~CModem();
|
||||
|
||||
void setRFParams(unsigned int rxFrequency, unsigned int txFrequency);
|
||||
@@ -103,7 +103,6 @@ private:
|
||||
unsigned int m_dmrTXLevel;
|
||||
unsigned int m_ysfTXLevel;
|
||||
unsigned int m_p25TXLevel;
|
||||
std::string m_samplesDir;
|
||||
bool m_debug;
|
||||
unsigned int m_rxFrequency;
|
||||
unsigned int m_txFrequency;
|
||||
@@ -145,7 +144,6 @@ private:
|
||||
bool setFrequency();
|
||||
|
||||
void printDebug();
|
||||
void dumpSamples();
|
||||
|
||||
RESP_TYPE_MMDVM getResponse();
|
||||
};
|
||||
|
||||
41
RSSI/RSSI_GM340_DEIv1.1.dat
Normal file
41
RSSI/RSSI_GM340_DEIv1.1.dat
Normal file
@@ -0,0 +1,41 @@
|
||||
# This file maps the raw RSSI values to dBm values to send to the DMR network. A number of data
|
||||
# points should be entered and the software will use those to work out the in-between values.
|
||||
#
|
||||
# The format of the file is:
|
||||
# Raw RSSI Value dBm Value #output voltage
|
||||
#
|
||||
# The following values were measured with a Marconi 2024 signal generator.
|
||||
# Setup is MMDVM (PCB by Toufik, F0DEI v1.1) on a STM32F446RE Nucleo board.
|
||||
# The values in the comments are the voltage measured at the GM340 RSSI output pin.
|
||||
# Florian DF2ET, 07.04.2017
|
||||
#
|
||||
1461 -46 #1.87
|
||||
1461 -49 #1.87
|
||||
1457 -52 #1.86
|
||||
1446 -55 #1.85
|
||||
1422 -58 #1.82
|
||||
1381 -61 #1.77
|
||||
1334 -64 #1.71
|
||||
1284 -67 #1.64
|
||||
1240 -70 #1.59
|
||||
1200 -73 #1.54
|
||||
1162 -76 #1.49
|
||||
1121 -79 #1.44
|
||||
1073 -82 #1.38
|
||||
1032 -85 #1.32
|
||||
995 -88 #1.28
|
||||
961 -91 #1.23
|
||||
921 -94 #1.18
|
||||
878 -97 #1.13
|
||||
830 -100 #1.07
|
||||
785 -103 #1.01
|
||||
742 -106 #0.95
|
||||
701 -109 #0.90
|
||||
657 -112 #0.85
|
||||
610 -115 #0.79
|
||||
571 -118 #0.74
|
||||
536 -121 #0.69
|
||||
505 -124 #0.65
|
||||
479 -127 #0.62
|
||||
463 -130 #0.60
|
||||
454 -133 #0.59
|
||||
41
RSSI/RSSI_GM340_NTHv6.2.1.dat
Normal file
41
RSSI/RSSI_GM340_NTHv6.2.1.dat
Normal file
@@ -0,0 +1,41 @@
|
||||
# This file maps the raw RSSI values to dBm values to send to the DMR network. A number of data
|
||||
# points should be entered and the software will use those to work out the in-between values.
|
||||
#
|
||||
# The format of the file is:
|
||||
# Raw RSSI Value dBm Value #output voltage
|
||||
#
|
||||
# The following values were measured with a Marconi 2024 signal generator.
|
||||
# Setup is MMDVM (SP8NTH v6.2.1) on a Arduino Due board.
|
||||
# The values in the comments are the voltage measured at the GM340 RSSI output pin.
|
||||
# Florian DF2ET, 07.04.2017
|
||||
#
|
||||
1475 -46 #1.88
|
||||
1475 -49 #1.89
|
||||
1471 -52 #1.88
|
||||
1459 -55 #1.87
|
||||
1435 -58 #1.84
|
||||
1394 -61 #1.78
|
||||
1346 -64 #1.72
|
||||
1296 -67 #1.66
|
||||
1252 -70 #1.60
|
||||
1211 -73 #1.55
|
||||
1174 -76 #1.50
|
||||
1132 -79 #1.45
|
||||
1087 -82 #1.39
|
||||
1042 -85 #1.34
|
||||
1006 -88 #1.29
|
||||
971 -91 #1.25
|
||||
931 -94 #1.20
|
||||
887 -97 #1.14
|
||||
840 -100 #1.08
|
||||
794 -103 #1.02
|
||||
751 -106 #0.97
|
||||
710 -109 #0.91
|
||||
665 -112 #0.86
|
||||
620 -115 #0.80
|
||||
579 -118 #0.75
|
||||
544 -121 #0.70
|
||||
514 -124 #0.66
|
||||
490 -127 #0.63
|
||||
475 -130 #0.61
|
||||
466 -133 #0.60
|
||||
@@ -4,7 +4,7 @@
|
||||
# The format of the file is:
|
||||
# Raw RSSI Value dBm Value
|
||||
#
|
||||
# Measured with a Marconi 2955 Test set and Motorola GM340 UHF (430.6125 MHz) using Arduino DUE.
|
||||
# Measured with a Marconi 2955 Test set and Motorola GM340 UHF (430.6125 MHz) using Arduino DUE with ZUM v1.0.
|
||||
# No resistor divider, 100nF decoupling capacitor from ADC to ground.
|
||||
# Both S-meter (6dB) and decade (10dB) steps are included between the noise floor and saturation.
|
||||
# George M1GEO / GB7KH - 01/01/2017
|
||||
@@ -5,7 +5,7 @@
|
||||
# Raw RSSI Value dBm Value #output voltage
|
||||
#
|
||||
# The following values were measured with a Marconi 2024 signal generator.
|
||||
# Setup is MMDVM (PCB by Toufik, F0DEI) on a STM32F446RE Nucleo board.
|
||||
# Setup is MMDVM (PCB by Toufik, F0DEI v1.1) on a STM32F446RE Nucleo board.
|
||||
# The values in the comments are the voltage measured at the TB7100 RSSI output pin.
|
||||
# Florian DF2ET, 03.03.2017
|
||||
#
|
||||
Reference in New Issue
Block a user