Retool arduino module

This commit is contained in:
Matt 2016-04-12 23:14:27 -04:00
parent a8065b559f
commit 3fea43d0ea
2 changed files with 14 additions and 12 deletions

View File

@ -37,14 +37,14 @@ mcopy.arduino.init = function (callback) {
}
}
if (matches.length === 0) {
console.log('No devices found.');
if (callback) { callback(false); }
//console.log('No USB devices found.');
if (callback) { callback('No USB devices found'); }
} else if (matches.length > 0) {
console.log('Found ' + matches[0]);
//console.log('Found ' + matches[0]);
mcopy.arduino.path = matches[0];
//once connected to the arduino
//start user interface
if (callback) { callback(true); }
if (callback) { callback(null, mcopy.arduino.path); }
}
});
};

View File

@ -15,17 +15,18 @@ mcopy.arduino = require('./lib/mcopy-arduino.js')(mcopy.cfg);
var mainWindow;
var init = function () {
'use strict';
createWindow();
log.init();
mcopy.arduino.init(function (err, success) {
/*if (success) {
log.info('Found devices', 'SERIAL', true);
mcopy.arduino.connect(function () {
//
});
mcopy.arduino.init(function (err, device) {
if (err) {
log.info(err, 'SERIAL', false, true);
} else {
log.info('Connected', 'SERIAL', true);
}*/
log.info('Found device ' + device, 'SERIAL', true, true);
mcopy.arduino.connect(function () {
log.info('Connected to device ' + device, 'SERIAL', true, true);
});
}
});
};
@ -34,6 +35,7 @@ var createMenu = function () {
};
var createWindow = function () {
'use strict';
mainWindow = new BrowserWindow({width: 800, height: 600});
mainWindow.loadURL('file://' + __dirname + '/index.html');
//mainWindow.webContents.openDevTools();