Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse byte ordering of CRC in packet mode in M17 modem #1891

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modemm17/M17Modulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ struct MODEMM17_API M17Modulator
if (last_packet)
{
packet_assembly[25] = 0x80 | ((packet_size+2)<<2); // sent packet size includes CRC
packet_assembly[packet_size] = crc_.get_bytes()[1];
packet_assembly[packet_size+1] = crc_.get_bytes()[0];
packet_assembly[packet_size] = crc_.get_bytes()[0];
packet_assembly[packet_size+1] = crc_.get_bytes()[1];
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/channelrx/demodm17/m17demodprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ bool M17DemodProcessor::decode_packet(modemm17::M17FrameDecoder::packet_buffer_t
crc16(*it);
}

uint16_t calcChecksum = crc16.get_bytes()[0] + (crc16.get_bytes()[1]<<8);
uint16_t calcChecksum = crc16.get_bytes()[1] + (crc16.get_bytes()[0]<<8);
uint16_t xmitChecksum = m_currentPacket.back() + (m_currentPacket.end()[-2]<<8);

if (calcChecksum == xmitChecksum) // (checksum == 0x0f47)
Expand Down