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

nice content fo pd box

parent a072a589
No related branches found
No related tags found
No related merge requests found
......@@ -22,4 +22,9 @@ conf.items = [
, {"display": "1000mbar CDG" ,"exchange":{"Value":1000, "Unit":"mbar"}}
]
conf.basestr_pd = "{center}pump down{/center}";
conf.ctrlstr = {"running" : "{center}{yellow-fg}running ...{/yellow-fg}{/center}"
, "ready" : "{center}{green-fg}ready{/green-fg}{/center}"};
module.exports = conf;
......@@ -82,7 +82,7 @@ var box_pd = blessed.box({
left: 0,
width: wb,
height: hb,
content: '{center}pump down{/center}',
content: conf.basestr_pd,
tags: true,
border: {
type: 'line'
......@@ -114,6 +114,34 @@ box_pd.on("click", function(data){
});
setInterval( function(){
var url = "http://"
+ conf.mp.server + ":"
+ conf.mp.port + "/"
+ conf.mp.mpid + "/0/ctrl";
http.get(url, function(res) {
var body = "";
res.on("data", function(data){
body += data;
});
res.on("end", function() {
var nd = (new Date()).toTimeString().split(" ")[0]
, res = JSON.parse(body).result;
var midstr = conf.ctrlstr[res] ? conf.ctrlstr[res] : "{center}changing ...{/center}";
box_pd.setContent(conf.basestr_pd + "\n"
+ midstr+ "\n"
+ "{center}update: " + nd + "{/center}");
});
});
screen.render();
}, 800);
var box_av = blessed.box({
top: hl,
left: wb,
......@@ -159,6 +187,12 @@ server.get("/pressure_max", function(req, res, next){
next();
});
server.listen(conf.api.port, function() {
screen.title = pj.name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment