Rest of last commit. Renderer js
This commit is contained in:
parent
8672b6584a
commit
7c9543239e
|
@ -25,7 +25,7 @@ const KNOWN = [
|
||||||
* Class representing the arduino communication features
|
* Class representing the arduino communication features
|
||||||
**/
|
**/
|
||||||
class Arduino {
|
class Arduino {
|
||||||
constructor() {
|
constructor(errorState) {
|
||||||
this.path = {};
|
this.path = {};
|
||||||
this.known = KNOWN;
|
this.known = KNOWN;
|
||||||
this.alias = {};
|
this.alias = {};
|
||||||
|
@ -35,6 +35,7 @@ class Arduino {
|
||||||
this.timer = 0;
|
this.timer = 0;
|
||||||
this.lock = false;
|
this.lock = false;
|
||||||
this.locks = {};
|
this.locks = {};
|
||||||
|
this.errorState = errorState;
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
async init() {
|
async init() {
|
||||||
|
@ -169,6 +170,11 @@ class Arduino {
|
||||||
eventEmitter.emit('arduino_end', data);
|
eventEmitter.emit('arduino_end', data);
|
||||||
delete this.queue[data];
|
delete this.queue[data];
|
||||||
}
|
}
|
||||||
|
else if (data === 'E') {
|
||||||
|
//error state
|
||||||
|
//stop sequence
|
||||||
|
//throw error in ui
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
//console.log('Received stray "' + data + '"'); //silent to user
|
//console.log('Received stray "' + data + '"'); //silent to user
|
||||||
}
|
}
|
||||||
|
@ -391,10 +397,10 @@ class Arduino {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof module !== 'undefined' && module.parent) {
|
if (typeof module !== 'undefined' && module.parent) {
|
||||||
module.exports = function (c, ee) {
|
module.exports = function (c, ee, errorState) {
|
||||||
eventEmitter = ee;
|
eventEmitter = ee;
|
||||||
cfg = c;
|
cfg = c;
|
||||||
arduino = new Arduino();
|
arduino = new Arduino(errorState);
|
||||||
return arduino;
|
return arduino;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -23,6 +23,7 @@ class Devices {
|
||||||
listen() {
|
listen() {
|
||||||
ipcRenderer.on('ready', this.ready.bind(this));
|
ipcRenderer.on('ready', this.ready.bind(this));
|
||||||
ipcRenderer.on('intval', this.intvalCb.bind(this));
|
ipcRenderer.on('intval', this.intvalCb.bind(this));
|
||||||
|
ipcRenderer.on('error_state', this.errorState.bind(this));
|
||||||
}
|
}
|
||||||
ready(event, arg) {
|
ready(event, arg) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
@ -173,6 +174,12 @@ class Devices {
|
||||||
$('#intval').removeClass('active');
|
$('#intval').removeClass('active');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
errorState() {
|
||||||
|
gui.spinner(false);
|
||||||
|
gui.overlay(false);
|
||||||
|
gui.notify('DEVICES', `Hardware error detected`);
|
||||||
|
gui.warn('Error', 'Hardware error detected. Please address before continuing.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
devices = new Devices();
|
devices = new Devices();
|
||||||
module.exports = devices;
|
module.exports = devices;
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue