From 9688929c3d34f2925c5c2a7611ecc3df9240944a Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 21 Oct 2020 10:41:06 +0100 Subject: [PATCH] Fix the M17 LICH fragment encoding. --- M17Control.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/M17Control.cpp b/M17Control.cpp index 661889b..90dbfad 100644 --- a/M17Control.cpp +++ b/M17Control.cpp @@ -384,14 +384,14 @@ bool CM17Control::writeModem(unsigned char* data, unsigned int len) unsigned char lich[M17_LICH_FRAGMENT_LENGTH_BYTES]; m_netLICH.getFragment(lich, m_rfFN); - unsigned int lich1, lich2, lich3, lich4; - CM17Utils::splitFragmentLICH(lich, lich1, lich2, lich3, lich4); + unsigned int frag1, frag2, frag3, frag4; + CM17Utils::splitFragmentLICH(lich, frag1, frag2, frag3, frag4); // Add Golay to the LICH fragment here - CGolay24128::encode24128(lich1); - CGolay24128::encode24128(lich2); - CGolay24128::encode24128(lich3); - CGolay24128::encode24128(lich4); + unsigned int lich1 = CGolay24128::encode24128(frag1); + unsigned int lich2 = CGolay24128::encode24128(frag2); + unsigned int lich3 = CGolay24128::encode24128(frag3); + unsigned int lich4 = CGolay24128::encode24128(frag4); CM17Utils::combineFragmentLICHFEC(lich1, lich2, lich3, lich4, rfData + 2U + M17_SYNC_LENGTH_BYTES); @@ -595,14 +595,14 @@ void CM17Control::writeNetwork() unsigned char lich[M17_LICH_FRAGMENT_LENGTH_BYTES]; m_netLICH.getFragment(lich, fn); - unsigned int lich1, lich2, lich3, lich4; - CM17Utils::splitFragmentLICH(lich, lich1, lich2, lich3, lich4); + unsigned int frag1, frag2, frag3, frag4; + CM17Utils::splitFragmentLICH(lich, frag1, frag2, frag3, frag4); // Add Golay to the LICH fragment here - CGolay24128::encode24128(lich1); - CGolay24128::encode24128(lich2); - CGolay24128::encode24128(lich3); - CGolay24128::encode24128(lich4); + unsigned int lich1 = CGolay24128::encode24128(frag1); + unsigned int lich2 = CGolay24128::encode24128(frag2); + unsigned int lich3 = CGolay24128::encode24128(frag3); + unsigned int lich4 = CGolay24128::encode24128(frag4); CM17Utils::combineFragmentLICHFEC(lich1, lich2, lich3, lich4, data + 2U + M17_SYNC_LENGTH_BYTES);