Skip to content

Commit

Permalink
System Fusion bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Apr 18, 2016
1 parent 2e84ab8 commit 700ebda
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
10 changes: 6 additions & 4 deletions YSFControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ bool CYSFControl::writeModem(unsigned char *data)
CSync::addYSFSync(data + 2U);

unsigned char fn = m_fich.getFN();
unsigned char ft = m_fich.getFT();
unsigned char dt = m_fich.getDT();

LogMessage("YSF, EOT, FI=%X FN=%u DT=%X", fi, fn, dt);
LogMessage("YSF, EOT, FI=%X FN=%u FT=%u DT=%X", fi, fn, ft, dt);

m_payload.decode(data + 2U, fi, fn, dt);
m_payload.decode(data + 2U, fi, fn, ft, dt);
// m_payload.encode(data + 2U); XXX

m_frames++;
Expand Down Expand Up @@ -144,11 +145,12 @@ bool CYSFControl::writeModem(unsigned char *data)
if (valid) {
unsigned char cm = m_fich.getCM();
unsigned char fn = m_fich.getFN();
unsigned char ft = m_fich.getFT();
unsigned char dt = m_fich.getDT();

LogMessage("YSF, Valid FICH, FI=%X FN=%u DT=%X", fi, fn, dt);
LogMessage("YSF, Valid FICH, FI=%X FN=%u FT=%u DT=%X", fi, fn, ft, dt);

m_payload.decode(data + 2U, fi, fn, dt);
m_payload.decode(data + 2U, fi, fn, ft, dt);
// payload.encode(data + 2U); XXX

bool change = false;
Expand Down
24 changes: 9 additions & 15 deletions YSFDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,22 @@ const unsigned int YSF_SYNC_LENGTH_BYTES = 5U;

const unsigned int YSF_FICH_LENGTH_BYTES = 25U;

const unsigned char YSF_FI_MASK = 0xC0U;
const unsigned char YSF_DT_MASK = 0x30U;

const unsigned char YSF_DT_HEADER_CHANNEL = 0x00U;
const unsigned char YSF_DT_TERMINATOR_CHANNEL = 0x80U;

const unsigned char YSF_SYNC_OK = 0x01U;

const unsigned char YSF_FI_HEADER = 0x00U;
const unsigned char YSF_FI_COMMUNICATIONS = 0x40U;
const unsigned char YSF_FI_TERMINATOR = 0x80U;
const unsigned char YSF_FI_TEST = 0xC0U;
const unsigned char YSF_FI_COMMUNICATIONS = 0x01U;
const unsigned char YSF_FI_TERMINATOR = 0x02U;
const unsigned char YSF_FI_TEST = 0x03U;

const unsigned char YSF_DT_VD_MODE1 = 0x00U;
const unsigned char YSF_DT_DATA_FR_MODE = 0x10U;
const unsigned char YSF_DT_VD_MODE2 = 0x20U;
const unsigned char YSF_DT_VOICE_FR_MODE = 0x30U;
const unsigned char YSF_DT_DATA_FR_MODE = 0x01U;
const unsigned char YSF_DT_VD_MODE2 = 0x02U;
const unsigned char YSF_DT_VOICE_FR_MODE = 0x03U;

const unsigned char YSF_CM_GROUP = 0x00U;
const unsigned char YSF_CM_INDIVIDUAL = 0x0CU;
const unsigned char YSF_CM_INDIVIDUAL = 0x03U;

const unsigned char YSF_MR_NOT_BUSY = 0x08U;
const unsigned char YSF_MR_BUSY = 0x10U;
const unsigned char YSF_MR_NOT_BUSY = 0x01U;
const unsigned char YSF_MR_BUSY = 0x02U;

#endif
5 changes: 5 additions & 0 deletions YSFFICH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ unsigned char CYSFFICH::getFN() const
return (m_fich[1U] >> 3) & 0x07U;
}

unsigned char CYSFFICH::getFT() const
{
return m_fich[1U] & 0x07U;
}

unsigned char CYSFFICH::getDT() const
{
return m_fich[2U] & 0x03U;
Expand Down
1 change: 1 addition & 0 deletions YSFFICH.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CYSFFICH {
unsigned char getFI() const;
unsigned char getCM() const;
unsigned char getFN() const;
unsigned char getFT() const;
unsigned char getDT() const;

void setFI(unsigned char fi);
Expand Down
2 changes: 1 addition & 1 deletion YSFPayload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CYSFPayload::~CYSFPayload()
delete[] m_dest;
}

void CYSFPayload::decode(const unsigned char* bytes, unsigned char fi, unsigned char fn, unsigned char dt)
void CYSFPayload::decode(const unsigned char* bytes, unsigned char fi, unsigned char fn, unsigned char ft, unsigned char dt)
{
assert(bytes != NULL);

Expand Down
2 changes: 1 addition & 1 deletion YSFPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CYSFPayload {
CYSFPayload();
~CYSFPayload();

void decode(const unsigned char* bytes, unsigned char fi, unsigned char fn, unsigned char dt);
void decode(const unsigned char* bytes, unsigned char fi, unsigned char fn, unsigned char ft, unsigned char dt);

void encode(unsigned char* bytes);

Expand Down

0 comments on commit 700ebda

Please sign in to comment.