Improve the logic of the repeater, late entry still to finish.

This commit is contained in:
Jonathan Naylor 2018-02-01 22:05:17 +00:00
parent dcc8b04b2c
commit 7cc2a042b5
2 changed files with 8 additions and 20 deletions

View file

@ -17,7 +17,6 @@
*/
#include "NXDNCRC.h"
#include "Log.h"
#include <cstdio>
#include <cassert>
@ -41,8 +40,6 @@ bool CNXDNCRC::checkCRC6(const unsigned char* in, unsigned int length)
WRITE_BIT1(temp, i, b);
}
// LogMessage("NXDN, CRC6: new:%02X old:%02X", crc, temp[0U]);
return crc == temp[0U];
}
@ -53,8 +50,6 @@ void CNXDNCRC::encodeCRC6(unsigned char* in, unsigned int length)
uint8_t crc[1U];
crc[0U] = createCRC6(in, length);
// LogMessage("NXDN, CRC6: new:%02X", crc[0U]);
unsigned int n = length;
for (unsigned int i = 2U; i < 8U; i++, n++) {
bool b = READ_BIT1(crc, i);
@ -80,8 +75,6 @@ bool CNXDNCRC::checkCRC12(const unsigned char* in, unsigned int length)
WRITE_BIT1(temp2, i, b);
}
// LogMessage("NXDN, CRC12: new:%02X%02X old:%02X%02X", temp1[0U], temp1[1U], temp2[0U], temp2[1U]);
return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U];
}
@ -95,8 +88,6 @@ void CNXDNCRC::encodeCRC12(unsigned char* in, unsigned int length)
temp[0U] = (crc >> 8) & 0xFFU;
temp[1U] = (crc >> 0) & 0xFFU;
// LogMessage("NXDN, CRC12: new:%02X%02X", temp[0U], temp[1U]);
unsigned int n = length;
for (unsigned int i = 4U; i < 16U; i++, n++) {
bool b = READ_BIT1(temp, i);
@ -122,8 +113,6 @@ bool CNXDNCRC::checkCRC15(const unsigned char* in, unsigned int length)
WRITE_BIT1(temp2, i, b);
}
// LogMessage("NXDN, CRC15: new:%02X%02X old:%02X%02X", temp1[0U], temp1[1U], temp2[0U], temp2[1U]);
return temp1[0U] == temp2[0U] && temp1[1U] == temp2[1U];
}
@ -137,8 +126,6 @@ void CNXDNCRC::encodeCRC15(unsigned char* in, unsigned int length)
temp[0U] = (crc >> 8) & 0xFFU;
temp[1U] = (crc >> 0) & 0xFFU;
// LogMessage("NXDN, CRC15: new:%02X%02X", temp[0U], temp[1U]);
unsigned int n = length;
for (unsigned int i = 1U; i < 16U; i++, n++) {
bool b = READ_BIT1(temp, i);

View file

@ -274,7 +274,7 @@ bool CNXDNControl::processVoice(unsigned char usc, unsigned char option, unsigne
return true;
} else {
// if (valid) {
if (m_rfState == RS_RF_LISTENING) {
unsigned char message[3U];
sacch.getData(message);
@ -300,11 +300,11 @@ bool CNXDNControl::processVoice(unsigned char usc, unsigned char option, unsigne
break;
}
// if (m_rfMask != 0x0FU)
// return false;
if (m_rfMask != 0x0FU)
return false;
unsigned char messageType = m_rfLayer3.getMessageType();
if (messageType != NXDN_MESSAGE_TYPE_VCALL)
bool hasInfo = m_rfLayer3.getHasInfo();
if (!hasInfo)
return false;
unsigned short srcId = m_rfLayer3.getSourceUnitId();
@ -337,9 +337,9 @@ bool CNXDNControl::processVoice(unsigned char usc, unsigned char option, unsigne
m_rfState = RS_RF_AUDIO;
}
// }
}
// if (m_rfState == RS_RF_AUDIO) {
if (m_rfState == RS_RF_AUDIO) {
// Regenerate the sync
CSync::addNXDNSync(data + 2U);
@ -449,6 +449,7 @@ bool CNXDNControl::processVoice(unsigned char usc, unsigned char option, unsigne
m_rfFrames++;
m_display->writeNXDNRSSI(m_rssi);
}
return true;
}