mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-14 22:55:12 +10:00
Enhance USB serial services with debug logging and reset functionality
- Introduced debug logging in USB serial services for better traceability. - Added reset method to UsbSerialFrameDecoder to clear buffered data. - Updated tests to verify the reset functionality of the decoder.
This commit is contained in:
committed by
just-stuff-tm
parent
c2f544eeba
commit
4c7ee3b3b0
@@ -120,4 +120,22 @@ void main() {
|
||||
expect(packets.single.payload, orderedEquals(<int>[0x44]));
|
||||
},
|
||||
);
|
||||
|
||||
test('UsbSerialFrameDecoder reset clears buffered partial data', () {
|
||||
final decoder = UsbSerialFrameDecoder();
|
||||
|
||||
expect(
|
||||
decoder.ingest(Uint8List.fromList(<int>[usbSerialRxFrameStart, 0x02])),
|
||||
isEmpty,
|
||||
);
|
||||
|
||||
decoder.reset();
|
||||
|
||||
final packets = decoder.ingest(
|
||||
Uint8List.fromList(<int>[usbSerialRxFrameStart, 0x01, 0x00, 0x55]),
|
||||
);
|
||||
|
||||
expect(packets, hasLength(1));
|
||||
expect(packets.single.payload, orderedEquals(<int>[0x55]));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user