Skip to content

Commit

Permalink
rm packet from read arg
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 committed Mar 18, 2024
1 parent 3399a67 commit de0755a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/transport/ISerialTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface ISerialTransport {
* @param {Uint8Array} packet Unsigned 8 bit array from the device read stream.
* @returns {Promise<Uint8Array>} 8 bit unsigned data array read from device.
*/
read(timeout?: number, minData?: number, packet?: Uint8Array): Promise<Uint8Array>;
read(timeout?: number, minData?: number): Promise<Uint8Array>;

/**
* Send the RequestToSend (RTS) signal to given state
Expand Down
6 changes: 2 additions & 4 deletions src/transport/WebSerialTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class WebSerialTransport implements ISerialTransport {
* @param {Uint8Array} packet Unsigned 8 bit array from the device read stream.

Check warning on line 98 in src/transport/WebSerialTransport.ts

View workflow job for this annotation

GitHub Actions / ci

@param "packet" does not match an existing function parameter
* @returns {Promise<Uint8Array>} 8 bit unsigned data array read from device.
*/
async read(timeout: number = 0, minData: number = 0, packet?: Uint8Array): Promise<Uint8Array> {
async read(timeout: number = 0, minData: number = 0): Promise<Uint8Array> {
if (this.leftOver.length != 0) {
const p = this.leftOver;
this.leftOver = new Uint8Array(0);
Expand All @@ -109,9 +109,7 @@ export class WebSerialTransport implements ISerialTransport {
}
this.reader = this.device.readable.getReader();
let t;
if (!packet) {
packet = this.leftOver;
}
let packet = this.leftOver;
try {
if (timeout > 0) {
t = setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/slip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class Slip {
packet = this.transport.leftOver;
this.transport.leftOver = new Uint8Array(0);
}
packet = await this.transport.read(timeout, minData, packet);
packet = await this.transport.read(timeout, minData);

if (this.tracer) {
this.tracer.trace("Read SLIP bytes");
Expand Down

0 comments on commit de0755a

Please sign in to comment.