Skip to content

Commit

Permalink
Simplify and Improve Port Scanning logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rschell committed Sep 30, 2024
1 parent 7a7d712 commit 19687bd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,12 @@ async function findPorts() {
status.comms.interfaces.ports[i].img = data.img;
status.comms.interfaces.ports[i].note = data.note;
}
return ports;
}
findPorts()
oldportslist = findPorts()

async function findChangedPorts() {
const ports = await SerialPort.list()
// console.log(ports)
status.comms.interfaces.ports = ports;
const ports = findPorts()
if (!_.isEqual(ports, oldportslist)) {
var newPorts = _.differenceWith(ports, oldportslist, _.isEqual)
if (newPorts.length > 0) {
Expand All @@ -540,8 +539,6 @@ async function findChangedPorts() {
}
}
oldportslist = ports;
// throw new Error('No ports found')
findPorts()
}

// async function findDisks() {
Expand Down

0 comments on commit 19687bd

Please sign in to comment.