don't use HUGE as a SiteModel because certain versions of GCC are awful;

pull/61/head
Bryan Biedenkapp 2 years ago
parent 9050ad7885
commit 35c07715bc

@ -282,23 +282,16 @@ namespace dmr
#define DMR_DT_VOICE_SYNC "DMR, VOICE_SYNC (Voice Data with Sync)"
#define DMR_DT_VOICE "DMR, VOICE (Voice Data)"
// HACK: make GCC 4.9.3 happy...
#if (__GNUC__ == 4 && (__GNUC_MINOR__ == 9 && __GNUC_PATCHLEVEL__ >= 3)) && __arm__
// because the idiot GCC 4.9.3 compiler on ARMHF has a define for "HUGE" and because we utilize this
// as a enumeration below, lets just ... undefine it because thats smart
#undef HUGE
#endif
/// <summary>
/// Site Models
/// </summary>
namespace SiteModel {
// Site Model Enumeration
enum E : uint8_t {
TINY = 0x00U, // Tiny
SMALL = 0x01U, // Small
LARGE = 0x02U, // Large
HUGE = 0x03U // Huge
SM_TINY = 0x00U, // Tiny
SM_SMALL = 0x01U, // Small
SM_LARGE = 0x02U, // Large
SM_HUGE = 0x03U // Huge
};
}

