From dac720863dc99c7675b77753762fdc95320d83e9 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sun, 30 Jul 2023 22:13:50 -0400 Subject: [PATCH] Resolves #80 and #81. UI will need a little cleanup. There is some string concatenation happening where it shouldn't. --- app/js/app.js | 1 + app/lib/arduino/index.js | 131 ++++++++++-------- app/lib/arduino/index.js.map | 2 +- app/lib/cam/index.js | 18 ++- app/lib/cam/index.js.map | 2 +- app/lib/devices/index.js | 257 ++++++++++++++++++---------------- app/lib/devices/index.js.map | 2 +- app/lib/proj/index.js | 3 +- app/lib/proj/index.js.map | 2 +- app/lib/ui/timing.js | 20 ++- app/lib/ui/timing.js.map | 2 +- app/src/index.js | 1 + app/src/lib/ui/timing.ts | 26 +++- src/arduino/index.ts | 165 ++++++++++++---------- src/cam/index.ts | 22 ++- src/devices/index.ts | 262 ++++++++++++++++++----------------- src/globals.d.ts | 10 +- src/proj/index.ts | 5 +- 18 files changed, 523 insertions(+), 408 deletions(-) diff --git a/app/js/app.js b/app/js/app.js index be86b17..f80b28b 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -2531,4 +2531,5 @@ async function init () { seq.init(); capper.init(); alertObj.init(); + timing.init(); }; \ No newline at end of file diff --git a/app/lib/arduino/index.js b/app/lib/arduino/index.js index 60c910d..1a23b0a 100644 --- a/app/lib/arduino/index.js +++ b/app/lib/arduino/index.js @@ -41,13 +41,13 @@ class Arduino { this.path = {}; this.known = KNOWN; this.alias = {}; - this.serial = { connect: {}, projector: {}, camera: {}, light: {} }; + this.serial = {}; this.hasState = {}; this.baud = 57600; this.queue = {}; this.timer = 0; - this.lock = false; this.locks = {}; + this.stateStr = {}; this.errorState = errorState; this.init(); } @@ -105,11 +105,12 @@ class Arduino { **/ async sendAsync(device, cmd) { return new Promise((resolve, reject) => { - this.log.info(`sendAsyc ${device} -> ${cmd}`); + this.log.info(`sendAsync ${cmd} -> ${device}`); this.queue[cmd] = (ms) => { return resolve(ms); }; - return this.serial[device].write(cmd, (err, results) => { + this.log.info(`Device: ${device}`); + return this.serial[this.alias[device]].write(cmd, (err, results) => { if (err) { //this.log.error(err) return reject(err); @@ -120,46 +121,46 @@ class Arduino { /** * **/ - async send(serial, cmd) { - const device = this.alias[serial]; - let results; - this.log.info(`send ${cmd} -> ${serial}`); - if (this.locks[serial]) { - this.log.warning(`Serial ${serial} is locked`); - return false; + async send(device, cmd) { + const serial = this.alias[device]; + let ms; + this.log.info(`send ${cmd} -> ${device}`); + if (this.isLocked(serial)) { + this.log.warn(`send Serial ${serial} is locked`); + return null; } this.timer = new Date().getTime(); - this.locks[serial] = true; + this.lock(serial); await delay_1.delay(cfg.arduino.serialDelay); try { - results = await this.sendAsync(device, cmd); + ms = await this.sendAsync(device, cmd); } catch (e) { return this.log.error(e); } - this.locks[serial] = false; + this.unlock(serial); await eventEmitter.emit('arduino_send', cmd); - return results; + return ms; } /** * **/ - async sendString(serial, str) { - const device = this.alias[serial]; + async sendString(device, str) { let writeSuccess; await delay_1.delay(cfg.arduino.serialDelay); - if (typeof this.serial[device].fake !== 'undefined' - && this.serial[device].fake) { - return this.serial[device].string(str); + if (typeof this.serial[this.alias[device]].fake !== 'undefined' + && this.serial[this.alias[device]].fake) { + return this.serial[this.alias[device]].string(str); } else { - this.log.info(`sendString ${device} -> ${str}`); + this.log.info(`sendString ${str} -> ${device}`); try { writeSuccess = await this.writeAsync(device, str); } catch (e) { return this.log.error(e); } + this.unlock(this.alias[device]); return writeSuccess; } } @@ -168,8 +169,10 @@ class Arduino { **/ async stateAsync(device, confirm = false) { const cmd = cfg.arduino.cmd.state; + const serial = confirm ? this.alias['connect'] : this.alias[device]; return new Promise((resolve, reject) => { this.queue[cmd] = (state) => { + this.stateStr[device] = state; if (confirm) { this.hasState[device] = true; this.log.info(`Device ${device} supports state [${state}]`); @@ -186,8 +189,8 @@ class Arduino { } }.bind(this), 1000); } - this.log.info(`stateAsync ${device} -> ${cmd}`); - return this.serial[device].write(cmd, (err, results) => { + this.log.info(`stateAsync ${cmd} -> ${device}`); + return this.serial[serial].write(cmd, (err, results) => { if (err) { //this.log.error(err) return reject(err); @@ -201,25 +204,20 @@ class Arduino { async state(device, confirm = false) { const serial = confirm ? this.alias['connect'] : this.alias[device]; let results; - this.log.info(`state device ${device}`); - this.log.info(`state serial ${serial}`); - console.dir(this.locks); - if (typeof this.locks[serial] !== 'undefined' && this.locks[serial] === true) { - this.log.info("Serial is locked"); + if (this.isLocked(serial)) { + this.log.warn(`state Serial ${serial} is locked`); return null; } this.timer = new Date().getTime(); - this.locks[serial] = true; + this.lock(serial); await delay_1.delay(cfg.arduino.serialDelay); - if (!confirm) - this.log.info("got here"); try { results = await this.stateAsync(device, confirm); } catch (e) { return this.log.error(e); } - this.locks[serial] = false; + this.unlock(serial); await eventEmitter.emit('arduino_state', cfg.arduino.cmd.state); return results; } @@ -233,7 +231,7 @@ class Arduino { **/ async writeAsync(device, str) { return new Promise((resolve, reject) => { - this.serial[device].write(str, function (err, results) { + this.serial[this.alias[device]].write(str, function (err, results) { if (err) { return reject(err); } @@ -248,16 +246,16 @@ class Arduino { const end = new Date().getTime(); const ms = end - this.timer; let complete; - this.log.info(`end ${serial} -> ${data}`); + //this.log.info(`end ${serial} -> ${data}`) if (this.queue[data] !== undefined) { - this.locks[serial] = false; + this.unlock(serial); complete = this.queue[data](ms); //execute callback eventEmitter.emit('arduino_end', data); delete this.queue[data]; } else if (data[0] === cfg.arduino.cmd.state) { - this.log.info(`end serial -> ${serial}`); - this.locks[serial] = false; + //this.log.info(`end serial -> ${serial}`) + this.unlock(serial); complete = this.queue[cfg.arduino.cmd.state](data); eventEmitter.emit('arduino_end', data); delete this.queue[cfg.arduino.cmd.state]; @@ -265,7 +263,7 @@ class Arduino { } else if (data[0] === cfg.arduino.cmd.error) { this.log.error(`Received error from device ${serial}`); - this.locks[serial] = false; + this.unlock(serial); //error state //stop sequence //throw error in ui @@ -275,24 +273,24 @@ class Arduino { } return ms; } - aliasSerial(serial, device) { + aliasSerial(device, serial) { //this.log.info(`Making "${serial}" an alias of ${device}`) - this.alias[serial] = device; + this.alias[device] = serial; } - async connect(serial, device, confirm) { - this.log.info(`connect device ${device}`); - this.log.info(`connect serial ${serial}`); + async connect(device, serial, confirm) { + //this.log.info(`connect device ${device}`) + //this.log.info(`connect serial ${serial}`) return new Promise(async (resolve, reject) => { let connectSuccess; - this.path[serial] = device; - this.alias[serial] = device; - this.serial[device] = new SerialPort({ - path: this.path[serial], + this.path[device] = serial; + this.aliasSerial(device, serial); + this.serial[serial] = new SerialPort({ + path: serial, autoOpen: false, baudRate: cfg.arduino.baud, parser }); - this.locks[device] = false; + this.unlock(serial); try { connectSuccess = await this.openArduino(device); } @@ -300,16 +298,16 @@ class Arduino { this.log.error('failed to open: ' + e); return reject(e); } - this.log.info(`Opened connection with ${this.path[serial]} as ${serial}`); + this.log.info(`Opened connection with ${this.path[device]} as ${device}`); if (!confirm) { - this.serial[device].on('data', async (data) => { + this.serial[this.alias[device]].on('data', async (data) => { let d = data.toString('utf8'); d = d.replace(newlineRe, '').replace(returnRe, ''); return this.end(serial, d); }); } else { - this.serial[device].on('data', async (data) => { + this.serial[this.alias[device]].on('data', async (data) => { let d = data.toString('utf8'); d = d.replace(newlineRe, '').replace(returnRe, ''); return await this.confirmEnd(d); @@ -344,15 +342,17 @@ class Arduino { || data === cfg.arduino.cmd.camera_capper_projectors_identifier) { this.confirmExec(null, data); this.confirmExec = {}; + this.unlock(this.alias['connect']); } else if (data[0] === cfg.arduino.cmd.state) { this.queue[cfg.arduino.cmd.state](data); delete this.queue[cfg.arduino.cmd.state]; + this.unlock(this.alias['connect']); } } async verify() { return new Promise(async (resolve, reject) => { - const device = this.alias['connect']; + const device = 'connect'; let writeSuccess; this.confirmExec = function (err, data) { if (data === cfg.arduino.cmd.connect) { @@ -374,7 +374,7 @@ class Arduino { } async distinguish() { return new Promise(async (resolve, reject) => { - const device = this.alias['connect']; + const device = 'connect'; let writeSuccess; let type; this.confirmExec = function (err, data) { @@ -442,7 +442,7 @@ class Arduino { }); } async close() { - const device = this.alias['connect']; + const device = 'connect'; let closeSuccess; try { closeSuccess = await this.closeArduino(device); @@ -452,10 +452,10 @@ class Arduino { } return closeSuccess; } - async fakeConnect(serial) { - const device = '/dev/fake'; - this.alias[serial] = device; - this.serial[device] = { + async fakeConnect(device) { + const serial = '/dev/fake'; + this.aliasSerial(device, serial); + this.serial[serial] = { write: async function (cmd, cb) { const t = { c: cfg.arduino.cam.time + cfg.arduino.cam.delay, @@ -489,7 +489,7 @@ class Arduino { **/ async openArduino(device) { return new Promise((resolve, reject) => { - return this.serial[device].open((err) => { + return this.serial[this.alias[device]].open((err) => { if (err) { return reject(err); } @@ -506,7 +506,7 @@ class Arduino { **/ async closeArduino(device) { return new Promise((resolve, reject) => { - return this.serial[device].close((err) => { + return this.serial[this.alias[device]].close((err) => { if (err) { return reject(err); } @@ -514,6 +514,17 @@ class Arduino { }); }); } + lock(serial) { + //this.log.info(`Locked serial ${serial}`) + this.locks[serial] = true; + } + unlock(serial) { + //this.log.info(`Unlocked serial ${serial}`) + this.locks[serial] = false; + } + isLocked(serial) { + return typeof this.locks[serial] !== 'undefined' && this.locks[serial] === true; + } } if (typeof module !== 'undefined' && module.parent) { module.exports = function (c, ee, errorState) { diff --git a/app/lib/arduino/index.js.map b/app/lib/arduino/index.js.map index 40d2ebe..ed88766 100644 --- a/app/lib/arduino/index.js.map +++ b/app/lib/arduino/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/arduino/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;IAWI;AAEJ,8BAA8B;AAC9B,iCAA+B;AAE/B,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AAC5C,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAA;AACjE,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAA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I,CAAA;IACZ,CAAC;IAED;;;;;;QAMI;IACJ,KAAK,CAAC,WAAW,CAAE,MAAe;QACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,GAAS,EAAE,EAAE;gBAC7C,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;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 +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/arduino/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;IAWI;AAEJ,8BAA8B;AAC9B,i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W,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/app/lib/cam/index.js b/app/lib/cam/index.js index de621a0..b2527fa 100644 --- a/app/lib/cam/index.js +++ b/app/lib/cam/index.js @@ -164,13 +164,15 @@ class Camera { const started = +new Date(); let ms; let confirmState; + let parts; + let confirmExposure; if (this.intval) { return this.intval.setExposure(this.id, exposure, (ms) => { + this.ui.send('timing', { c: 'c', ms: exposure }); return this.end(cmd, id, ms); }); } else if (this.arduino.hasState[this.id]) { - this.log.info(`Sending cmd ${cmd}`); try { ms = this.arduino.send(this.id, cmd); } @@ -178,25 +180,29 @@ class Camera { this.log.error('Error sending camera exposure command', err); } await delay_1.delay(1); - this.log.info(`Sending str ${str}`); try { ms = await this.arduino.sendString(this.id, str); } catch (err) { this.log.error('Error sending camera exposure string', err); } - this.log.info(`Sent str ${str}`); await ms; - this.log.info(`Sent cmd ${cmd}`); await delay_1.delay(1); - this.log.info(`Sending state request`); try { confirmState = await this.arduino.state(this.id, false); } catch (err) { this.log.error(`Error confirming set state`, err); } - console.dir(confirmState); + parts = this.arduino.stateStr[this.id].split('G'); + if (parts.length > 1) { + parts = parts[1].split('H'); + confirmExposure = parseInt(parts[0]); + if (!isNaN(confirmExposure)) { + this.log.info(`Exposure successfully set to ${confirmExposure}ms`); + this.ui.send('timing', { c: 'c', ms: exposure }); + } + } ms = (+new Date()) - started; return await this.end(cmd, id, ms); } diff --git a/app/lib/cam/index.js.map b/app/lib/cam/index.js.map index f2770ad..6082ab5 100644 --- a/app/lib/cam/index.js.map +++ b/app/lib/cam/index.js.map @@ -1 +1 @@ -{"version":3,"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;YACD,OAAO,IAAI,UAAU,CAAC;SACtB;aAAM,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;YACjD,OAAO,IAAI,iCAAiC,CAAC;SAC7C;aAAM,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE;YACpD,OAAO,IAAI,qBAAqB,CAAC;SACjC;QACD,OAAO,IAAI,IAAI,EAAE,IAAI,CAAA;QACrB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC,CAAC;QACnD,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAa,EAAE,MAAgB;IACjG,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC,CAAA"} \ No newline at end of file diff --git a/app/lib/devices/index.js b/app/lib/devices/index.js index bb7e621..9fcee0c 100644 --- a/app/lib/devices/index.js +++ b/app/lib/devices/index.js @@ -56,34 +56,34 @@ class Devices { * **/ async enumerate() { - let devices; + let serials; try { - devices = await this.arduino.enumerate(); + serials = await this.arduino.enumerate(); } catch (err) { this.log.warn(err, 'SERIAL', false, true); await delay_1.delay(1000); return this.all([]); } - this.log.info(`Found ${devices.length} USB devices`, 'SERIAL', true, true); - devices = this.favor(devices); - return await this.all(devices); + this.log.info(`Found ${serials.length} USB devices`, 'SERIAL', true, true); + serials = this.favor(serials); + return await this.all(serials); } /** * **/ - favor(devices) { + favor(serials) { const past = this.settings.state.devices.filter((device) => { - if (device.arduino) { + if (device.serial) { return device; } }).map((device) => { - return device.arduino; + return device.serial; }); if (past.length === 0) { - return devices; + return serials; } - devices.sort((a, b) => { + serials.sort((a, b) => { if (past.indexOf(a) !== -1 && past.indexOf(b) === -1) { return 1; } @@ -92,17 +92,20 @@ class Devices { } return 0; }); - return devices; + return serials; } /** * **/ - async distinguish(device) { + async distinguish(serial) { let connectSuccess; let verifySuccess; - let type; + let device; + let exposure; + let parts; + //this.log.info(`distinguish() ${serial}`) try { - connectSuccess = await this.arduino.connect('connect', device, true); + connectSuccess = await this.arduino.connect('connect', serial, true); } catch (err) { this.log.error('Error connecting', err); @@ -116,28 +119,38 @@ class Devices { this.log.error('Error verifying device', err); return null; } - this.log.info(`Verified ${device} as mcopy device`, 'SERIAL', true, true); + this.log.info(`Verified ${serial} as mcopy device`, 'SERIAL', true, true); await delay_1.delay(1000); try { - type = await this.arduino.distinguish(); + device = await this.arduino.distinguish(); } catch (err) { this.log.error('Error distinguishing device', err); return null; } - this.remember('arduino', device, type); - this.log.info(`Determined ${device} to be ${type}`, 'SERIAL', true, true); + this.remember('arduino', device, serial); + this.log.info(`Determined ${device} to be ${device}`, 'SERIAL', true, true); await delay_1.delay(100); try { - await this.arduino.state(device.toString(), true); + await this.arduino.state(device, true); } catch (err) { this.log.error('Error checking state capability', err); } - if (this.arduino.hasState[device.toString()]) { - this.arduino.hasState[type] = true; + if (this.arduino.hasState[device]) { + if (device.indexOf('camera') !== -1) { + parts = this.arduino.stateStr[device].split('G'); + if (parts.length > 1) { + parts = parts[1].split('H'); + exposure = parseInt(parts[0]); + if (!isNaN(exposure)) { + this.log.info(`Timing for [${device}] = ${exposure}`); + this.ui.send('timing', { c: 'c', ms: exposure }); + } + } + } } - return type; + return device; } /** * @@ -206,7 +219,7 @@ class Devices { /** * **/ - async connectDevice(device, type) { + async connectDevice(device, serial) { let closeSuccess; let connectSuccess; try { @@ -216,10 +229,10 @@ class Devices { this.log.error('Error closing arduino connection', err); return false; } - if (type === 'projector') { - this.connected.projector = device; + if (device === 'projector') { + this.connected.projector = serial; try { - connectSuccess = await this.arduino.connect('projector', device, false); + connectSuccess = await this.arduino.connect('projector', serial, false); } catch (err) { this.log.error('Error connecting to projector', err); @@ -227,10 +240,10 @@ class Devices { } this.log.info(`Connected to ${device} as PROJECTOR`, 'SERIAL', true, true); } - else if (type === 'camera') { - this.connected.camera = device; + else if (device === 'camera') { + this.connected.camera = serial; try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera', err); @@ -238,10 +251,10 @@ class Devices { } this.log.info(`Connected to ${device} as CAMERA`, 'SERIAL', true, true); } - else if (type === 'light') { - this.connected.light = device; + else if (device === 'light') { + this.connected.light = serial; try { - connectSuccess = await this.arduino.connect('light', device, false); + connectSuccess = await this.arduino.connect('light', serial, false); } catch (err) { this.log.error('Error connecting to light', err); @@ -249,12 +262,12 @@ class Devices { } this.log.info(`Connected to ${device} as LIGHT`, 'SERIAL', true, true); } - else if (type === 'projector,light') { - this.connected.projector = device; - this.connected.light = device; - this.arduino.aliasSerial('light', device); + else if (device === 'projector,light') { + this.connected.projector = serial; + this.connected.light = serial; + this.arduino.aliasSerial('light', serial); try { - connectSuccess = await this.arduino.connect('projector', device, false); + connectSuccess = await this.arduino.connect('projector', serial, false); } catch (err) { this.log.error('Error connecting to projector and light', err); @@ -262,14 +275,14 @@ class Devices { } this.log.info(`Connected to ${device} as PROJECTOR + LIGHT`, 'SERIAL', true, true); } - else if (type === 'projector,camera,light') { - this.connected.projector = device; - this.connected.camera = device; - this.connected.light = device; - this.arduino.aliasSerial('camera', device); - this.arduino.aliasSerial('light', device); + else if (device === 'projector,camera,light') { + this.connected.projector = serial; + this.connected.camera = serial; + this.connected.light = serial; + this.arduino.aliasSerial('camera', serial); + this.arduino.aliasSerial('light', serial); try { - connectSuccess = await this.arduino.connect('projector', device, false); + connectSuccess = await this.arduino.connect('projector', serial, false); } catch (err) { this.log.error('Error connecting to projector, camera and light', err); @@ -277,12 +290,12 @@ class Devices { } this.log.info(`Connected to ${device} as PROJECTOR + CAMERA + LIGHT`, 'SERIAL', true, true); } - else if (type === 'projector,camera') { - this.connected.projector = device; - this.connected.camera = device; - this.arduino.aliasSerial('camera', device); + else if (device === 'projector,camera') { + this.connected.projector = serial; + this.connected.camera = serial; + this.arduino.aliasSerial('camera', serial); try { - connectSuccess = await this.arduino.connect('projector', device, false); + connectSuccess = await this.arduino.connect('projector', serial, false); } catch (err) { this.log.error('Error connecting to projector and camera', err); @@ -290,10 +303,10 @@ class Devices { } this.log.info(`Connected to ${device} as PROJECTOR + CAMERA`, 'SERIAL', true, true); } - else if (type === 'projector_second') { - this.connected.projector_second = device; + else if (device === 'projector_second') { + this.connected.projector_second = serial; try { - connectSuccess = await this.arduino.connect('projector_second', device, false); + connectSuccess = await this.arduino.connect('projector_second', serial, false); } catch (err) { this.log.error('Error connecting to secondary projector', err); @@ -301,130 +314,130 @@ class Devices { } this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true); } - else if (type === 'projector,projector_second') { - this.connected.projector = device; - this.connected.projector_second = device; - this.arduino.aliasSerial('projector_second', device); + else if (device === 'projector,projector_second') { + this.connected.projector = serial; + this.connected.projector_second = serial; + this.arduino.aliasSerial('projector_second', serial); try { - connectSuccess = await this.arduino.connect('projector', device, false); + connectSuccess = await this.arduino.connect('projector', serial, false); } catch (err) { this.log.error('Error connecting to projector and secondary projector', err); return false; } } - else if (type === 'camera_second') { - this.connected.camera_second = device; + else if (device === 'camera_second') { + this.connected.camera_second = serial; try { - connectSuccess = await this.arduino.connect('camera_second', device, false); + connectSuccess = await this.arduino.connect('camera_second', serial, false); } catch (err) { console.error(err); return false; } } - else if (type === 'camera,camera_second') { - this.connected.camera = device; - this.connected.camera_second = device; - this.arduino.aliasSerial('camera_second', device); + else if (device === 'camera,camera_second') { + this.connected.camera = serial; + this.connected.camera_second = serial; + this.arduino.aliasSerial('camera_second', serial); try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera, camera_secondary and projector', err); return false; } } - else if (type === 'camera,projector,projector_second') { - this.connected.camera = device; - this.connected.projector = device; - this.connected.projector_second = device; - this.arduino.aliasSerial('projector', device); - this.arduino.aliasSerial('projector_second', device); + else if (device === 'camera,projector,projector_second') { + this.connected.camera = serial; + this.connected.projector = serial; + this.connected.projector_second = serial; + this.arduino.aliasSerial('projector', serial); + this.arduino.aliasSerial('projector_second', serial); try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera, projector and projector_second', err); return false; } } - else if (type === 'camera,camera_second,projector') { - this.connected.camera = device; - this.connected.camera_second = device; - this.connected.projector = device; - this.arduino.aliasSerial('camera_second', device); - this.arduino.aliasSerial('projector', device); + else if (device === 'camera,camera_second,projector') { + this.connected.camera = serial; + this.connected.camera_second = serial; + this.connected.projector = serial; + this.arduino.aliasSerial('camera_second', serial); + this.arduino.aliasSerial('projector', serial); try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera, camera_second and projector', err); return false; } } - else if (type === 'camera,camera_second,projector,projector_second') { - this.connected.camera = device; - this.connected.camera_second = device; - this.connected.projector = device; - this.connected.projector_second = device; - this.arduino.aliasSerial('camera_second', device); - this.arduino.aliasSerial('projector', device); - this.arduino.aliasSerial('projector_second', device); + else if (device === 'camera,camera_second,projector,projector_second') { + this.connected.camera = serial; + this.connected.camera_second = serial; + this.connected.projector = serial; + this.connected.projector_second = serial; + this.arduino.aliasSerial('camera_second', serial); + this.arduino.aliasSerial('projector', serial); + this.arduino.aliasSerial('projector_second', serial); try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera, camera_second, projector and projector_second', err); return false; } } - else if (type === 'capper') { - this.connected.capper = device; + else if (device === 'capper') { + this.connected.capper = serial; try { - connectSuccess = await this.arduino.connect('capper', device, false); + connectSuccess = await this.arduino.connect('capper', serial, false); } catch (err) { this.log.error('Error connecting capper', err); return false; } } - else if (type === 'camera,capper') { - this.connected.camera = device; - this.connected.capper = device; - this.arduino.aliasSerial('capper', device); + else if (device === 'camera,capper') { + this.connected.camera = serial; + this.connected.capper = serial; + this.arduino.aliasSerial('capper', serial); try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera and capper', err); return false; } } - else if (type === 'camera,capper,projector') { - this.connected.camera = device; - this.connected.capper = device; - this.connected.projector = device; - this.arduino.aliasSerial('capper', device); - this.arduino.aliasSerial('projector', device); + else if (device === 'camera,capper,projector') { + this.connected.camera = serial; + this.connected.capper = serial; + this.connected.projector = serial; + this.arduino.aliasSerial('capper', serial); + this.arduino.aliasSerial('projector', serial); try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera, capper and projector', err); return false; } } - else if (type === 'camera,capper,projector,projector_second') { - this.connected.camera = device; - this.connected.capper = device; - this.connected.projector = device; - this.connected.projector_second = device; - this.arduino.aliasSerial('capper', device); - this.arduino.aliasSerial('projector', device); - this.arduino.aliasSerial('projector_second', device); + else if (device === 'camera,capper,projector,projector_second') { + this.connected.camera = serial; + this.connected.capper = serial; + this.connected.projector = serial; + this.connected.projector_second = serial; + this.arduino.aliasSerial('capper', serial); + this.arduino.aliasSerial('projector', serial); + this.arduino.aliasSerial('projector_second', serial); try { - connectSuccess = await this.arduino.connect('camera', device, false); + connectSuccess = await this.arduino.connect('camera', serial, false); } catch (err) { this.log.error('Error connecting to camera, capper, projector and projector_second', err); @@ -437,11 +450,11 @@ class Devices { * **/ //Cases for 1 or 2 arduinos connected - async all(devices) { + async all(serials) { let c = {}; let p = {}; let l = {}; - let type; + let device; let d; let cs = {}; let ps = {}; @@ -454,16 +467,16 @@ class Devices { projector_second: false, capper: false }; - for (let device of devices) { + for (let serial of serials) { try { - type = await this.distinguish(device); + device = await this.distinguish(serial); } catch (err) { this.log.error('Error distinguishing device', err); throw err; } try { - await this.connectDevice(device, type); + await this.connectDevice(device, serial); } catch (err) { this.log.error('Error connecting to device', err); @@ -502,23 +515,25 @@ class Devices { if (this.settings.state.camera && this.settings.state.camera.intval) { c.intval = this.settings.state.camera.intval; } + //console.dir(this.arduino.alias); + //console.dir(this.arduino.serial); return this.ready(p, c, l, cs, ps, capper); } /** * **/ - remember(which, device, type) { + remember(device, serial, type) { let deviceEntry; const match = this.settings.state.devices.filter((dev) => { - if (dev[which] && dev[which] === device) { + if (dev[device] && dev[device] === serial) { return dev; } }); if (match.length === 0) { deviceEntry = { - type + device, + serial }; - deviceEntry[which] = device; this.settings.state.devices.push(deviceEntry); this.settings.update('devices', this.settings.state.devices); this.settings.save(); diff --git a/app/lib/devices/index.js.map b/app/lib/devices/index.js.map index 02371d4..317ae3d 100644 --- a/app/lib/devices/index.js.map +++ b/app/lib/devices/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/devices/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,iCAA8B;AAC9B,2BAA4B;AAE5B;;;;IAII;AAEJ,MAAM,OAAO;IAYZ;;;QAGI;IACJ,YAAa,OAAiB,EAAE,QAAc,EAAE,UAAgB,EAAE,GAAS;QAbpE,cAAS,GAAS,EAAE,CAAA;QAc1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAA;QACrC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI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,gBAAgB,CAAC,OAAO,EAAE;gBACjD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;aACjC;iBAAM;gBACN,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;aACjC;SACD;QAED,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;YAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;YACpB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YACjC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;SACtC;QAED,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QACtC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;QAC5C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAGpC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;QAEpB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAE3B,OAAO,IAAI,CAAA;IACZ,CAAC;CAMD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,QAAc,EAAE,UAAgB,EAAE,GAAS;IACxF,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,CAAA;AACvD,CAAC,CAAA"} \ No newline at end of file diff --git a/app/lib/proj/index.js b/app/lib/proj/index.js index 9eaf156..aa7dfa0 100644 --- a/app/lib/proj/index.js +++ b/app/lib/proj/index.js @@ -59,6 +59,7 @@ class Projector { this.log.error(`Error setting ${this.id} direction`, err); } } + console.dir(ms); return await this.end(cmd, id, ms); } /** @@ -166,7 +167,7 @@ class Projector { } message += ` ${ms}ms`; this.log.info(message, 'PROJECTOR'); - return await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms }); + return await this.ui.send(this.id, { cmd, id, ms }); } } module.exports = function (arduino, cfg, ui, filmout, second) { diff --git a/app/lib/proj/index.js.map b/app/lib/proj/index.js.map index 71cc387..932d08e 100644 --- a/app/lib/proj/index.js.map +++ b/app/lib/proj/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/proj/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;;AAEjD,2BAA4B;AAE5B,MAAM,SAAS;IAad;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAa,EAAE,SAAmB,KAAK;QAfpF,UAAK,GAAS;YACrB,GAAG,EAAG,CAAC;YACP,GAAG,EAAG,IAAI;SACV,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAMzB,OAAE,GAAY,WAAW,CAAC;QAMjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,MAAM;YAAE,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,GAAG,CAAC,EAAE,KAAK,EAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED;;QAEI;IACI,MAAM;QACb,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,QAA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AACxD,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/proj/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;;AAEjD,2BAA4B;AAE5B,MAAM,SAAS;IAad;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAa,EAAE,SAAmB,KAAK;QAfpF,UAAK,GAAS;YACrB,GAAG,EAAG,CAAC;YACP,GAAG,EAAG,IAAI;SACV,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAMzB,OAAE,GAAY,WAAW,CAAC;QAMjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,MAAM;YAAE,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;QACjC,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,GAAG,CAAC,EAAE,KAAK,EAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED;;QAEI;IACI,MAAM;QACb,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED;;QAEI;IACG,KAAK,CAAC,GAAG,CAAE,GAAa,EAAE,EAAW;QAC3C,IAAI,GAAY,CAAC;QACjB,IAAI,EAAW,CAAC;QAChB,IAAI,GAAG,EAAE;YACR,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC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,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnB,OAAO,IAAI,UAAU,CAAA;aACrB;iBAAM;gBACN,OAAO,IAAI,SAAS,CAAA;aACpB;YACD,OAAO,IAAI,UAAU,CAAA;SACrB;aAAM,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE;YACzD,OAAO,GAAG,mBAAmB,CAAA;YAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnB,OAAO,IAAI,UAAU,CAAA;aACrB;iBAAM;gBACN,OAAO,IAAI,SAAS,CAAA;aACpB;YACD,OAAO,IAAI,UAAU,CAAA;SACrB;aAAM,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;YACnD,OAAO,IAAI,oCAAoC,CAAA;SAC/C;QACD,OAAO,IAAI,IAAI,EAAE,IAAI,CAAA;QACrB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QACnC,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IACpD,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAa,EAAE,MAAgB;IACjG,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AACxD,CAAC,CAAA"} \ No newline at end of file diff --git a/app/lib/ui/timing.js b/app/lib/ui/timing.js index 3ea3d6d..9511812 100644 --- a/app/lib/ui/timing.js +++ b/app/lib/ui/timing.js @@ -33,6 +33,17 @@ class Timing { 'PBPF': 'projs' }; } + init() { + this.listen(); + } + listen() { + ipcRenderer.on('timing', this.timing.bind(this)); + } + timing(event, arg) { + if (arg.c) { + this.update(arg.c, parseInt(arg.ms), true); + } + } reset(profile) { const keys = Object.keys(profile); const cmds = Object.keys(cfg.cmd); @@ -74,11 +85,16 @@ class Timing { this.data = timing; } //update with rolling average - update(c, ms) { + update(c, ms, force = false) { let cmd = this.fromArduino[c]; let id; if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') { - this.data[cmd] = Math.round((this.data[cmd] + ms) / 2); + if (force) { + this.data[cmd] = ms; + } + else { + this.data[cmd] = Math.round((this.data[cmd] + ms) / 2); + } id = `#${cmd}_time`; this.updateUI(id, this.data[cmd]); } diff --git a/app/lib/ui/timing.js.map b/app/lib/ui/timing.js.map index 497a839..42a58b8 100644 --- a/app/lib/ui/timing.js.map +++ b/app/lib/ui/timing.js.map @@ -1 +1 @@ -{"version":3,"file":"timing.js","sourceRoot":"","sources":["../../src/lib/ui/timing.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,MAAe,CAAC;AAMpB,MAAM,MAAM;IAoCX;QAnCO,SAAI,GAAgB,EAE1B,CAAA;QAEO,gBAAW,GAAS;YAC3B,GAAG,EAAG,KAAK;YACR,GAAG,EAAG,MAAM;YACZ,GAAG,EAAG,MAAM;YACZ,GAAG,EAAG,OAAO;YAChB,GAAG,EAAG,MAAM;YACT,GAAG,EAAG,OAAO;YAChB,GAAG,EAAG,OAAO;SACb,CAAA;QAEO,YAAO,GAAU;YACxB,IAAI,EAAG,KAAK;YACZ,IAAI,EAAG,KAAK;YACZ,IAAI,EAAG,OAAO;YACX,IAAI,EAAG,OAAO;YACd,KAAK,EAAE,MAAM;YACb,KAAK,EAAE,MAAM;YACb,KAAK,EAAG,MAAM;YACd,KAAK,EAAG,MAAM;YACd,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,MAAM;YACjB,IAAI,EAAG,MAAM;YACb,IAAI,EAAG,MAAM;YACb,KAAK,EAAG,OAAO;YACf,KAAK,EAAG,OAAO;YACf,KAAK,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SACtB;QACD,OAAO,CAAC,CAAC;IACV,CAAC;IAEM,KAAK;QACX,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,MAAM,EAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;CACD;AAED,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAEtB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/app/src/index.js b/app/src/index.js index f25f52a..e16d436 100644 --- a/app/src/index.js +++ b/app/src/index.js @@ -57,4 +57,5 @@ async function init () { seq.init(); capper.init(); alertObj.init(); + timing.init(); }; \ No newline at end of file diff --git a/app/src/lib/ui/timing.ts b/app/src/lib/ui/timing.ts index 1106985..3f7fa80 100644 --- a/app/src/lib/ui/timing.ts +++ b/app/src/lib/ui/timing.ts @@ -7,9 +7,7 @@ interface TimingData { } class Timing { - public data : TimingData = { - - } + public data : TimingData = {} private fromArduino : any = { 'c' : 'cam', @@ -46,6 +44,20 @@ class Timing { } + public init () { + this.listen(); + } + + private listen () { + ipcRenderer.on('timing', this.timing.bind(this)); + } + + private timing (event : any, arg : any) { + if (arg.c) { + this.update(arg.c, parseInt(arg.ms), true); + } + } + public reset (profile : any) { const keys : string[] = Object.keys(profile); const cmds : string[] = Object.keys(cfg.cmd); @@ -89,11 +101,15 @@ class Timing { } //update with rolling average - public update (c : string, ms : number) { + public update (c : string, ms : number, force : boolean = false) { let cmd : string = this.fromArduino[c]; let id : string; if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') { - this.data[cmd] = Math.round((this.data[cmd] + ms) / 2); + if (force) { + this.data[cmd] = ms; + } else { + this.data[cmd] = Math.round((this.data[cmd] + ms) / 2); + } id = `#${cmd}_time`; this.updateUI(id, this.data[cmd]); } diff --git a/src/arduino/index.ts b/src/arduino/index.ts index bc3551a..32cb3b4 100644 --- a/src/arduino/index.ts +++ b/src/arduino/index.ts @@ -49,16 +49,17 @@ class Arduino { private path : any = {}; private known : string[] = KNOWN; private alias : any = {}; - private serial : any = { connect : {}, projector : {}, camera : {}, light : {} }; - private hasState : any = { }; + private serial : any = {}; + private hasState : any = {}; private baud : number = 57600; private queue : any = {}; private timer : number = 0; - private lock : boolean = false; private locks : any = {}; private confirmExec : any; private errorState : Function; + public stateStr : any = {}; + constructor (errorState : Function) { this.errorState = errorState; this.init() @@ -74,7 +75,7 @@ class Arduino { * * @returns {Promise} Resolves after enumerating **/ - async enumerate () { + public async enumerate () : Promise{ let ports : any[] let matches : string[] = [] try { @@ -112,13 +113,14 @@ class Arduino { * * @returns {Promise} Resolves after sending **/ - async sendAsync (device : string, cmd : string) { + private async sendAsync (device : string, cmd : string) : Promise { return new Promise ((resolve, reject) => { - this.log.info(`sendAsyc ${device} -> ${cmd}`) + this.log.info(`sendAsync ${cmd} -> ${device}`) this.queue[cmd] = (ms : number) => { return resolve(ms) } - return this.serial[device].write(cmd, (err : any, results : any) => { + this.log.info(`Device: ${device}`) + return this.serial[this.alias[device]].write(cmd, (err : any, results : any) => { if (err) { //this.log.error(err) return reject(err) @@ -130,45 +132,45 @@ class Arduino { /** * **/ - async send (serial : string, cmd : string) { - const device : any = this.alias[serial] - let results : any - this.log.info(`send ${cmd} -> ${serial}`) - if (this.locks[serial]) { - this.log.warning(`Serial ${serial} is locked`) - return false + public async send (device : string, cmd : string) : Promise { + const serial : any = this.alias[device] + let ms : number + this.log.info(`send ${cmd} -> ${device}`) + if (this.isLocked(serial)) { + this.log.warn(`send Serial ${serial} is locked`) + return null } this.timer = new Date().getTime() - this.locks[serial] = true + this.lock(serial) await delay(cfg.arduino.serialDelay) try { - results = await this.sendAsync(device, cmd) + ms = await this.sendAsync(device, cmd) } catch (e) { return this.log.error(e) } - this.locks[serial] = false + this.unlock(serial) await eventEmitter.emit('arduino_send', cmd) - return results + return ms } /** * **/ - async sendString (serial : string, str : string) : Promise { - const device : any = this.alias[serial] + public async sendString (device : string, str : string) : Promise { let writeSuccess : any await delay(cfg.arduino.serialDelay) - if (typeof this.serial[device].fake !== 'undefined' - && this.serial[device].fake) { - return this.serial[device].string(str) + if (typeof this.serial[this.alias[device]].fake !== 'undefined' + && this.serial[this.alias[device]].fake) { + return this.serial[this.alias[device]].string(str) } else { - this.log.info(`sendString ${device} -> ${str}`) + this.log.info(`sendString ${str} -> ${device}`) try { writeSuccess = await this.writeAsync(device, str) } catch (e) { return this.log.error(e) } + this.unlock(this.alias[device]) return writeSuccess } } @@ -176,10 +178,12 @@ class Arduino { /** * **/ - async stateAsync (device : string, confirm : boolean = false) : Promise { + private async stateAsync (device : string, confirm : boolean = false) : Promise { const cmd : string = cfg.arduino.cmd.state + const serial : string = confirm ? this.alias['connect'] : this.alias[device] return new Promise ((resolve, reject) => { this.queue[cmd] = (state : string) => { + this.stateStr[device] = state if (confirm) { this.hasState[device] = true this.log.info(`Device ${device} supports state [${state}]`) @@ -196,8 +200,8 @@ class Arduino { } }.bind(this), 1000) } - this.log.info(`stateAsync ${device} -> ${cmd}`) - return this.serial[device].write(cmd, (err : any, results : any) => { + this.log.info(`stateAsync ${cmd} -> ${device}`) + return this.serial[serial].write(cmd, (err : any, results : any) => { if (err) { //this.log.error(err) return reject(err) @@ -209,26 +213,25 @@ class Arduino { /** * **/ - async state (device : string, confirm : boolean = false) : Promise{ + public async state (device : string, confirm : boolean = false) : Promise{ const serial : string = confirm ? this.alias['connect'] : this.alias[device] let results : string - this.log.info(`state device ${device}`) - this.log.info(`state serial ${serial}`) - console.dir(this.locks) - if (typeof this.locks[serial] !== 'undefined' && this.locks[serial] === true) { - this.log.info("Serial is locked") + + if (this.isLocked(serial)) { + this.log.warn(`state Serial ${serial} is locked`) return null } this.timer = new Date().getTime() - this.locks[serial] = true + this.lock(serial) + await delay(cfg.arduino.serialDelay) - if (!confirm) this.log.info("got here") + try { results = await this.stateAsync(device, confirm) } catch (e) { return this.log.error(e) } - this.locks[serial] = false + this.unlock(serial) await eventEmitter.emit('arduino_state', cfg.arduino.cmd.state) return results @@ -242,9 +245,9 @@ class Arduino { * * @returns {Promise} Resolves after sending **/ - async writeAsync (device : string, str : string) : Promise { + private async writeAsync (device : string, str : string) : Promise { return new Promise ((resolve, reject) => { - this.serial[device].write(str, function (err : any, results : any) { + this.serial[this.alias[device]].write(str, function (err : any, results : any) { if (err) { return reject(err) } @@ -256,26 +259,26 @@ class Arduino { /** * **/ - end (serial : string, data : string) : any { + private end (serial : string, data : string) : any { const end : number = new Date().getTime() const ms : number = end - this.timer let complete : any - this.log.info(`end ${serial} -> ${data}`) + //this.log.info(`end ${serial} -> ${data}`) if (this.queue[data] !== undefined) { - this.locks[serial] = false + this.unlock(serial) complete = this.queue[data](ms) //execute callback eventEmitter.emit('arduino_end', data) delete this.queue[data] } else if (data[0] === cfg.arduino.cmd.state) { - this.log.info(`end serial -> ${serial}`) - this.locks[serial] = false + //this.log.info(`end serial -> ${serial}`) + this.unlock(serial) complete = this.queue[cfg.arduino.cmd.state](data) eventEmitter.emit('arduino_end', data) delete this.queue[cfg.arduino.cmd.state] return data } else if (data[0] === cfg.arduino.cmd.error) { this.log.error(`Received error from device ${serial}`) - this.locks[serial] = false + this.unlock(serial) //error state //stop sequence //throw error in ui @@ -285,40 +288,40 @@ class Arduino { return ms } - aliasSerial (serial : string, device : string) { + public aliasSerial (device : string, serial : string) { //this.log.info(`Making "${serial}" an alias of ${device}`) - this.alias[serial] = device; + this.alias[device] = serial; } - async connect (serial : string, device : string, confirm : any) : Promise { - this.log.info(`connect device ${device}`) - this.log.info(`connect serial ${serial}`) + public async connect (device : string, serial : string, confirm : any) : Promise { + //this.log.info(`connect device ${device}`) + //this.log.info(`connect serial ${serial}`) return new Promise(async (resolve, reject) => { let connectSuccess : any - this.path[serial] = device - this.alias[serial] = device - this.serial[device] = new SerialPort({ - path : this.path[serial], + this.path[device] = serial + this.aliasSerial(device, serial) + this.serial[serial] = new SerialPort({ + path : serial, autoOpen : false, baudRate: cfg.arduino.baud, parser }) - this.locks[device] = false + this.unlock(serial) try { connectSuccess = await this.openArduino(device) } catch (e) { this.log.error('failed to open: ' + e) return reject(e) } - this.log.info(`Opened connection with ${this.path[serial]} as ${serial}`) + this.log.info(`Opened connection with ${this.path[device]} as ${device}`) if (!confirm) { - this.serial[device].on('data', async (data : Buffer) => { + this.serial[this.alias[device]].on('data', async (data : Buffer) => { let d = data.toString('utf8') d = d.replace(newlineRe, '').replace(returnRe, '') return this.end(serial, d) }) } else { - this.serial[device].on('data', async (data : Buffer) => { + this.serial[this.alias[device]].on('data', async (data : Buffer) => { let d = data.toString('utf8') d = d.replace(newlineRe, '').replace(returnRe, '') return await this.confirmEnd(d) @@ -329,7 +332,7 @@ class Arduino { }) } - confirmEnd (data : string) { + private confirmEnd (data : string) { if ( data === cfg.arduino.cmd.connect || data === cfg.arduino.cmd.projector_identifier || data === cfg.arduino.cmd.camera_identifier @@ -359,15 +362,17 @@ class Arduino { this.confirmExec(null, data) this.confirmExec = {} + this.unlock(this.alias['connect']) } else if (data[0] === cfg.arduino.cmd.state) { this.queue[cfg.arduino.cmd.state](data) delete this.queue[cfg.arduino.cmd.state] + this.unlock(this.alias['connect']) } } - async verify () { + public async verify () { return new Promise(async (resolve, reject) => { - const device : any = this.alias['connect'] + const device : string = 'connect' let writeSuccess : any this.confirmExec = function (err : any, data : string) { if (data === cfg.arduino.cmd.connect) { @@ -388,9 +393,9 @@ class Arduino { }) } - async distinguish () { + public async distinguish () { return new Promise(async (resolve, reject) => { - const device : any = this.alias['connect'] + const device : string = 'connect' let writeSuccess : any let type : string this.confirmExec = function (err : any, data : string) { @@ -443,9 +448,9 @@ class Arduino { }) } - async close () { - const device = this.alias['connect'] - let closeSuccess + public async close () { + const device : string = 'connect' + let closeSuccess : boolean try { closeSuccess = await this.closeArduino(device) } catch (e) { @@ -454,10 +459,10 @@ class Arduino { return closeSuccess } - async fakeConnect (serial : string) { - const device : string = '/dev/fake' - this.alias[serial] = device - this.serial[device] = { + public async fakeConnect (device : string) { + const serial : string = '/dev/fake' + this.aliasSerial(device, serial) + this.serial[serial] = { write : async function (cmd : string, cb : any) { const t : any = { c : cfg.arduino.cam.time + cfg.arduino.cam.delay, @@ -492,9 +497,9 @@ class Arduino { * * @returns {Promise} Resolves after opening **/ - async openArduino (device : string) { + private async openArduino (device : string) : Promise { return new Promise((resolve, reject) => { - return this.serial[device].open((err : any) => { + return this.serial[this.alias[device]].open((err : any) => { if (err) { return reject(err) } @@ -510,9 +515,9 @@ class Arduino { * * @returns {Promise} Resolves after closing **/ - async closeArduino (device : string) { + private async closeArduino (device : string) : Promise { return new Promise((resolve : any, reject : any) => { - return this.serial[device].close((err : any) => { + return this.serial[this.alias[device]].close((err : any) => { if (err) { return reject(err) } @@ -520,6 +525,20 @@ class Arduino { }) }) } + + private lock (serial : string) { + //this.log.info(`Locked serial ${serial}`) + this.locks[serial] = true + } + + private unlock (serial : string) { + //this.log.info(`Unlocked serial ${serial}`) + this.locks[serial] = false + } + + private isLocked (serial : string) { + return typeof this.locks[serial] !== 'undefined' && this.locks[serial] === true + } } if (typeof module !== 'undefined' && module.parent) { diff --git a/src/cam/index.ts b/src/cam/index.ts index bd541ec..a32c563 100644 --- a/src/cam/index.ts +++ b/src/cam/index.ts @@ -167,13 +167,15 @@ class Camera { const started : number = +new Date(); let ms : any; let confirmState : any; + let parts : string[]; + let confirmExposure : number; if (this.intval) { return this.intval.setExposure(this.id, exposure, (ms : number) => { + this.ui.send('timing', { c : 'c', ms : exposure }); return this.end(cmd, id, ms); }); } else if (this.arduino.hasState[this.id]) { - this.log.info(`Sending cmd ${cmd}`); try { ms = this.arduino.send(this.id, cmd); } catch (err) { @@ -181,23 +183,31 @@ class Camera { } await delay(1); - this.log.info(`Sending str ${str}`); + try { ms = await this.arduino.sendString(this.id, str); } catch (err) { this.log.error('Error sending camera exposure string', err); } - this.log.info(`Sent str ${str}`); await ms; - this.log.info(`Sent cmd ${cmd}`); await delay(1); - this.log.info(`Sending state request`); + try { confirmState = await this.arduino.state(this.id, false); } catch (err) { this.log.error(`Error confirming set state`, err); } - console.dir(confirmState); + + parts = this.arduino.stateStr[this.id].split('G') + if (parts.length > 1) { + parts = parts[1].split('H') + confirmExposure = parseInt(parts[0]) + if (!isNaN(confirmExposure)) { + this.log.info(`Exposure successfully set to ${confirmExposure}ms`) + this.ui.send('timing', { c : 'c', ms : exposure }) + } + } + ms = (+new Date()) - started; return await this.end(cmd, id, ms); } diff --git a/src/devices/index.ts b/src/devices/index.ts index 7715ff3..a59cf77 100644 --- a/src/devices/index.ts +++ b/src/devices/index.ts @@ -68,33 +68,33 @@ class Devices { * **/ public async enumerate () { - let devices : Device[]; + let serials : string[]; try{ - devices = await this.arduino.enumerate(); + serials = await this.arduino.enumerate(); } catch (err) { this.log.warn(err, 'SERIAL', false, true); await delay(1000); return this.all([]); } - this.log.info(`Found ${devices.length} USB devices`, 'SERIAL', true, true); - devices = this.favor(devices); - return await this.all(devices); + this.log.info(`Found ${serials.length} USB devices`, 'SERIAL', true, true); + serials = this.favor(serials); + return await this.all(serials); } /** * **/ - private favor (devices : Device[]) { + private favor (serials : string[]) { const past = this.settings.state.devices.filter((device : Device) => { - if (device.arduino) { + if (device.serial) { return device; } }).map((device : Device) => { - return device.arduino; + return device.serial; }) if (past.length === 0) { - return devices; + return serials; } - devices.sort((a : any, b : any) => { + serials.sort((a : any, b : any) => { if (past.indexOf(a) !== -1 && past.indexOf(b) === -1) { return 1; } else if (past.indexOf(a) === -1 && past.indexOf(b) !== -1) { @@ -102,18 +102,20 @@ class Devices { } return 0; }) - return devices; + return serials; } /** * **/ - private async distinguish (device : Device) { - let connectSuccess : any; - let verifySuccess : any; - let type : any; - + private async distinguish (serial : string) { + let connectSuccess : any + let verifySuccess : any + let device : any + let exposure : number + let parts : string[] + //this.log.info(`distinguish() ${serial}`) try { - connectSuccess = await this.arduino.connect('connect', device, true) + connectSuccess = await this.arduino.connect('connect', serial, true) } catch (err) { this.log.error('Error connecting', err) return null @@ -128,34 +130,44 @@ class Devices { return null } - this.log.info(`Verified ${device} as mcopy device`, 'SERIAL', true, true) + this.log.info(`Verified ${serial} as mcopy device`, 'SERIAL', true, true) await delay(1000) try { - type = await this.arduino.distinguish() + device = await this.arduino.distinguish() } catch (err) { this.log.error('Error distinguishing device', err) return null } - this.remember('arduino', device, type) - this.log.info(`Determined ${device} to be ${type}`, 'SERIAL', true, true) + this.remember('arduino', device, serial) + this.log.info(`Determined ${device} to be ${device}`, 'SERIAL', true, true) await delay(100) try { - await this.arduino.state(device.toString(), true) + await this.arduino.state(device, true) } catch (err) { this.log.error('Error checking state capability', err) } - if (this.arduino.hasState[device.toString()]) { - this.arduino.hasState[type] = true; + if (this.arduino.hasState[device]) { + if (device.indexOf('camera') !== -1) { + parts = this.arduino.stateStr[device].split('G') + if (parts.length > 1) { + parts = parts[1].split('H') + exposure = parseInt(parts[0]) + if (!isNaN(exposure)) { + this.log.info(`Timing for [${device}] = ${exposure}`) + this.ui.send('timing', { c : 'c', ms : exposure }) + } + } + } } - return type + return device } /** * @@ -221,7 +233,7 @@ class Devices { /** * **/ - private async connectDevice (device : Device, type : any) { + private async connectDevice (device : string, serial : string) { let closeSuccess : any; let connectSuccess : any; try { @@ -230,188 +242,188 @@ class Devices { this.log.error('Error closing arduino connection', err) return false } - if (type === 'projector') { - this.connected.projector = device + if (device === 'projector') { + this.connected.projector = serial try { - connectSuccess = await this.arduino.connect('projector', device, false) + connectSuccess = await this.arduino.connect('projector', serial, false) } catch (err) { this.log.error('Error connecting to projector', err) return false } this.log.info(`Connected to ${device} as PROJECTOR`, 'SERIAL', true, true) - } else if (type === 'camera') { - this.connected.camera = device + } else if (device === 'camera') { + this.connected.camera = serial try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera', err) return false } this.log.info(`Connected to ${device} as CAMERA`, 'SERIAL', true, true) - } else if (type === 'light') { - this.connected.light = device + } else if (device === 'light') { + this.connected.light = serial try { - connectSuccess = await this.arduino.connect('light', device, false) + connectSuccess = await this.arduino.connect('light', serial, false) } catch (err) { this.log.error('Error connecting to light', err) return false } this.log.info(`Connected to ${device} as LIGHT`, 'SERIAL', true, true) - } else if (type === 'projector,light') { - this.connected.projector = device - this.connected.light = device - this.arduino.aliasSerial('light', device) + } else if (device === 'projector,light') { + this.connected.projector = serial + this.connected.light = serial + this.arduino.aliasSerial('light', serial) try{ - connectSuccess = await this.arduino.connect('projector', device, false) + connectSuccess = await this.arduino.connect('projector', serial, false) } catch (err) { this.log.error('Error connecting to projector and light', err) return false } this.log.info(`Connected to ${device} as PROJECTOR + LIGHT`, 'SERIAL', true, true) - } else if (type === 'projector,camera,light') { - this.connected.projector = device - this.connected.camera = device - this.connected.light = device - this.arduino.aliasSerial('camera', device) - this.arduino.aliasSerial('light', device) + } else if (device === 'projector,camera,light') { + this.connected.projector = serial + this.connected.camera = serial + this.connected.light = serial + this.arduino.aliasSerial('camera', serial) + this.arduino.aliasSerial('light', serial) try { - connectSuccess = await this.arduino.connect('projector', device, false) + connectSuccess = await this.arduino.connect('projector', serial, false) } catch (err) { this.log.error('Error connecting to projector, camera and light', err) return false } this.log.info(`Connected to ${device} as PROJECTOR + CAMERA + LIGHT`, 'SERIAL', true, true) - } else if (type === 'projector,camera') { - this.connected.projector = device - this.connected.camera = device - this.arduino.aliasSerial('camera', device) + } else if (device === 'projector,camera') { + this.connected.projector = serial + this.connected.camera = serial + this.arduino.aliasSerial('camera', serial) try { - connectSuccess = await this.arduino.connect('projector', device, false) + connectSuccess = await this.arduino.connect('projector', serial, false) } catch (err) { this.log.error('Error connecting to projector and camera', err) return false } this.log.info(`Connected to ${device} as PROJECTOR + CAMERA`, 'SERIAL', true, true) - } else if (type === 'projector_second') { - this.connected.projector_second = device + } else if (device === 'projector_second') { + this.connected.projector_second = serial try { - connectSuccess = await this.arduino.connect('projector_second', device, false) + connectSuccess = await this.arduino.connect('projector_second', serial, false) } catch (err) { this.log.error('Error connecting to secondary projector', err) return false } this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true) - } else if (type === 'projector,projector_second') { - this.connected.projector = device - this.connected.projector_second = device - this.arduino.aliasSerial('projector_second', device) + } else if (device === 'projector,projector_second') { + this.connected.projector = serial + this.connected.projector_second = serial + this.arduino.aliasSerial('projector_second', serial) try { - connectSuccess = await this.arduino.connect('projector', device, false) + connectSuccess = await this.arduino.connect('projector', serial, false) } catch (err) { this.log.error('Error connecting to projector and secondary projector', err) return false } - } else if (type === 'camera_second') { - this.connected.camera_second = device + } else if (device === 'camera_second') { + this.connected.camera_second = serial try { - connectSuccess = await this.arduino.connect('camera_second', device, false) + connectSuccess = await this.arduino.connect('camera_second', serial, false) } catch (err) { console.error(err) return false } - } else if (type === 'camera,camera_second') { - this.connected.camera = device - this.connected.camera_second = device - this.arduino.aliasSerial('camera_second', device) + } else if (device === 'camera,camera_second') { + this.connected.camera = serial + this.connected.camera_second = serial + this.arduino.aliasSerial('camera_second', serial) try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera, camera_secondary and projector', err) return false } - } else if (type === 'camera,projector,projector_second') { - this.connected.camera = device - this.connected.projector = device - this.connected.projector_second = device - this.arduino.aliasSerial('projector', device) - this.arduino.aliasSerial('projector_second', device) + } else if (device === 'camera,projector,projector_second') { + this.connected.camera = serial + this.connected.projector = serial + this.connected.projector_second = serial + this.arduino.aliasSerial('projector', serial) + this.arduino.aliasSerial('projector_second', serial) try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera, projector and projector_second', err) return false } - } else if (type === 'camera,camera_second,projector') { - this.connected.camera = device - this.connected.camera_second = device - this.connected.projector = device - this.arduino.aliasSerial('camera_second', device) - this.arduino.aliasSerial('projector', device) + } else if (device === 'camera,camera_second,projector') { + this.connected.camera = serial + this.connected.camera_second = serial + this.connected.projector = serial + this.arduino.aliasSerial('camera_second', serial) + this.arduino.aliasSerial('projector', serial) try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera, camera_second and projector', err) return false } - } else if (type === 'camera,camera_second,projector,projector_second') { - this.connected.camera = device - this.connected.camera_second = device - this.connected.projector = device - this.connected.projector_second = device - this.arduino.aliasSerial('camera_second', device) - this.arduino.aliasSerial('projector', device) - this.arduino.aliasSerial('projector_second', device) + } else if (device === 'camera,camera_second,projector,projector_second') { + this.connected.camera = serial + this.connected.camera_second = serial + this.connected.projector = serial + this.connected.projector_second = serial + this.arduino.aliasSerial('camera_second', serial) + this.arduino.aliasSerial('projector', serial) + this.arduino.aliasSerial('projector_second', serial) try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera, camera_second, projector and projector_second', err) return false } - } else if (type === 'capper') { - this.connected.capper = device + } else if (device === 'capper') { + this.connected.capper = serial try { - connectSuccess = await this.arduino.connect('capper', device, false) + connectSuccess = await this.arduino.connect('capper', serial, false) } catch (err) { this.log.error('Error connecting capper', err) return false } - } else if (type === 'camera,capper') { - this.connected.camera = device - this.connected.capper = device - this.arduino.aliasSerial('capper', device) + } else if (device === 'camera,capper') { + this.connected.camera = serial + this.connected.capper = serial + this.arduino.aliasSerial('capper', serial) try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera and capper', err) return false } - } else if (type === 'camera,capper,projector') { - this.connected.camera = device - this.connected.capper = device - this.connected.projector = device - this.arduino.aliasSerial('capper', device) - this.arduino.aliasSerial('projector', device) + } else if (device === 'camera,capper,projector') { + this.connected.camera = serial + this.connected.capper = serial + this.connected.projector = serial + this.arduino.aliasSerial('capper', serial) + this.arduino.aliasSerial('projector', serial) try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera, capper and projector', err) return false } - } else if (type === 'camera,capper,projector,projector_second') { - this.connected.camera = device - this.connected.capper = device - this.connected.projector = device - this.connected.projector_second = device - this.arduino.aliasSerial('capper', device) - this.arduino.aliasSerial('projector', device) - this.arduino.aliasSerial('projector_second', device) + } else if (device === 'camera,capper,projector,projector_second') { + this.connected.camera = serial + this.connected.capper = serial + this.connected.projector = serial + this.connected.projector_second = serial + this.arduino.aliasSerial('capper', serial) + this.arduino.aliasSerial('projector', serial) + this.arduino.aliasSerial('projector_second', serial) try { - connectSuccess = await this.arduino.connect('camera', device, false) + connectSuccess = await this.arduino.connect('camera', serial, false) } catch (err) { this.log.error('Error connecting to camera, capper, projector and projector_second', err) return false @@ -423,11 +435,11 @@ class Devices { * **/ //Cases for 1 or 2 arduinos connected - private async all (devices : Device[]) { + private async all (serials : string[]) { let c : any = {} let p : any = {} let l : any = {} - let type : string; + let device : string; let d : any let cs : any = {} let ps : any = {} @@ -442,16 +454,16 @@ class Devices { capper : false } - for (let device of devices) { + for (let serial of serials) { try { - type = await this.distinguish(device) + device = await this.distinguish(serial) } catch (err) { this.log.error('Error distinguishing device', err) throw err } try { - await this.connectDevice(device, type) + await this.connectDevice(device, serial) } catch (err) { this.log.error('Error connecting to device', err) throw err @@ -496,23 +508,25 @@ class Devices { c.intval = this.settings.state.camera.intval } + //console.dir(this.arduino.alias); + //console.dir(this.arduino.serial); return this.ready(p, c, l, cs, ps, capper) } /** * **/ - private remember (which : string, device : any, type : string) { + private remember (device: string, serial : string, type : string) { let deviceEntry : any; const match = this.settings.state.devices.filter((dev : any) => { - if (dev[which] && dev[which] === device) { + if (dev[device] && dev[device] === serial) { return dev } }) if (match.length === 0) { deviceEntry = { - type + device, + serial } - deviceEntry[which] = device this.settings.state.devices.push(deviceEntry) this.settings.update('devices', this.settings.state.devices) this.settings.save() diff --git a/src/globals.d.ts b/src/globals.d.ts index 80861f1..243ac35 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -15,20 +15,24 @@ declare module 'winston'; declare module 'frame'; interface Device { - arduino : string; + serial : string; + device : string; } interface Arduino { hasState : any; + alias : any; + serial : any; + stateStr : any; send (id : string, cmd : string) : number; sendString (id : string, str : string) : any; enumerate () : any; - connect (id : string, device : Device, state : boolean) : any; + connect (device : string, serial : string, state : boolean) : any; verify () : any; distinguish () : any; fakeConnect ( id : string) : any; stateAsync (device : string, confirm: boolean) : any; state (serial: string, confirm: boolean) : number; close () : any; - aliasSerial ( id : string, device : Device) : any; + aliasSerial ( device : string, serial : string) : any; } diff --git a/src/proj/index.ts b/src/proj/index.ts index 641343a..036d868 100644 --- a/src/proj/index.ts +++ b/src/proj/index.ts @@ -64,6 +64,7 @@ class Projector { this.log.error(`Error setting ${this.id} direction`, err) } } + console.dir(ms) return await this.end(cmd, id, ms) } @@ -129,7 +130,7 @@ class Projector { * **/ async end (cmd : string, id : string, ms : number) { - let message : string = ''; + let message : string = '' if (cmd === this.cfg.arduino.cmd.projector_forward) { message = 'Projector set to FORWARD' } else if (cmd === this.cfg.arduino.cmd.projector_backward) { @@ -159,7 +160,7 @@ class Projector { } message += ` ${ms}ms` this.log.info(message, 'PROJECTOR') - return await this.ui.send(this.id, {cmd: cmd, id : id, ms: ms}) + return await this.ui.send(this.id, { cmd, id, ms }) } }