modified to use events, hopefully will fix the crashing particle

This commit is contained in:
Martin Donnelly 2016-02-12 16:11:49 +00:00
parent 60c0f8c153
commit 1d48b8374e

View File

@ -131,9 +131,11 @@ router.post('/', function (req, res, next) {
if(t.hasOwnProperty('data')){
logger.debug('We have data');
var data = t.data;
if (data.hasOwnProperty(temp)) {
var s = data.toString();
logger.debug(typeof s);
/* if (data.hasOwnProperty(temp)) {
logger.log('We have temp! ' + data.temp);
}
}*/
//dataJSON = JSON.parse(data);
//logger.debug(dataJSON);
@ -152,10 +154,10 @@ router.post('/', function (req, res, next) {
{
logger.error('No data block!');
}
console.log(JSON.stringify(t));
/*console.log(JSON.stringify(t));
if (dataJSON != {} && dataJSON.temp != null) {
busEmitter.emit("saveTempData", {time: now.toJSON(), value: parseFloat(dataJSON.temp)});
}
}*/
res.writeHead(200, {"ContentType": "text/html"});
res.end('ok');