Commit 5e9015a6 authored by Jake Read's avatar Jake Read
Browse files

add error logging to serialport

parent 15571dff
...@@ -13,7 +13,7 @@ It's in the early stages, so bear with us. Everything is going to be great. ...@@ -13,7 +13,7 @@ It's in the early stages, so bear with us. Everything is going to be great.
# Usage # Usage
## Installing Node.js, WebSocket and SerialPort ## Installing Node.js, WebSocket and SerialPort, and MathJS
To Run DMC, you'll need to install node.js, and then the packages serialport and ws (websocket). To Run DMC, you'll need to install node.js, and then the packages serialport and ws (websocket).
...@@ -45,6 +45,12 @@ To install ws, do ...@@ -45,6 +45,12 @@ To install ws, do
``npm install ws`` ``npm install ws``
## Install MathJS
MathJS is just a node package that does maths. To install, you guessed it, do
```npm install mathjs```
# Running DMC # Running DMC
To run the program, we launch the main.js file with node, from the command line. One of the things this does is run a tiny HTTP server that we can use to access the UI. To run the program, we launch the main.js file with node, from the command line. One of the things this does is run a tiny HTTP server that we can use to access the UI.
...@@ -81,6 +87,10 @@ In a browser open *localhost:8080* you will see the mods and this msg in the ter ...@@ -81,6 +87,10 @@ In a browser open *localhost:8080* you will see the mods and this msg in the ter
- rm modules - rm modules
- change settings - change settings
# Troubleshooting
Herein will contain a list of known problems / common errors and their fixes.
# Writing New Modules # Writing New Modules
- whenever a menu is requested, the system searches ```modules/ * ``` for *anything*. include your .js of a new module there - whenever a menu is requested, the system searches ```modules/ * ``` for *anything*. include your .js of a new module there
......
...@@ -48,15 +48,22 @@ function ATKSerialLink() { ...@@ -48,15 +48,22 @@ function ATKSerialLink() {
serialport = null serialport = null
function findSerialPort() { function findSerialPort() {
state.portStatus = 'searching for CP2102 device'
var found = false
SerialPort.list(function(err, ports) { SerialPort.list(function(err, ports) {
ports.forEach(function(serialport) { ports.forEach(function(serialport) {
if (serialport.manufacturer == 'Silicon Labs') { if (serialport.manufacturer == 'Silicon Labs') {
console.log('found cp2102 serialport') console.log('found cp2102 serialport')
found = true
state.portName = serialport.comName state.portName = serialport.comName
openSerialPort() openSerialPort()
} }
}) })
}) })
if(!found){
console.log('no CP2102 device found, try serialport-list to make sure it is available to the system')
state.portStatus = 'no CP2102 device found'
}
} }
function openSerialPort() { function openSerialPort() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment