Skip to content
Snippets Groups Projects
Commit 1973a462 authored by Robert L. Read's avatar Robert L. Read
Browse files

some changes

parent c87e20ba
No related branches found
No related tags found
No related merge requests found
Showing
with 64 additions and 179 deletions
......@@ -185,7 +185,7 @@ an interactive or static analysis of a respiration. It's primary purpose is
<span class="input-group-text" for="samples_to_plot">Number of Samples (~10s per 15000 samples):</span>
</div>
<input type="text" class="form-control" id="samples_to_plot" aria-describedby="samples_to_plot">
</div>
</div>
<div>
<label for="livetoggle">Plot Live:</label>
<label class="switch">
......@@ -1414,7 +1414,7 @@ $( document ).ready(function() {
else
DSERVER_URL = "http://localhost";
// CONTROL PANEL INIT START
$("#control-slot button").click(function() {
var lh = $("#dserverurl").val();
......@@ -1427,12 +1427,19 @@ $( document ).ready(function() {
$("#control-start").click(function(event) {
// Send a command to a connected device via serial port
console.log("Sending PIRCS...");
//Note: PIRCS uses specific units,
// which are designed to provide the right
// amount of precision without using
// floating point numbers.
// Often this means multiplying the
// common medical units by 10 to be the
// PIRCS units.
var dict = {
M: $("#control-mode").val(),
B: $("#control-rr").val(),
B: $("#control-rr").val()*10,
I: $("#control-ie").val(),
P: $("#control-pinsp").val(),
E: $("#control-peep").val()
P: $("#control-pinsp").val()*10,
E: $("#control-peep").val()*10,
}
for (var k in dict){
......@@ -1441,14 +1448,14 @@ $( document ).ready(function() {
type: 'GET',
url: 'http://localhost:5000/api/pircs/',
dataType: 'json',
data: { com: "C", par: k, int: "T", mod: 0, val: dict[k] }
data: { com: "C", par: k, int: "T", mod: "A", val: dict[k] }
}).done(function(result) {
console.log("result: " + JSON.stringify(result));
}).fail(function(xhr, ajaxOptions, thrownError) {
console.log("Error! " + xhr.status);
console.log(thrownError);
})
}
});
......@@ -1483,9 +1490,9 @@ $( document ).ready(function() {
console.log("Couldn't open control panel!");
});
});
// CONTROL PANEL INIT END
......
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../detect-libc/bin/detect-libc.js" "$@"
ret=$?
else
node "$basedir/../detect-libc/bin/detect-libc.js" "$@"
ret=$?
fi
exit $ret
../detect-libc/bin/detect-libc.js
\ No newline at end of file
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../mime/cli.js" "$@"
ret=$?
else
node "$basedir/../mime/cli.js" "$@"
ret=$?
fi
exit $ret
../mime/cli.js
\ No newline at end of file
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../prebuild-install/bin.js" "$@"
ret=$?
else
node "$basedir/../prebuild-install/bin.js" "$@"
ret=$?
fi
exit $ret
../prebuild-install/bin.js
\ No newline at end of file
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../rc/cli.js" "$@"
ret=$?
else
node "$basedir/../rc/cli.js" "$@"
ret=$?
fi
exit $ret
../rc/cli.js
\ No newline at end of file
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../semver/bin/semver" "$@"
ret=$?
else
node "$basedir/../semver/bin/semver" "$@"
ret=$?
fi
exit $ret
../semver/bin/semver
\ No newline at end of file
No preview for this file type
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -230,6 +230,15 @@
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"requires": {
"object-assign": "^4",
"vary": "^1"
}
},
"debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
......
......@@ -5,9 +5,13 @@ app.use(cors());
const SerialPort = require('serialport'); //https://serialport.io/docs/guide-usage
const Readline = require('@serialport/parser-readline');
const port = new SerialPort('COM4', { baudRate: 9600 });
// const port = new SerialPort('/dev/cu.usbmodem142401', { baudRate: 19200 });
const port = new SerialPort('/dev/cu.usbserial-01D9677E', { baudRate: 19200 });
// const port = new SerialPort('COM4', { baudRate: 9600 });
const parser = port.pipe(new Readline());// Read the port data
port.on("open", () => {
console.log('serial port open');
});
......@@ -21,6 +25,9 @@ parser.on('data', data =>{
console.log(data);
});
// parser.on('data', console.log)
app.get('/', function(req, res) {
res.send('Hello world');
port.write('hello world\n', (err) => {
......@@ -36,7 +43,7 @@ app.get('/api/set', function(req, res) {
x += '{"rr":"' + req.query.rr + '"}\n';
}
res.send(x);
port.write(x, (err) => {
//console.log('wrote to port ' + x);
if (err) {
......@@ -82,11 +89,13 @@ app.get('/api/pircs', function(req, res) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.status(400).send(err);
} else {
res.setHeader("Content-Type", "application/json");
res.setHeader('Access-Control-Allow-Origin', '*');
res.status(200).send(x);
console.log("About to write:");
console.log(x);
console.log("done");
port.write(x, (err) => {
if (err) {
return console.log('Error on write: ', err.message);
......@@ -122,4 +131,4 @@ var server = app.listen(5000, function () {
var host = server.address().address;
var port = server.address().port;
console.log("Node.js server running on port %s", port);
})
\ No newline at end of file
})
......@@ -2,36 +2,36 @@
<div class="col-6">
<div class="control-wrapper row">
<label class="col-2" for="control-mode">Mode:</label>
<input class="col-9" type="range" id="control-mode" name="control-mode" min="0" max="2" value="0"/>
<input class="col-9" type="range" id="control-mode" name="control-mode" min="0" max="2" value="0"/>
<label class="col-1" id="control-mode-val">PCV</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-rr">RR:</label>
<input class="col-9" type="range" id="control-rr" name="control-rr" min="1" max="10" value="8"/>
<label class="col-1" id="control-rr-val">8</label>
<input class="col-9" type="range" id="control-rr" name="control-rr" min="1" max="30" value="12"/>
<label class="col-1" id="control-rr-val">12</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-ie">EI:</label>
<input class="col-9" type="range" id="control-ie" name="control-ie" min="1" max="4" step="0.1" value="3"/>
<label class="col-1" id="control-ie-val">3</label>
<label class="col-2" for="control-ie">EI (x10) :</label>
<input class="col-9" type="range" id="control-ie" name="control-ie" min="5" max="50" step="1" value="30"/>
<label class="col-1" id="control-ie-val">30</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-pinsp">Pinsp:</label>
<input class="col-9" type="range" id="control-pinsp" name="control-pinsp" min="10" max="50" value="35"/>
<label class="col-2" for="control-pinsp">Pinsp (cmH20):</label>
<input class="col-9" type="range" id="control-pinsp" name="control-pinsp" min="10" max="50" value="35"/>
<label class="col-1" id="control-pinsp-val">35</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-vinsp">Vinsp:</label>
<input class="col-9" type="range" id="control-vinsp" name="control-vinsp" min="200" max="800" step="50" value="500"/>
<input class="col-9" type="range" id="control-vinsp" name="control-vinsp" min="200" max="800" step="20" value="500"/>
<label class="col-1" id="control-vinsp-val">500</label>
</div>
<div class="control-wrapper row">
<label class="col-2" for="control-peep">PEEP:</label>
<input class="col-9" type="range" id="control-peep" name="control-peep" min="0" max="15" value="5"/>
<label class="col-2" for="control-peep">PEEP (cmH20):</label>
<input class="col-9" type="range" id="control-peep" name="control-peep" min="0" max="15" value="5"/>
<label class="col-1" id="control-peep-val">5</label>
</div>
<button id="control-start" type="button" class="btn btn-primary">START</button>
</div>
......@@ -43,4 +43,4 @@
<b>Log:</b> some log info
</div>
</div>
</div>
\ No newline at end of file
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment