Detect DAC overflows.

This commit is contained in:
Jonathan Naylor 2016-06-09 19:51:23 +01:00
parent ee93e4ce43
commit 89fa0a0c8d
3 changed files with 13 additions and 19 deletions

View file

@ -197,18 +197,10 @@ void CModem::clock(unsigned int ms)
LogError("No reply from the modem for some time, resetting it");
m_error = true;
close();
#if defined(_WIN32) || defined(_WIN64)
::Sleep(2000UL); // 2s
#else
::sleep(2UL); // 2s
#endif
while (!open()) {
#if defined(_WIN32) || defined(_WIN64)
::Sleep(5000UL); // 5s
#else
::sleep(5UL); // 5s
#endif
}
CThread::sleep(2000U); // 2s
while (!open())
CThread::sleep(5000U); // 5s
}
RESP_TYPE_MMDVM type = getResponse();
@ -376,6 +368,10 @@ void CModem::clock(unsigned int ms)
m_lockout = (m_buffer[5U] & 0x10U) == 0x10U;
bool dacOverflow = (m_buffer[5U] & 0x20U) == 0x20U;
if (dacOverflow)
LogError("MMDVM DAC levels have overflowed");
m_dstarSpace = m_buffer[6U];
m_dmrSpace1 = m_buffer[7U];
m_dmrSpace2 = m_buffer[8U];
@ -698,11 +694,7 @@ bool CModem::writeYSFData(const unsigned char* data, unsigned int length)
bool CModem::readVersion()
{
#if defined(_WIN32) || defined(_WIN64)
::Sleep(2000UL); // 2s
#else
::sleep(2); // 2s
#endif
CThread::sleep(2000U); // 2s
for (unsigned int i = 0U; i < 6U; i++) {
unsigned char buffer[3U];

View file

@ -362,6 +362,8 @@ void CYSFControl::writeNetwork()
m_networkWatchdog.start();
bool gateway = ::memcmp(data + 4U, "GATEWAY ", YSF_CALLSIGN_LENGTH) == 0;
if (!m_netTimeoutTimer.isRunning()) {
if (::memcmp(data + 14U, " ", YSF_CALLSIGN_LENGTH) != 0)
::memcpy(m_netSource, data + 14U, YSF_CALLSIGN_LENGTH);
@ -403,7 +405,7 @@ void CYSFControl::writeNetwork()
m_netFrames++;
bool end = data[34U] == 0x01U;
bool end = (data[34U] & 0x01U) == 0x01U;
data[33U] = end ? TAG_EOT : TAG_DATA;
data[34U] = 0x00U;

View file

@ -160,7 +160,7 @@ void CYSFNetwork::clock(unsigned int ms)
return;
}
bool end = buffer[34U] == 0x01U;
bool end = (buffer[34U] & 0x01U) == 0x01U;
if (end)
::memset(m_tag, ' ', YSF_CALLSIGN_LENGTH);