Skip to content

Commit

Permalink
fix: ZBOSS: fixed logging and uart packet handling (#1174)
Browse files Browse the repository at this point in the history
* fix logger level

* fix waiting for full uart package

* fix waiting for full uart package
  • Loading branch information
kirovilya authored Sep 4, 2024
1 parent 19757ae commit 0e9228f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/adapter/zboss/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class ZBOSSDriver extends EventEmitter {
}

private onFrame(frame: ZBOSSFrame): void {
logger.info(`<== Frame: ${JSON.stringify(frame)}`, NS);
logger.debug(`<== Frame: ${JSON.stringify(frame)}`, NS);

const handled = this.waitress.resolve(frame);

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/zboss/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ZBOSSReader extends Transform {
// need for read length
if (data.length > position + 3) {
const len = data.readUInt16LE(position + 1);
if (data.length >= position - 1 + len) {
if (data.length >= position + 1 + len) {
const frame = data.subarray(position + 1, position + 1 + len);
logger.debug(`<<< FRAME [${frame.toString('hex')}]`, NS);
// emit the frame via 'data' event
Expand Down

0 comments on commit 0e9228f

Please sign in to comment.