mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 08:05:49 +08:00
Small updates and a timing improvement.
This commit is contained in:
23
CRC.cpp
23
CRC.cpp
@@ -48,7 +48,7 @@ const uint8_t CRC8_TABLE[] = {
|
||||
0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, 0xAE, 0xA9, 0xA0, 0xA7,
|
||||
0xB2, 0xB5, 0xBC, 0xBB, 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
|
||||
0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, 0xE6, 0xE1, 0xE8, 0xEF,
|
||||
0xFA, 0xFD, 0xF4, 0xF3, 0x01};
|
||||
0xFA, 0xFD, 0xF4, 0xF3, 0x01 };
|
||||
|
||||
const uint16_t CCITT16_TABLE1[] = {
|
||||
0x0000U, 0x1189U, 0x2312U, 0x329bU, 0x4624U, 0x57adU, 0x6536U, 0x74bfU,
|
||||
@@ -166,6 +166,27 @@ unsigned char CCRC::encodeEightBit(const unsigned char *in, unsigned int length)
|
||||
return crc;
|
||||
}
|
||||
|
||||
void CCRC::addCCITT162(unsigned char *in, unsigned int length)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(length > 2U);
|
||||
|
||||
union {
|
||||
uint16_t crc16;
|
||||
uint8_t crc8[2U];
|
||||
};
|
||||
|
||||
crc16 = 0U;
|
||||
|
||||
for (unsigned i = 0U; i < (length - 2U); i++)
|
||||
crc16 = (uint16_t(crc8[0U]) << 8) ^ CCITT16_TABLE2[crc8[1U] ^ in[i]];
|
||||
|
||||
crc16 = ~crc16;
|
||||
|
||||
in[length - 1U] = crc8[0U];
|
||||
in[length - 2U] = crc8[1U];
|
||||
}
|
||||
|
||||
bool CCRC::checkCCITT162(const unsigned char *in, unsigned int length)
|
||||
{
|
||||
assert(in != NULL);
|
||||
|
||||
1
CRC.h
1
CRC.h
@@ -26,6 +26,7 @@ public:
|
||||
static void encodeFiveBit(const bool* in, unsigned int& tcrc);
|
||||
|
||||
static void addCCITT161(unsigned char* in, unsigned int length);
|
||||
static void addCCITT162(unsigned char* in, unsigned int length);
|
||||
|
||||
static bool checkCCITT161(const unsigned char* in, unsigned int length);
|
||||
static bool checkCCITT162(const unsigned char* in, unsigned int length);
|
||||
|
||||
@@ -326,19 +326,22 @@ int CMMDVMHost::run()
|
||||
}
|
||||
|
||||
unsigned int ms = stopWatch.elapsed();
|
||||
stopWatch.start();
|
||||
|
||||
m_modem->clock(ms);
|
||||
m_modeTimer.clock(ms);
|
||||
|
||||
if (dstar != NULL)
|
||||
dstar->clock(ms);
|
||||
if (dmr != NULL)
|
||||
dmr->clock(ms);
|
||||
if (ysf != NULL)
|
||||
ysf->clock(ms);
|
||||
|
||||
if (m_dstarNetwork != NULL)
|
||||
m_dstarNetwork->clock(ms);
|
||||
if (m_dmrNetwork != NULL)
|
||||
m_dmrNetwork->clock(ms);
|
||||
stopWatch.start();
|
||||
|
||||
dmrBeaconTimer.clock(ms);
|
||||
if (dmrBeaconTimer.isRunning() && dmrBeaconTimer.hasExpired()) {
|
||||
|
||||
Reference in New Issue
Block a user