mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-01-13 02:53:38 +00:00
Simplify PacketBuilder pattern matching and symbol accumulation.
This commit is contained in:
parent
36689f5c45
commit
1bdad62496
@ -51,13 +51,13 @@ public:
|
||||
break;
|
||||
|
||||
case State::Payload:
|
||||
if( !found_stuffing_bit() ) {
|
||||
payload[bits_received++] = symbol;
|
||||
}
|
||||
|
||||
if( found_end_flag() || packet_truncated() ) {
|
||||
payload_handler(payload, bits_received);
|
||||
reset_state();
|
||||
} else {
|
||||
if( !found_stuffing_bit() ) {
|
||||
payload[bits_received++] = symbol;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -74,7 +74,7 @@ private:
|
||||
};
|
||||
|
||||
bool packet_truncated() const {
|
||||
return bits_received > payload.size();
|
||||
return bits_received >= payload.size();
|
||||
}
|
||||
|
||||
bool found_preamble() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user