diff --git a/index.html b/index.html
index f44acaf..0ecc8cb 100755
--- a/index.html
+++ b/index.html
@@ -8,9 +8,13 @@
// Declare a "SerialPort" object
var serial;
+ var portListDiv;
+
var portSelect;
var selectedPort;
+ var rescanPorts;
+
var connectButton;
var disconnectButton;
@@ -26,17 +30,24 @@
function setup() {
createCanvas(1, 1);
+ portListDiv = select("#serialports");
+
// GUI controls
portSelect = createSelect();
portSelect.option("No Ports Found");
portSelect.parent(select("#portselectdiv"));
+ rescanPorts = select("#rescan");
+ rescanPorts.mousePressed(function() {
+ serial.list();
+ });
+
connectButton = select("#connect");
connectButton.mousePressed(connectPressed);
disconnectButton = select("#disconnect");
disconnectButton.mousePressed(disconnectPressed);
- serialConsole = select("#serialconsole");
+ serialConsole = select("#serialconsole");
serialConsoleEnabledCheckbox = select("#serialconsoleenabled");
serialConsoleEnabledCheckbox.elt.addEventListener('change', serialConsoleSwitch);
@@ -107,11 +118,17 @@
//This isn't working - Looks like p5.dom bug
//newPortSelect.changed(portSelected);
portSelect.elt.addEventListener('change', portSelected);
-
+
+ if (portListDiv) {
+ portListDiv.elt.innerHTML = "";
+ }
for (var i = 0; i < thelist.length; i++) {
seriallog(i + " " + thelist[i]);
portSelect.option(thelist[i]);
+ if (portListDiv) {
+ portListDiv.elt.innerHTML += "
\n" + thelist[i];
+ }
}
}
@@ -199,27 +216,61 @@
function seriallog(txt) {
//console.log(txt + "\n");
if (serialConsoleEnabled) {
+ if (serialConsole.elt.value.length >= 800)
+ {
+ serialConsole.elt.value = serialConsole.elt.value.substring(400);
+ }
serialConsole.elt.value += txt + "\n";
+ serialConsole.elt.scrollTop = serialConsole.elt.scrollHeight;
}
}
+ function keyPressed() {
+ if (keyCode === ESCAPE) {
+ toggleAdvancedFeatures();
+ }
+ }
+
+ function toggleAdvancedFeatures() {
+ var advancedFeatures = document.getElementsByClassName("advanced");
+ for (var i = 0; i < advancedFeatures.length; i++) {
+ if (advancedFeatures[i].style.visibility == "hidden") {
+ advancedFeatures[i].style.visibility = "visible";
+ advancedFeatures[i].style.height = "auto";
+ } else {
+ advancedFeatures[i].style.visibility = "hidden";
+ advancedFeatures[i].style.height = "0px";
+ }
+ }
+ }
+
A GUI application for running, monitoring, and basic control of the p5.serialserver.
+A GUI application for running and monitoring of the p5.serialserver.
This application runs the p5.serialserver which enables connectivity between a local serial device and a web application via the p5.serialport p5.js library.
-It is recommended that you select, open, and close serial ports via your p5 sketch rather than this application but the methods for doing so for simple debugging are available here as well. Please note that if you "Open" or "Close" here it will also effect your sketch (opening/closing here will also open/close it for your sketch).
+It is recommended that you select, open, and close serial ports via your p5 sketch rather than this application but the methods for doing so for simple debugging are available here as well. Please note that if you "Open" or "Close" here it will also effect your sketch (opening/closing here will also open/close it for your sketch).
+