Use a linear interpolator for the reported RSSI values.
This commit is contained in:
parent
59080e1bd7
commit
aac48cb58f
18
Conf.cpp
18
Conf.cpp
|
@ -91,8 +91,7 @@ m_modemDMRTXLevel(50U),
|
||||||
m_modemYSFTXLevel(50U),
|
m_modemYSFTXLevel(50U),
|
||||||
m_modemP25TXLevel(50U),
|
m_modemP25TXLevel(50U),
|
||||||
m_modemOscOffset(0),
|
m_modemOscOffset(0),
|
||||||
m_modemRSSIMultiplier(0),
|
m_modemRSSIMappingFile(),
|
||||||
m_modemRSSIOffset(0),
|
|
||||||
m_modemDebug(false),
|
m_modemDebug(false),
|
||||||
m_umpEnabled(false),
|
m_umpEnabled(false),
|
||||||
m_umpPort(),
|
m_umpPort(),
|
||||||
|
@ -327,10 +326,8 @@ bool CConf::read()
|
||||||
m_modemP25TXLevel = (unsigned int)::atoi(value);
|
m_modemP25TXLevel = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "OscOffset") == 0)
|
else if (::strcmp(key, "OscOffset") == 0)
|
||||||
m_modemOscOffset = ::atoi(value);
|
m_modemOscOffset = ::atoi(value);
|
||||||
else if (::strcmp(key, "RSSIMultiplier") == 0)
|
else if (::strcmp(key, "RSSIMappingFile") == 0)
|
||||||
m_modemRSSIMultiplier = ::atoi(value);
|
m_modemRSSIMappingFile = value;
|
||||||
else if (::strcmp(key, "RSSIOffset") == 0)
|
|
||||||
m_modemRSSIOffset = ::atoi(value);
|
|
||||||
else if (::strcmp(key, "Debug") == 0)
|
else if (::strcmp(key, "Debug") == 0)
|
||||||
m_modemDebug = ::atoi(value) == 1;
|
m_modemDebug = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_UMP) {
|
} else if (section == SECTION_UMP) {
|
||||||
|
@ -724,14 +721,9 @@ int CConf::getModemOscOffset() const
|
||||||
return m_modemOscOffset;
|
return m_modemOscOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CConf::getModemRSSIMultiplier () const
|
std::string CConf::getModemRSSIMappingFile () const
|
||||||
{
|
{
|
||||||
return m_modemRSSIMultiplier;
|
return m_modemRSSIMappingFile;
|
||||||
}
|
|
||||||
|
|
||||||
int CConf::getModemRSSIOffset() const
|
|
||||||
{
|
|
||||||
return m_modemRSSIOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getModemDebug() const
|
bool CConf::getModemDebug() const
|
||||||
|
|
6
Conf.h
6
Conf.h
|
@ -78,8 +78,7 @@ public:
|
||||||
unsigned int getModemYSFTXLevel() const;
|
unsigned int getModemYSFTXLevel() const;
|
||||||
unsigned int getModemP25TXLevel() const;
|
unsigned int getModemP25TXLevel() const;
|
||||||
int getModemOscOffset() const;
|
int getModemOscOffset() const;
|
||||||
int getModemRSSIMultiplier() const;
|
std::string getModemRSSIMappingFile() const;
|
||||||
int getModemRSSIOffset() const;
|
|
||||||
bool getModemDebug() const;
|
bool getModemDebug() const;
|
||||||
|
|
||||||
// The UMP section
|
// The UMP section
|
||||||
|
@ -227,8 +226,7 @@ private:
|
||||||
unsigned int m_modemYSFTXLevel;
|
unsigned int m_modemYSFTXLevel;
|
||||||
unsigned int m_modemP25TXLevel;
|
unsigned int m_modemP25TXLevel;
|
||||||
int m_modemOscOffset;
|
int m_modemOscOffset;
|
||||||
int m_modemRSSIMultiplier;
|
std::string m_modemRSSIMappingFile;
|
||||||
int m_modemRSSIOffset;
|
|
||||||
bool m_modemDebug;
|
bool m_modemDebug;
|
||||||
|
|
||||||
bool m_umpEnabled;
|
bool m_umpEnabled;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter) :
|
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter) :
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_colorCode(colorCode),
|
m_colorCode(colorCode),
|
||||||
m_modem(modem),
|
m_modem(modem),
|
||||||
|
@ -34,11 +34,12 @@ m_lookup(lookup)
|
||||||
assert(modem != NULL);
|
assert(modem != NULL);
|
||||||
assert(display != NULL);
|
assert(display != NULL);
|
||||||
assert(lookup != NULL);
|
assert(lookup != NULL);
|
||||||
|
assert(rssi != NULL);
|
||||||
|
|
||||||
// Load black and white lists to DMRAccessControl
|
// Load black and white lists to DMRAccessControl
|
||||||
CDMRAccessControl::init(blacklist, whitelist, selfOnly, prefixes, id);
|
CDMRAccessControl::init(blacklist, whitelist, selfOnly, prefixes, id);
|
||||||
|
|
||||||
CDMRSlot::init(colorCode, callHang, modem, network, display, duplex, m_lookup, rssiMultiplier, rssiOffset, jitter);
|
CDMRSlot::init(colorCode, callHang, modem, network, display, duplex, m_lookup, rssi, jitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDMRControl::~CDMRControl()
|
CDMRControl::~CDMRControl()
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#if !defined(DMRControl_H)
|
#if !defined(DMRControl_H)
|
||||||
#define DMRControl_H
|
#define DMRControl_H
|
||||||
|
|
||||||
|
#include "RSSIInterpolator.h"
|
||||||
#include "DMRNetwork.h"
|
#include "DMRNetwork.h"
|
||||||
#include "DMRLookup.h"
|
#include "DMRLookup.h"
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
|
|
||||||
class CDMRControl {
|
class CDMRControl {
|
||||||
public:
|
public:
|
||||||
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter);
|
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter);
|
||||||
~CDMRControl();
|
~CDMRControl();
|
||||||
|
|
||||||
bool processWakeup(const unsigned char* data);
|
bool processWakeup(const unsigned char* data);
|
||||||
|
|
13
DMRSlot.cpp
13
DMRSlot.cpp
|
@ -37,8 +37,7 @@ bool CDMRSlot::m_duplex = true;
|
||||||
CDMRLookup* CDMRSlot::m_lookup = NULL;
|
CDMRLookup* CDMRSlot::m_lookup = NULL;
|
||||||
unsigned int CDMRSlot::m_hangCount = 3U * 17U;
|
unsigned int CDMRSlot::m_hangCount = 3U * 17U;
|
||||||
|
|
||||||
int CDMRSlot::m_rssiMultiplier = 0;
|
CRSSIInterpolator* CDMRSlot::m_rssiMapper = NULL;
|
||||||
int CDMRSlot::m_rssiOffset = 0;
|
|
||||||
|
|
||||||
unsigned int CDMRSlot::m_jitterTime = 300U;
|
unsigned int CDMRSlot::m_jitterTime = 300U;
|
||||||
unsigned int CDMRSlot::m_jitterSlots = 5U;
|
unsigned int CDMRSlot::m_jitterSlots = 5U;
|
||||||
|
@ -120,11 +119,11 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have we got RSSI bytes on the end?
|
// Have we got RSSI bytes on the end?
|
||||||
if (len == (DMR_FRAME_LENGTH_BYTES + 4U) && m_rssiMultiplier != 0) {
|
if (len == (DMR_FRAME_LENGTH_BYTES + 4U)) {
|
||||||
uint16_t raw = 0U;
|
uint16_t raw = 0U;
|
||||||
raw |= (data[35U] << 8) & 0xFF00U;
|
raw |= (data[35U] << 8) & 0xFF00U;
|
||||||
raw |= (data[36U] << 0) & 0x00FFU;
|
raw |= (data[36U] << 0) & 0x00FFU;
|
||||||
int rssi = (raw - m_rssiOffset) / m_rssiMultiplier;
|
int rssi = m_rssiMapper->interpolate(raw);
|
||||||
m_rssi = (rssi >= 0) ? rssi : -rssi;
|
m_rssi = (rssi >= 0) ? rssi : -rssi;
|
||||||
LogDebug("DMR Slot %u, raw RSSI: %u, reported RSSI: -%u dBm", m_slotNo, raw, m_rssi);
|
LogDebug("DMR Slot %u, raw RSSI: %u, reported RSSI: -%u dBm", m_slotNo, raw, m_rssi);
|
||||||
}
|
}
|
||||||
|
@ -1388,11 +1387,12 @@ void CDMRSlot::writeQueueNet(const unsigned char *data)
|
||||||
m_queue.addData(data, len);
|
m_queue.addData(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRSlot::init(unsigned int colorCode, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter)
|
void CDMRSlot::init(unsigned int colorCode, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter)
|
||||||
{
|
{
|
||||||
assert(modem != NULL);
|
assert(modem != NULL);
|
||||||
assert(display != NULL);
|
assert(display != NULL);
|
||||||
assert(lookup != NULL);
|
assert(lookup != NULL);
|
||||||
|
assert(rssiMapper != NULL);
|
||||||
|
|
||||||
m_colorCode = colorCode;
|
m_colorCode = colorCode;
|
||||||
m_modem = modem;
|
m_modem = modem;
|
||||||
|
@ -1402,8 +1402,7 @@ void CDMRSlot::init(unsigned int colorCode, unsigned int callHang, CModem* modem
|
||||||
m_lookup = lookup;
|
m_lookup = lookup;
|
||||||
m_hangCount = callHang * 17U;
|
m_hangCount = callHang * 17U;
|
||||||
|
|
||||||
m_rssiMultiplier = rssiMultiplier;
|
m_rssiMapper = rssiMapper;
|
||||||
m_rssiOffset = rssiOffset;
|
|
||||||
|
|
||||||
m_jitterTime = jitter;
|
m_jitterTime = jitter;
|
||||||
m_jitterSlots = jitter / DMR_SLOT_TIME;
|
m_jitterSlots = jitter / DMR_SLOT_TIME;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#if !defined(DMRSlot_H)
|
#if !defined(DMRSlot_H)
|
||||||
#define DMRSlot_H
|
#define DMRSlot_H
|
||||||
|
|
||||||
|
#include "RSSIInterpolator.h"
|
||||||
#include "DMREmbeddedLC.h"
|
#include "DMREmbeddedLC.h"
|
||||||
#include "DMRDataHeader.h"
|
#include "DMRDataHeader.h"
|
||||||
#include "DMRNetwork.h"
|
#include "DMRNetwork.h"
|
||||||
|
@ -50,7 +51,7 @@ public:
|
||||||
|
|
||||||
void clock();
|
void clock();
|
||||||
|
|
||||||
static void init(unsigned int colorCode, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter);
|
static void init(unsigned int colorCode, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int m_slotNo;
|
unsigned int m_slotNo;
|
||||||
|
@ -95,8 +96,7 @@ private:
|
||||||
static CDMRLookup* m_lookup;
|
static CDMRLookup* m_lookup;
|
||||||
static unsigned int m_hangCount;
|
static unsigned int m_hangCount;
|
||||||
|
|
||||||
static int m_rssiMultiplier;
|
static CRSSIInterpolator* m_rssiMapper;
|
||||||
static int m_rssiOffset;
|
|
||||||
|
|
||||||
static unsigned int m_jitterTime;
|
static unsigned int m_jitterTime;
|
||||||
static unsigned int m_jitterSlots;
|
static unsigned int m_jitterSlots;
|
||||||
|
|
|
@ -50,8 +50,7 @@ TXLevel=50
|
||||||
# YSFTXLevel=50
|
# YSFTXLevel=50
|
||||||
# P25TXLevel=50
|
# P25TXLevel=50
|
||||||
OscOffset=0
|
OscOffset=0
|
||||||
RSSIMultiplier=1
|
RSSIMappingFile=RSSI.dat
|
||||||
RSSIOffset=10
|
|
||||||
Debug=0
|
Debug=0
|
||||||
|
|
||||||
[UMP]
|
[UMP]
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MMDVMHost.h"
|
#include "MMDVMHost.h"
|
||||||
|
#include "RSSIInterpolator.h"
|
||||||
#include "SerialController.h"
|
#include "SerialController.h"
|
||||||
#include "ModemSerialPort.h"
|
#include "ModemSerialPort.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
|
@ -331,17 +332,16 @@ int CMMDVMHost::run()
|
||||||
|
|
||||||
CDMRControl* dmr = NULL;
|
CDMRControl* dmr = NULL;
|
||||||
if (m_dmrEnabled) {
|
if (m_dmrEnabled) {
|
||||||
unsigned int id = m_conf.getDMRId();
|
unsigned int id = m_conf.getDMRId();
|
||||||
unsigned int colorCode = m_conf.getDMRColorCode();
|
unsigned int colorCode = m_conf.getDMRColorCode();
|
||||||
bool selfOnly = m_conf.getDMRSelfOnly();
|
bool selfOnly = m_conf.getDMRSelfOnly();
|
||||||
std::vector<unsigned int> prefixes = m_conf.getDMRPrefixes();
|
std::vector<unsigned int> prefixes = m_conf.getDMRPrefixes();
|
||||||
std::vector<unsigned int> blackList = m_conf.getDMRBlackList();
|
std::vector<unsigned int> blackList = m_conf.getDMRBlackList();
|
||||||
std::vector<unsigned int> whiteList = m_conf.getDMRWhiteList();
|
std::vector<unsigned int> whiteList = m_conf.getDMRWhiteList();
|
||||||
unsigned int callHang = m_conf.getDMRCallHang();
|
unsigned int callHang = m_conf.getDMRCallHang();
|
||||||
unsigned int txHang = m_conf.getDMRTXHang();
|
unsigned int txHang = m_conf.getDMRTXHang();
|
||||||
int rssiMultiplier = m_conf.getModemRSSIMultiplier();
|
std::string rssiMappingFile = m_conf.getModemRSSIMappingFile();
|
||||||
int rssiOffset = m_conf.getModemRSSIOffset();
|
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
||||||
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
|
||||||
|
|
||||||
if (txHang > m_rfModeHang)
|
if (txHang > m_rfModeHang)
|
||||||
txHang = m_rfModeHang;
|
txHang = m_rfModeHang;
|
||||||
|
@ -365,12 +365,13 @@ int CMMDVMHost::run()
|
||||||
LogInfo(" Call Hang: %us", callHang);
|
LogInfo(" Call Hang: %us", callHang);
|
||||||
LogInfo(" TX Hang: %us", txHang);
|
LogInfo(" TX Hang: %us", txHang);
|
||||||
|
|
||||||
if (rssiMultiplier != 0) {
|
CRSSIInterpolator* rssi = new CRSSIInterpolator;
|
||||||
LogInfo(" RSSI Multiplier: %d", rssiMultiplier);
|
if (!rssiMappingFile.empty()) {
|
||||||
LogInfo(" RSSI Offset: %d", rssiOffset);
|
LogInfo(" RSSI Mapping File: %s", rssiMappingFile.c_str());
|
||||||
|
rssi->load(rssiMappingFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList, whiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_lookup, rssiMultiplier, rssiOffset, jitter);
|
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList, whiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_lookup, rssi, jitter);
|
||||||
|
|
||||||
m_dmrTXTimer.setTimeout(txHang);
|
m_dmrTXTimer.setTimeout(txHang);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,7 @@
|
||||||
<ClInclude Include="RingBuffer.h" />
|
<ClInclude Include="RingBuffer.h" />
|
||||||
<ClInclude Include="RS129.h" />
|
<ClInclude Include="RS129.h" />
|
||||||
<ClInclude Include="RS241213.h" />
|
<ClInclude Include="RS241213.h" />
|
||||||
|
<ClInclude Include="RSSIInterpolator.h" />
|
||||||
<ClInclude Include="SerialController.h" />
|
<ClInclude Include="SerialController.h" />
|
||||||
<ClInclude Include="SerialPort.h" />
|
<ClInclude Include="SerialPort.h" />
|
||||||
<ClInclude Include="SHA256.h" />
|
<ClInclude Include="SHA256.h" />
|
||||||
|
@ -263,6 +264,7 @@
|
||||||
<ClCompile Include="QR1676.cpp" />
|
<ClCompile Include="QR1676.cpp" />
|
||||||
<ClCompile Include="RS129.cpp" />
|
<ClCompile Include="RS129.cpp" />
|
||||||
<ClCompile Include="RS241213.cpp" />
|
<ClCompile Include="RS241213.cpp" />
|
||||||
|
<ClCompile Include="RSSIInterpolator.cpp" />
|
||||||
<ClCompile Include="SerialController.cpp" />
|
<ClCompile Include="SerialController.cpp" />
|
||||||
<ClCompile Include="SerialPort.cpp" />
|
<ClCompile Include="SerialPort.cpp" />
|
||||||
<ClCompile Include="SHA256.cpp" />
|
<ClCompile Include="SHA256.cpp" />
|
||||||
|
|
|
@ -218,6 +218,9 @@
|
||||||
<ClInclude Include="UMP.h">
|
<ClInclude Include="UMP.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="RSSIInterpolator.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="BPTC19696.cpp">
|
<ClCompile Include="BPTC19696.cpp">
|
||||||
|
@ -406,5 +409,8 @@
|
||||||
<ClCompile Include="UMP.cpp">
|
<ClCompile Include="UMP.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="RSSIInterpolator.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
4
Makefile
4
Makefile
|
@ -10,8 +10,8 @@ OBJECTS = \
|
||||||
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
||||||
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
||||||
Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||||
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \
|
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \
|
||||||
UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ OBJECTS = \
|
||||||
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
||||||
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
||||||
Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||||
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \
|
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \
|
||||||
UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ OBJECTS = \
|
||||||
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
||||||
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
||||||
Golay24128.o Hamming.o HD44780.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o \
|
Golay24128.o Hamming.o HD44780.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o \
|
||||||
P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \
|
P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o \
|
||||||
Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
TFTSerial.o Thread.o Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ OBJECTS = \
|
||||||
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
||||||
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
||||||
Golay24128.o Hamming.o HD44780.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
Golay24128.o Hamming.o HD44780.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||||
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \
|
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \
|
||||||
UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ OBJECTS = \
|
||||||
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
||||||
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
||||||
Golay24128.o Hamming.o OLED.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
Golay24128.o Hamming.o OLED.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||||
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \
|
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \
|
||||||
UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ OBJECTS = \
|
||||||
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
||||||
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
||||||
Golay24128.o Hamming.o HD44780.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
Golay24128.o Hamming.o HD44780.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||||
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \
|
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \
|
||||||
UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ OBJECTS = \
|
||||||
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BCH.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRLookup.o DMRLC.o \
|
||||||
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o \
|
||||||
Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o Nextion.o NullDisplay.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
|
||||||
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o Timer.o UDPSocket.o \
|
P25Network.o P25NID.o P25Utils.o QR1676.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o StopWatch.o Sync.o TFTSerial.o Thread.o \
|
||||||
UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
Timer.o UDPSocket.o UMP.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# For example
|
||||||
|
# 1134 -90
|
||||||
|
# 1123 -100
|
||||||
|
# 1000 -109
|
||||||
|
#
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "RSSIInterpolator.h"
|
||||||
|
|
||||||
|
#include "Log.h"
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
|
CRSSIInterpolator::CRSSIInterpolator() :
|
||||||
|
m_map()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CRSSIInterpolator::~CRSSIInterpolator()
|
||||||
|
{
|
||||||
|
m_map.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRSSIInterpolator::load(const std::string& filename)
|
||||||
|
{
|
||||||
|
FILE* fp = ::fopen(filename.c_str(), "rt");
|
||||||
|
if (fp == NULL) {
|
||||||
|
LogWarning("Cannot open the RSSI data file - %s", filename.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[100U];
|
||||||
|
while (::fgets(buffer, 100, fp) != NULL) {
|
||||||
|
if (buffer[0U] == '#')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char* p1 = ::strtok(buffer, " \t\r\n");
|
||||||
|
char* p2 = ::strtok(NULL, " \t\r\n");
|
||||||
|
|
||||||
|
if (p1 != NULL && p2 != NULL) {
|
||||||
|
uint16_t raw = (unsigned int)::atoi(p1);
|
||||||
|
int rssi = ::atoi(p2);
|
||||||
|
m_map.insert(std::pair<uint16_t, int>(raw, rssi));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::fclose(fp);
|
||||||
|
|
||||||
|
LogInfo("Loaded %u RSSI data mapping points from %s", m_map.size(), filename.c_str());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CRSSIInterpolator::interpolate(uint16_t val) const
|
||||||
|
{
|
||||||
|
if (m_map.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
std::map<uint16_t, int>::const_iterator it = m_map.lower_bound(val);
|
||||||
|
|
||||||
|
if (it == m_map.end())
|
||||||
|
return m_map.rbegin()->second;
|
||||||
|
|
||||||
|
if (it == m_map.begin())
|
||||||
|
return it->second;
|
||||||
|
|
||||||
|
unsigned int x2 = it->first;
|
||||||
|
int y2 = it->second;
|
||||||
|
|
||||||
|
--it;
|
||||||
|
unsigned int x1 = it->first;
|
||||||
|
int y1 = it->second;
|
||||||
|
|
||||||
|
float p = float(val - x1) / float(x2 - x1);
|
||||||
|
|
||||||
|
return int((1.0F - p) * float(y1) + p * float(y2));
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(RSSIINTERPOLATOR_H)
|
||||||
|
#define RSSIINTERPOLATOR_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
class CRSSIInterpolator {
|
||||||
|
public:
|
||||||
|
CRSSIInterpolator();
|
||||||
|
~CRSSIInterpolator();
|
||||||
|
|
||||||
|
bool load(const std::string& filename);
|
||||||
|
|
||||||
|
int interpolate(uint16_t raw) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<uint16_t, int> m_map;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue