Retool arduino module
This commit is contained in:
parent
a8065b559f
commit
3fea43d0ea
|
@ -37,14 +37,14 @@ mcopy.arduino.init = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matches.length === 0) {
|
if (matches.length === 0) {
|
||||||
console.log('No devices found.');
|
//console.log('No USB devices found.');
|
||||||
if (callback) { callback(false); }
|
if (callback) { callback('No USB devices found'); }
|
||||||
} else if (matches.length > 0) {
|
} else if (matches.length > 0) {
|
||||||
console.log('Found ' + matches[0]);
|
//console.log('Found ' + matches[0]);
|
||||||
mcopy.arduino.path = matches[0];
|
mcopy.arduino.path = matches[0];
|
||||||
//once connected to the arduino
|
//once connected to the arduino
|
||||||
//start user interface
|
//start user interface
|
||||||
if (callback) { callback(true); }
|
if (callback) { callback(null, mcopy.arduino.path); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
18
app/main.js
18
app/main.js
|
@ -15,17 +15,18 @@ mcopy.arduino = require('./lib/mcopy-arduino.js')(mcopy.cfg);
|
||||||
var mainWindow;
|
var mainWindow;
|
||||||
|
|
||||||
var init = function () {
|
var init = function () {
|
||||||
|
'use strict';
|
||||||
createWindow();
|
createWindow();
|
||||||
log.init();
|
log.init();
|
||||||
mcopy.arduino.init(function (err, success) {
|
mcopy.arduino.init(function (err, device) {
|
||||||
/*if (success) {
|
if (err) {
|
||||||
log.info('Found devices', 'SERIAL', true);
|
log.info(err, 'SERIAL', false, true);
|
||||||
mcopy.arduino.connect(function () {
|
|
||||||
//
|
|
||||||
});
|
|
||||||
} else {
|
} 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 () {
|
var createWindow = function () {
|
||||||
|
'use strict';
|
||||||
mainWindow = new BrowserWindow({width: 800, height: 600});
|
mainWindow = new BrowserWindow({width: 800, height: 600});
|
||||||
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
//mainWindow.webContents.openDevTools();
|
//mainWindow.webContents.openDevTools();
|
||||||
|
|
Loading…
Reference in New Issue