Skip to content

Commit

Permalink
Fix DSQ processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Naylor committed Aug 14, 2017
1 parent 3749b8d commit bd8f15c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
53 changes: 31 additions & 22 deletions YSFControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ m_netSource(NULL),
m_netDest(NULL),
m_lastFrame(NULL),
m_lastFrameValid(false),
m_lastSQL(false),
m_lastSQ(0U),
m_lastMode(YSF_DT_VOICE_FR_MODE),
m_lastMR(YSF_MR_NOT_BUSY),
m_netN(0U),
Expand Down Expand Up @@ -146,38 +148,45 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
CYSFFICH fich;
bool valid = fich.decode(data + 2U);

if (valid && m_rfState == RS_RF_LISTENING) {
unsigned char fi = fich.getFI();
if (fi == YSF_FI_TERMINATOR)
return false;

if (m_sqlEnabled) {
bool sql = fich.getSQL();
unsigned char value = fich.getSQ();
if (valid) {
m_lastSQL = fich.getSQL();
m_lastSQ = fich.getSQ();

if (!sql || value != m_sqlValue)
if (m_rfState == RS_RF_LISTENING) {
unsigned char fi = fich.getFI();
if (fi == YSF_FI_TERMINATOR)
return false;
}

m_rfFrames = 0U;
m_rfErrs = 0U;
m_rfBits = 1U;
m_rfTimeoutTimer.start();
m_rfPayload.reset();
m_rfState = RS_RF_AUDIO;

m_minRSSI = m_rssi;
m_maxRSSI = m_rssi;
m_aveRSSI = m_rssi;
m_rssiCount = 1U;
if (m_sqlEnabled) {
if (!m_lastSQL || m_lastSQ != m_sqlValue)
return false;
}

m_rfFrames = 0U;
m_rfErrs = 0U;
m_rfBits = 1U;
m_rfTimeoutTimer.start();
m_rfPayload.reset();
m_rfState = RS_RF_AUDIO;

m_minRSSI = m_rssi;
m_maxRSSI = m_rssi;
m_aveRSSI = m_rssi;
m_rssiCount = 1U;
#if defined(DUMP_YSF)
openFile();
openFile();
#endif
}
}

if (m_rfState != RS_RF_AUDIO)
return false;

if (m_sqlEnabled) {
if (!m_lastSQL || m_lastSQ != m_sqlValue)
return false;
}

if (valid)
m_lastMR = fich.getMR();

Expand Down
2 changes: 2 additions & 0 deletions YSFControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class CYSFControl {
unsigned char* m_netDest;
unsigned char* m_lastFrame;
bool m_lastFrameValid;
bool m_lastSQL;
unsigned char m_lastSQ;
unsigned char m_lastMode;
unsigned char m_lastMR;
unsigned char m_netN;
Expand Down

0 comments on commit bd8f15c

Please sign in to comment.