Merge pull request #365 from juribeparada/master

Fix setFrequency() length for DVMega
This commit is contained in:
Jonathan Naylor 2018-01-02 13:58:46 +00:00 committed by GitHub
commit 8423f3f653
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1044,10 +1044,18 @@ bool CModem::setConfig()
bool CModem::setFrequency() bool CModem::setFrequency()
{ {
unsigned char buffer[16U]; unsigned char buffer[16U];
unsigned char len;
if (m_hwType == HWT_DVMEGA)
len = 12U;
else {
buffer[12U] = (unsigned char)(m_rfLevel * 2.55F + 0.5F);
len = 13U;
}
buffer[0U] = MMDVM_FRAME_START; buffer[0U] = MMDVM_FRAME_START;
buffer[1U] = 13U; buffer[1U] = len;
buffer[2U] = MMDVM_SET_FREQ; buffer[2U] = MMDVM_SET_FREQ;
@ -1063,12 +1071,10 @@ bool CModem::setFrequency()
buffer[10U] = (m_txFrequency >> 16) & 0xFFU; buffer[10U] = (m_txFrequency >> 16) & 0xFFU;
buffer[11U] = (m_txFrequency >> 24) & 0xFFU; buffer[11U] = (m_txFrequency >> 24) & 0xFFU;
buffer[12U] = (unsigned char)(m_rfLevel * 2.55F + 0.5F); // CUtils::dump(1U, "Written", buffer, len);
// CUtils::dump(1U, "Written", buffer, 13U); int ret = m_serial.write(buffer, len);
if (ret != len)
int ret = m_serial.write(buffer, 13U);
if (ret != 13)
return false; return false;
unsigned int count = 0U; unsigned int count = 0U;