From 8672b6584a15b9a76bb473f7054f3183618cd24d Mon Sep 17 00:00:00 2001 From: sixteenmillimeter Date: Tue, 29 Sep 2020 13:48:06 -0400 Subject: [PATCH] Work towards issue #52. Adds a statement within the arduino.end() method that watches for an 'E' char byte and will alert the UI while pausing a running sequence. Needs to be in place for firmware to be able to throw errors to UI. --- app/main.js | 10 +++++++++- app/package-lock.json | 2 +- app/package.json | 2 +- app/src/lib/ui/devices.ts | 8 ++++++++ cli/lib/arduino/index.js | 12 +++++++++--- cli/lib/arduino/index.js.map | 2 +- cli/package.json | 2 +- data/cfg.json | 2 +- package-lock.json | 2 +- package.json | 2 +- src/arduino/index.ts | 38 +++++++++++++++++++++--------------- 11 files changed, 55 insertions(+), 27 deletions(-) diff --git a/app/main.js b/app/main.js index 44a5d9b..1ca893f 100644 --- a/app/main.js +++ b/app/main.js @@ -68,6 +68,14 @@ var createWindow = function () { }) } +var errorState = function () { + if (seq && seq.running) { + //pause sequence if running + seq.pause(); + } + mainWindow.webContents.send('error_state', { stop : true }); +} + var init = async function () { log = await require('log')({}) @@ -85,7 +93,7 @@ var init = async function () { display = require('display')(SYSTEM) ffmpeg = require('ffmpeg')(SYSTEM) ffprobe = require('ffprobe')(SYSTEM) - arduino = require('arduino')(cfg, ee) + arduino = require('arduino')(cfg, ee, errorState) dev = require('devices')(arduino, settings, mainWindow) diff --git a/app/package-lock.json b/app/package-lock.json index 884b3d3..5b0ac71 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "mcopy-app", - "version": "1.6.5", + "version": "1.6.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/app/package.json b/app/package.json index 152e8e7..741cef3 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "mcopy-app", - "version": "1.6.5", + "version": "1.6.6", "description": "GUI for the mcopy small gauge film optical printer platform", "main": "main.js", "scripts": { diff --git a/app/src/lib/ui/devices.ts b/app/src/lib/ui/devices.ts index 2871a3d..8f3f07a 100644 --- a/app/src/lib/ui/devices.ts +++ b/app/src/lib/ui/devices.ts @@ -19,6 +19,7 @@ class Devices { listen () { ipcRenderer.on('ready', this.ready.bind(this)); ipcRenderer.on('intval', this.intvalCb.bind(this)); + ipcRenderer.on('error_state', this.errorState.bind(this)); } async ready (event : any, arg : any) { @@ -172,6 +173,13 @@ class Devices { $('#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(); diff --git a/cli/lib/arduino/index.js b/cli/lib/arduino/index.js index 50dfc72..a86bdfb 100644 --- a/cli/lib/arduino/index.js +++ b/cli/lib/arduino/index.js @@ -25,7 +25,7 @@ const KNOWN = [ * Class representing the arduino communication features **/ class Arduino { - constructor() { + constructor(errorState) { this.path = {}; this.known = KNOWN; this.alias = {}; @@ -35,6 +35,7 @@ class Arduino { this.timer = 0; this.lock = false; this.locks = {}; + this.errorState = errorState; this.init(); } async init() { @@ -169,6 +170,11 @@ class Arduino { eventEmitter.emit('arduino_end', data); delete this.queue[data]; } + else if (data === 'E') { + //error state + //stop sequence + //throw error in ui + } else { //console.log('Received stray "' + data + '"'); //silent to user } @@ -391,10 +397,10 @@ class Arduino { } } if (typeof module !== 'undefined' && module.parent) { - module.exports = function (c, ee) { + module.exports = function (c, ee, errorState) { eventEmitter = ee; cfg = c; - arduino = new Arduino(); + arduino = new Arduino(errorState); return arduino; }; } diff --git a/cli/lib/arduino/index.js.map b/cli/lib/arduino/index.js.map index 54a3da2..8366111 100644 --- a/cli/lib/arduino/index.js.map +++ b/cli/lib/arduino/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/arduino/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,8BAA8B;AAC9B,iCAA+B;AAE/B,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AACxC,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,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;IAED;;;;;;QAMI;IACJ,KAAK,CAAC,YAAY,CAAE,MAAe;QAClC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAa,EAAE,MAAY,EAAE,EAAE;YAClD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAS,EAAE,EAAE;gBAC9C,IAAI,GAAG,EAAE;oBACR,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;iBAClB;gBACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;CACD;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE;IACnD,MAAM,CAAC,OAAO,GAAG,UAAU,CAAO,EAAE,EAAQ,EAAE,UAAqB;QAClE,YAAY,GAAG,EAAE,CAAA;QACjB,GAAG,GAAG,CAAC,CAAA;QACP,OAAO,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAA;QACjC,OAAO,OAAO,CAAA;IACf,CAAC,CAAA;CACD"} \ No newline at end of file diff --git a/cli/package.json b/cli/package.json index da5ffbf..d020155 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "mcopy-cli", - "version": "1.6.5", + "version": "1.6.6", "description": "CLI for controlling the mcopy optical printer platform", "main": "index.js", "scripts": { diff --git a/data/cfg.json b/data/cfg.json index 72e856d..aa6d7e0 100644 --- a/data/cfg.json +++ b/data/cfg.json @@ -1,5 +1,5 @@ { - "version": "1.6.5", + "version": "1.6.6", "ext_port": 1111, "profiles": { "mcopy": { diff --git a/package-lock.json b/package-lock.json index d5bbc18..d559576 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mcopy", - "version": "1.6.5", + "version": "1.6.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 217f55b..816567a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcopy", - "version": "1.6.5", + "version": "1.6.6", "description": "Small gauge film optical printer platform", "main": "build.js", "directories": { diff --git a/src/arduino/index.ts b/src/arduino/index.ts index 289da2a..4575b80 100644 --- a/src/arduino/index.ts +++ b/src/arduino/index.ts @@ -33,18 +33,20 @@ const KNOWN : string[] = [ class Arduino { private log : any; - private path : any = {} - private known : string[] = KNOWN - private alias : any = {} - private serial : any = { connect : {}, projector : {}, camera : {}, light : {} } - private baud : number = 57600 - private queue : any = {} - private timer : number = 0 - private lock : boolean = false - private locks : any = {} - private confirmExec : any + private path : any = {}; + private known : string[] = KNOWN; + private alias : any = {}; + private serial : any = { connect : {}, projector : {}, camera : {}, light : {} }; + private baud : number = 57600; + private queue : any = {}; + private timer : number = 0; + private lock : boolean = false; + private locks : any = {}; + private confirmExec : any; + private errorState : Function; - constructor () { + constructor (errorState : Function) { + this.errorState = errorState; this.init() } @@ -169,14 +171,18 @@ class Arduino { } end (serial : string, data : string) { - const end = new Date().getTime(); - const ms = end - this.timer; - let complete; + const end : number = new Date().getTime(); + const ms : number = end - this.timer; + let complete : any; if (this.queue[data] !== undefined) { this.locks[serial] = false; complete = this.queue[data](ms); //execute callback eventEmitter.emit('arduino_end', data); delete this.queue[data]; + } else if (data === 'E') { + //error state + //stop sequence + //throw error in ui } else { //console.log('Received stray "' + data + '"'); //silent to user } @@ -397,10 +403,10 @@ class Arduino { } if (typeof module !== 'undefined' && module.parent) { - module.exports = function (c : any, ee : any) { + module.exports = function (c : any, ee : any, errorState : Function) { eventEmitter = ee cfg = c - arduino = new Arduino() + arduino = new Arduino(errorState) return arduino } } \ No newline at end of file