proto fw: cleanup

This commit is contained in:
morgan 2025-01-23 11:41:04 +08:00
parent 744fdd7040
commit d9ddd25dc4

View File

@ -6,8 +6,7 @@ use crc::crc32::checksum_ieee;
use io::Cursor;
use libboard_zynq::println;
const EV_MAXSIZE: usize = 253;
const CTRL_PACKET_MAXSIZE: usize = 128; // for compatibility with version1.x compliant Devices - Section 12.1.6 (CXP-001-2021)
pub const CTRL_PACKET_MAXSIZE: usize = 128; // for compatibility with version1.x compliant Devices - Section 12.1.6 (CXP-001-2021)
pub const DATA_MAXSIZE: usize =
CTRL_PACKET_MAXSIZE - /*packet start KCodes, data packet types, CMD, Tag, Addr, CRC, packet end KCode*/4*7;
@ -165,7 +164,7 @@ pub enum RXPacket {
namespace: NameSpace,
event_id: u16,
timestamp: u64,
ev: [u8; EV_MAXSIZE],
ev: [u8; DATA_MAXSIZE],
},
}
@ -239,7 +238,7 @@ impl RXPacket {
let timestamp = reader.read_u64()?;
let mut ev: [u8; EV_MAXSIZE] = [0; EV_MAXSIZE];
let mut ev: [u8; DATA_MAXSIZE] = [0; DATA_MAXSIZE];
reader.read(&mut ev[0..ev_size as usize])?;
let checksum = get_cxp_crc(&reader.get_ref()[0..reader.position()]);