]> code.octet-stream.net Git - m17rt/blobdiff - m17core/src/decode.rs
Correct maths for setting output filter gain
[m17rt] / m17core / src / decode.rs
index 115ff63fbf9101c9507143f38ff91ac1a01e5da2..6c8e02bfdc1431448a50d73c7886d3d89ee625cf 100755 (executable)
@@ -144,8 +144,8 @@ pub(crate) fn parse_packet(frame: &[f32] /* length 192 */) -> Option<PacketFrame
     };
     // TODO: the spec is inconsistent about which bit in packet[25] is EOF
     // https://github.com/M17-Project/M17_spec/issues/147
-    let final_frame = (packet[25] & 0x04) > 0;
-    let number = packet[25] >> 3;
+    let final_frame = (packet[25] & 0x80) > 0;
+    let number = (packet[25] >> 2) & 0x1f;
     let counter = if final_frame {
         PacketFrameCounter::FinalFrame {
             payload_len: number as usize,