@ -53,28 +53,28 @@ namespace dmr
switch (siteModel)
{
case SiteModel::TINY:
case SiteModel::SM_TINY:
{
if (id > 0x07U) { // clamp to $7
id = 0x07U;
}
}
break;
case SiteModel::SMALL:
case SiteModel::SM_SMALL:
{
if (id > 0x1FU) { // clamp to $1F
id = 0x1FU;
}
}
break;
case SiteModel::LARGE:
case SiteModel::SM_LARGE:
{
if (id > 0x7FU) { // clamp to $7F
id = 0x7FU;
}
}
break;
case SiteModel::HUGE:
case SiteModel::SM_HUGE:
{
if (id > 0x3FFU) { // clamp to $3FF
id = 0x3FFU;
@ -94,28 +94,28 @@ namespace dmr
{
using namespace dmr::defines;
switch (siteModel) {
case SiteModel::TINY:
case SiteModel::SM_TINY:
{
if (id > 0x1FFU) { // clamp to $1FF
id = 0x1FFU;
}
}
break;
case SiteModel::SMALL:
case SiteModel::SM_SMALL:
{
if (id > 0x7FU) { // clamp to $7F
id = 0x7FU;
}
}
break;
case SiteModel::LARGE:
case SiteModel::SM_LARGE:
{
if (id > 0x1FU) { // clamp to $1F
id = 0x1FU;
}
}
break;
case SiteModel::HUGE:
case SiteModel::SM_HUGE:
{
if (id > 0x03U) { // clamp to $3
id = 0x03U;

@ -28,7 +28,7 @@ namespace dmr
public:
/// <summary>Initializes a new instance of the SiteData class.</summary>
SiteData() :
m_siteModel(defines::SiteModel::SMALL),
m_siteModel(defines::SiteModel::SM_SMALL),
m_netId(1U),
m_siteId(1U),
m_parId(3U),
@ -53,8 +53,8 @@ namespace dmr
{
using namespace dmr::defines;
// siteModel clamping
if (siteModel > SiteModel::HUGE)
siteModel = SiteModel::SMALL;
if (siteModel > SiteModel::SM_HUGE)
siteModel = SiteModel::SM_SMALL;
// netId clamping
m_netId = DMRUtils::netId(netId, siteModel);
@ -86,25 +86,25 @@ namespace dmr
switch (m_siteModel)
{
case SiteModel::TINY:
case SiteModel::SM_TINY:
{
value = (value << 9) + (m_netId & 0x1FFU);
value = (value << 3) + (m_siteId & 0x07U);
}
break;
case SiteModel::SMALL:
case SiteModel::SM_SMALL:
{
value = (value << 7) + (m_netId & 0x7FU);
value = (value << 5) + (m_siteId & 0x1FU);
}
break;
case SiteModel::LARGE:
case SiteModel::SM_LARGE:
{
value = (value << 5) + (m_netId & 0x1FU);
value = (value << 7) + (m_siteId & 0x7FU);
}
break;
case SiteModel::HUGE:
case SiteModel::SM_HUGE:
{
value = (value << 2) + (m_netId & 0x03U);
value = (value << 10) + (m_siteId & 0x3FFU);

@ -271,7 +271,7 @@ bool Host::readParams()
m_dmrColorCode = dmr::DMRUtils::colorCode(m_dmrColorCode);
m_dmrNetId = (uint32_t)::strtoul(rfssConfig["dmrNetId"].as<std::string>("1").c_str(), NULL, 16);
m_dmrNetId = dmr::DMRUtils::netId(m_dmrNetId, dmr::defines::SiteModel::SMALL);
m_dmrNetId = dmr::DMRUtils::netId(m_dmrNetId, dmr::defines::SiteModel::SM_SMALL);
m_p25NAC = (uint32_t)::strtoul(rfssConfig["nac"].as<std::string>("F7E").c_str(), NULL, 16);
m_p25NAC = p25::P25Utils::nac(m_p25NAC);

@ -1031,7 +1031,7 @@ void Slot::init(Control* dmr, bool authoritative, uint32_t colorCode, SiteData s
/// <param name="requireReg"></param>
void Slot::setSiteData(::lookups::VoiceChData controlChData, uint32_t netId, uint8_t siteId, uint8_t channelId, uint32_t channelNo, bool requireReg)
{
m_siteData = SiteData(SiteModel::SMALL, netId, siteId, 3U, requireReg);
m_siteData = SiteData(SiteModel::SM_SMALL, netId, siteId, 3U, requireReg);
m_channelNo = channelNo;
std::vector<::lookups::IdenTable> entries = m_idenTable->list();
@ -1671,25 +1671,25 @@ void Slot::setShortLC_TSCC(SiteData siteData, uint16_t counter)
switch (siteData.siteModel())
{
case SiteModel::TINY:
case SiteModel::SM_TINY:
{
lcValue = (lcValue << 9) + siteData.netId();
lcValue = (lcValue << 3) + siteData.siteId();
}
break;
case SiteModel::SMALL:
case SiteModel::SM_SMALL:
{
lcValue = (lcValue << 7) + siteData.netId();
lcValue = (lcValue << 5) + siteData.siteId();
}
break;
case SiteModel::LARGE:
case SiteModel::SM_LARGE:
{
lcValue = (lcValue << 5) + siteData.netId();
lcValue = (lcValue << 7) + siteData.siteId();
}
break;
case SiteModel::HUGE:
case SiteModel::SM_HUGE:
{
lcValue = (lcValue << 2) + siteData.netId();
lcValue = (lcValue << 10) + siteData.siteId();
@ -1734,25 +1734,25 @@ void Slot::setShortLC_Payload(SiteData siteData, uint16_t counter)
switch (siteData.siteModel())
{
case SiteModel::TINY:
case SiteModel::SM_TINY:
{
lcValue = (lcValue << 9) + siteData.netId();
lcValue = (lcValue << 3) + siteData.siteId();
}
break;
case SiteModel::SMALL:
case SiteModel::SM_SMALL:
{
lcValue = (lcValue << 7) + siteData.netId();
lcValue = (lcValue << 5) + siteData.siteId();
}
break;
case SiteModel::LARGE:
case SiteModel::SM_LARGE:
{
lcValue = (lcValue << 5) + siteData.netId();
lcValue = (lcValue << 7) + siteData.siteId();
}
break;
case SiteModel::HUGE:
case SiteModel::SM_HUGE:
{
lcValue = (lcValue << 2) + siteData.netId();
lcValue = (lcValue << 10) + siteData.siteId();

@ -180,7 +180,7 @@ private:
m_dmrNetId.setInputFilter("[[:xdigit:]]");
m_dmrNetId.addCallback("changed", [&]() {
uint32_t id = (uint32_t)::strtoul(std::string(m_dmrNetId.getText().toString()).c_str(), NULL, 16);
id = dmr::DMRUtils::netId(id, dmr::defines::SiteModel::TINY);
id = dmr::DMRUtils::netId(id, dmr::defines::SiteModel::SM_TINY);
m_setup->m_conf["system"]["config"]["dmrNetId"] = __INT_HEX_STR(id);
});

Loading…
Cancel
Save

Powered by TurnKey Linux.