Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
v.vendorId = "";
}
return v;
});
let chosenBoard = ports.find(e => vendorIDs.indexOf(e.vendorId.toLowerCase()) != -1);
if (!chosenBoard) {
atom.notifications.addError("Could not find a valid device");
return;
}
// Create a stream to the serial
this.sp = new SerialPort(chosenBoard.comName);
this.parser = new Readline();
this.sp.pipe(this.parser);
this.parser.on("data", (data) => {
this.sendToPlotter(data);
let shouldScroll = false;
// If 10 or less pixels from bottom then scroll with new output
if (this.logs.scrollHeight - this.logs.clientHeight <= this.logs.scrollTop + 10) {
shouldScroll = true;
}
this.logs.textContent += data + "\n";
if (this.logs.textContent.split("\n").length > atom.config.get("language-circuitpython.maxLines")) {
this.logs.textContent = this.logs.textContent.split("\n").slice(atom.config.get("language-circuitpython.maxLines") - 40).join("\n");
}