Skip to content
Snippets Groups Projects
Commit a072a589 authored by wactbprot's avatar wactbprot
Browse files

pump down on click

parent 748a56ee
No related branches found
No related tags found
No related merge requests found
var conf = {}
conf.port = 9002;
conf.api = {
port : 9002
};
conf.mp = {server : "i75419.berlin.ptb.de",
port : 8001,
mpid : "mpd-se3-add_volume"
}
conf.items = [
{"display": "empty" ,"exchange":{"Value":0, "Unit":"mbar"}}
, {"display": "SRG" ,"exchange":{"Value":2e-2, "Unit":"mbar"}}
, {"display": "0.1T CDG" ,"exchange":{"Value":0.133, "Unit":"mbar"}}
, {"display": "0.25T CDG" ,"exchange":{"Value":0.333, "Unit":"mbar"}}
, {"display": "1T CDG" ,"exchange":{"Value":1.333, "Unit":"mbar"}}
, {"display": "10T CDG" ,"exchange":{"Value":13.33, "Unit":"mbar"}}
, {"display": "100T CDG" ,"exchange":{"Value":133.3, "Unit":"mbar"}}
, {"display": "1000T CDG" ,"exchange":{"Value":1333.2, "Unit":"mbar"}}
, {"display": "0.1mbar CDG" ,"exchange":{"Value":0.1, "Unit":"mbar"}}
, {"display": "1mbar CDG" ,"exchange":{"Value":1, "Unit":"mbar"}}
, {"display": "10mbar CDG" ,"exchange":{"Value":10, "Unit":"mbar"}}
, {"display": "100mbar CDG" ,"exchange":{"Value":100, "Unit":"mbar"}}
, {"display": "1000mbar CDG" ,"exchange":{"Value":1000, "Unit":"mbar"}}
{"display": "empty" ,"exchange":{"Value":0, "Unit":"mbar"}}
, {"display": "SRG" ,"exchange":{"Value":2e-2, "Unit":"mbar"}}
, {"display": "0.1T CDG" ,"exchange":{"Value":0.133, "Unit":"mbar"}}
, {"display": "0.25T CDG" ,"exchange":{"Value":0.333, "Unit":"mbar"}}
, {"display": "1T CDG" ,"exchange":{"Value":1.333, "Unit":"mbar"}}
, {"display": "10T CDG" ,"exchange":{"Value":13.33, "Unit":"mbar"}}
, {"display": "100T CDG" ,"exchange":{"Value":133.3, "Unit":"mbar"}}
, {"display": "1000T CDG" ,"exchange":{"Value":1333.2, "Unit":"mbar"}}
, {"display": "0.1mbar CDG" ,"exchange":{"Value":0.1, "Unit":"mbar"}}
, {"display": "1mbar CDG" ,"exchange":{"Value":1, "Unit":"mbar"}}
, {"display": "10mbar CDG" ,"exchange":{"Value":10, "Unit":"mbar"}}
, {"display": "100mbar CDG" ,"exchange":{"Value":100, "Unit":"mbar"}}
, {"display": "1000mbar CDG" ,"exchange":{"Value":1000, "Unit":"mbar"}}
]
module.exports = conf;
var blessed = require("blessed")
, _ = require("underscore")
, restify = require("restify")
, pj = require("./package.json")
, conf = require("./conf")
, screen = blessed.screen({
, _ = require("underscore")
, restify = require("restify")
, http = require("http")
, pj = require("./package.json")
, conf = require("./conf")
, screen = blessed.screen({
smartCSR: true
})
, item = [];
})
, item = [];
for ( var k=0; k < conf.items.length; k++) {
for ( var k = 0; k < conf.items.length; k++) {
item.push(conf.items[k].display)
}
......@@ -88,6 +89,31 @@ var box_pd = blessed.box({
}
});
box_pd.on("click", function(data){
var go = { method: "PUT",
port: conf.mp.port ,
host: conf.mp.server,
path: "/" + conf.mp.mpid + "/0/ctrl",
headers: {
"Content-Type" : "text/javascript"
}
}
cb = function(res) {
var str = ""
res.on("data", function (chunk) {
str += chunk;
});
res.on("end", function () {
});
}
var req = http.request(go, cb);
req.write("run");
req.end();
});
var box_av = blessed.box({
top: hl,
left: wb,
......@@ -99,7 +125,7 @@ var box_av = blessed.box({
type: 'line'
}
});
screen.append(box_pd);
screen.append(box_av);
......@@ -133,7 +159,7 @@ server.get("/pressure_max", function(req, res, next){
next();
});
server.listen(conf.port, function() {
server.listen(conf.api.port, function() {
screen.title = pj.name
+ " version: " + pj.version
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment