brain-monitor
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -14,3 +14,3 @@ const blessed = require('blessed') | ||
screen: screen, | ||
hideBorder: true, | ||
hideBorder: false, | ||
dashboardMargin: 0, | ||
@@ -22,3 +22,3 @@ color: 'black' | ||
['monitor', 'gyro', 'battery', 'log', 'channels'].forEach(w => widgets[w] = require(`./widgets/${w}`)(grid)) | ||
['monitor', 'gyroxy', 'battery', 'log', 'channels'].forEach(w => widgets[w] = require(`./widgets/${w}`)(grid)) | ||
@@ -35,3 +35,3 @@ screen.key(['escape', 'q', 'C-c'], (ch, key) => { | ||
setInterval(() => screen.render(), 500) | ||
setInterval(() => screen.render(), 250) | ||
@@ -45,5 +45,5 @@ mind.setLogger(widgets.log.update) | ||
widgets.channels.update(data.cq) | ||
widgets.gyro.update([data.gyro.x, data.gyro.y]) | ||
widgets.gyroxy.update([data.gyro.x, data.gyro.y]) | ||
widgets.monitor.update(data.levels) | ||
}) | ||
}, 100) |
@@ -125,3 +125,3 @@ const contrib = require('blessed-contrib') | ||
if (self.options.yLabels) | ||
return '' + self.options.yLabels[Math.floor(value * numLabels / (max - min))] | ||
return '' + self.options.yLabels[Math.round(value * numLabels / (max - min))] | ||
@@ -244,1 +244,9 @@ return abbreviate ? utils.abbreviateNumber(res) : res | ||
} | ||
contrib.donut.prototype.calcSize = function() { | ||
this.canvasSize = {width: Math.round(this.width*2-5), height: this.height*4} | ||
if (this.canvasSize.width % 2 == 1) | ||
this.canvasSize.width--; | ||
if (this.canvasSize.height % 4 != 1) | ||
this.canvasSize.height += (this.canvasSize.height % 4); | ||
} |
{ | ||
"name": "brain-monitor", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A terminal app to monitor brain signals in real-time", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
const contrib = require('blessed-contrib') | ||
module.exports = function (grid) { | ||
const battery = grid.set(0, 10, 4, 2, contrib.donut, { | ||
radius: 16, | ||
const battery = grid.set(0, 10, 3, 1, contrib.donut, { | ||
radius: 14, | ||
arcWidth: 4, | ||
yPadding: 8, | ||
remainColor: 'black', | ||
data: [ | ||
{ percent: 10, label: 'Battery', color: 'red' } | ||
{ percent: 0, label: 'Battery', color: 'red' } | ||
] | ||
@@ -11,0 +12,0 @@ }) |
@@ -6,9 +6,22 @@ | ||
function randomColor() { | ||
return [Math.random() * 255, Math.random() * 255, Math.random() * 255] | ||
} | ||
const rainbow = [ | ||
[ 255, 0, 0 ], | ||
[ 255, 102, 0 ], | ||
[ 255, 204, 0 ], | ||
[ 204, 255, 0 ], | ||
[ 102, 255, 0 ], | ||
[ 0, 255, 0 ], | ||
[ 0, 255, 102 ], | ||
[ 0, 255, 204 ], | ||
[ 0, 204, 255 ], | ||
[ 0, 102, 255 ], | ||
[ 0, 0, 255 ], | ||
[ 102, 0, 255 ], | ||
[ 204, 0, 255 ], | ||
[ 255, 0, 204 ], | ||
] | ||
const channelLines = channels.map(c => ({ | ||
const channelLines = channels.map((c, i) => ({ | ||
title: c, | ||
style: { line: randomColor() }, | ||
style: { line: rainbow[i] }, | ||
x: Array(600).fill(0), | ||
@@ -15,0 +28,0 @@ y: Array(600).fill(0) |
19729
14
451