pub fn increment(id: u16) -> u16Available on crate feature
std only.Expand description
Increments a message ID, handling rollover.
When the ID reaches its maximum value (8835), it rolls over to 0. This ensures IDs cycle through the entire range [0, 8835] in a continuous session.
Implemented as: (id + 1) % 8836
§Arguments
id: The current u16 message ID.
§Returns
The next message ID in the sequence.
§Examples
use pk_command::msg_id;
assert_eq!(msg_id::increment(0), 1);
assert_eq!(msg_id::increment(100), 101);
assert_eq!(msg_id::increment(8835), 0); // rollover