Resolve startup order issues and explanation for all the delays that were meager attempts to solve a race condition. By moving more IPC connectionts to handles, which can be awaited, there are no more attempts to send message to light object that fails because it has not yet been instantiated.
This commit is contained in:
parent
6778f871db
commit
63f4278b2b
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -34,23 +34,24 @@ class Devices {
|
||||||
* Listen to the "profile" channel for messages from the UI.
|
* Listen to the "profile" channel for messages from the UI.
|
||||||
**/
|
**/
|
||||||
listen() {
|
listen() {
|
||||||
this.ipc.on('profile', this.listener.bind(this));
|
this.ipc.handle('profile', this.listener.bind(this));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The "profile" channel callback. If a profile is changed, set it in the
|
* The "profile" channel callback. If a profile is changed, set it in the
|
||||||
* local settings object.
|
* local settings object.
|
||||||
**/
|
**/
|
||||||
listener(event, arg) {
|
async listener(event, arg) {
|
||||||
if (typeof arg.profile !== 'undefined') {
|
if (typeof arg.profile !== 'undefined') {
|
||||||
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
||||||
this.settings.update('profile', arg.profile);
|
this.settings.update('profile', arg.profile);
|
||||||
this.settings.save();
|
await this.settings.save();
|
||||||
}
|
}
|
||||||
if (typeof arg.timing !== 'undefined') {
|
if (typeof arg.timing !== 'undefined') {
|
||||||
this.log.info(`Saving timing info`, 'SETTINGS', false, false);
|
this.log.info(`Saving timing info`, 'SETTINGS', false, false);
|
||||||
this.settings.update('timing', arg.timing);
|
this.settings.update('timing', arg.timing);
|
||||||
this.settings.save();
|
await this.settings.save();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -27,7 +27,7 @@ class Light {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
listen() {
|
listen() {
|
||||||
this.ipc.on(this.id, this.listener.bind(this));
|
this.ipc.handle(this.id, this.listener.bind(this));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -47,7 +47,7 @@ class Light {
|
||||||
else if (typeof arg.disable !== 'undefined') {
|
else if (typeof arg.disable !== 'undefined') {
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
}
|
}
|
||||||
event.returnValue = true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,iCAA8B;AAC9B,2BAA4B;AAE5B,MAAM,KAAK;IAYV;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ;QAd5C,UAAK,GAAS,EAAE,KAAK,EAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;QAOlC,YAAO,GAAa,IAAI,CAAC;QAEzB,OAAE,GAAY,OAAO,CAAC;QAM7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,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,CAAC;QAC1C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED;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B;QACjB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI;YACH,8BAA8B;YAC9B,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SACnD;QAAC,OAAO,GAAG,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,GAAG,CAAA;SACT;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ;IAChE,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC,CAAA"}
|
|
@ -16,7 +16,7 @@ class Devices {
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
this.listen();
|
this.listen();
|
||||||
this.profiles();
|
this.layoutProfiles();
|
||||||
gui.overlay(true);
|
gui.overlay(true);
|
||||||
gui.spinner(true, 'Checking for connected devices...');
|
gui.spinner(true, 'Checking for connected devices...');
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class Devices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof arg !== 'undefined' && typeof arg.profile !== 'undefined') {
|
if (typeof arg !== 'undefined' && typeof arg.profile !== 'undefined') {
|
||||||
devices.profile(arg.profile);
|
yield devices.profile(arg.profile);
|
||||||
}
|
}
|
||||||
if (typeof arg !== 'undefined' && typeof arg.timing !== 'undefined') {
|
if (typeof arg !== 'undefined' && typeof arg.timing !== 'undefined') {
|
||||||
timing.restore(arg.timing);
|
timing.restore(arg.timing);
|
||||||
|
@ -86,15 +86,11 @@ class Devices {
|
||||||
//add capper features to grid
|
//add capper features to grid
|
||||||
capper.enable();
|
capper.enable();
|
||||||
}
|
}
|
||||||
log.info("Before stats");
|
|
||||||
seq.set(0, cfg.cmd.camera_forward);
|
seq.set(0, cfg.cmd.camera_forward);
|
||||||
seq.set(1, cfg.cmd.projector_forward);
|
seq.set(1, cfg.cmd.projector_forward);
|
||||||
grid.state(0);
|
grid.state(0);
|
||||||
grid.state(1);
|
grid.state(1);
|
||||||
seq.stats();
|
seq.stats();
|
||||||
log.info('Got past stats');
|
|
||||||
//@ts-ignore
|
|
||||||
yield delay(1000);
|
|
||||||
try {
|
try {
|
||||||
gui.spinner(false);
|
gui.spinner(false);
|
||||||
gui.overlay(false);
|
gui.overlay(false);
|
||||||
|
@ -102,11 +98,30 @@ class Devices {
|
||||||
catch (err) {
|
catch (err) {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
}
|
}
|
||||||
log.info("Got here");
|
|
||||||
return event.returnValue = true;
|
return event.returnValue = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
profiles() {
|
profile(profile) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
log.info(`Changed configuration profile to "${profile}"`, 'DEVICES', true, true);
|
||||||
|
const p = cfg.profiles[profile];
|
||||||
|
const keys = Object.keys(p);
|
||||||
|
for (let key of keys) {
|
||||||
|
cfg[key] = keys[key];
|
||||||
|
}
|
||||||
|
$('#profile').val(profile);
|
||||||
|
timing.reset(p);
|
||||||
|
if (typeof p.light !== 'undefined' && p.light === false) {
|
||||||
|
yield light.disable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield light.enable();
|
||||||
|
}
|
||||||
|
yield ipcRenderer.invoke('profile', { profile });
|
||||||
|
yield timing.store();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
layoutProfiles() {
|
||||||
const keys = Object.keys(cfg.profiles);
|
const keys = Object.keys(cfg.profiles);
|
||||||
const elem = $('#profile');
|
const elem = $('#profile');
|
||||||
let opt;
|
let opt;
|
||||||
|
@ -122,24 +137,6 @@ class Devices {
|
||||||
this.profile(val);
|
this.profile(val);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
profile(profile) {
|
|
||||||
log.info(`Changed configuration profile to "${profile}"`, 'DEVICES', true, true);
|
|
||||||
const p = cfg.profiles[profile];
|
|
||||||
const keys = Object.keys(p);
|
|
||||||
for (let key of keys) {
|
|
||||||
cfg[key] = keys[key];
|
|
||||||
}
|
|
||||||
$('#profile').val(profile);
|
|
||||||
timing.reset(p);
|
|
||||||
if (typeof p.light !== 'undefined' && p.light === false) {
|
|
||||||
light.disable();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
light.enable();
|
|
||||||
}
|
|
||||||
ipcRenderer.send('profile', { profile });
|
|
||||||
timing.store();
|
|
||||||
}
|
|
||||||
intval() {
|
intval() {
|
||||||
const url = $('#intval').val();
|
const url = $('#intval').val();
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
let light;
|
let light;
|
||||||
class Light {
|
class Light {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -91,26 +100,30 @@ class Light {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disable() {
|
disable() {
|
||||||
const obj = {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
disable: true,
|
const obj = {
|
||||||
id: uuid()
|
disable: true,
|
||||||
};
|
id: uuid()
|
||||||
this.disabled = true;
|
};
|
||||||
$('#tb_toolbar_item_light').hide();
|
this.disabled = true;
|
||||||
$('#seq_labels .spacer').eq(1).hide();
|
$('#tb_toolbar_item_light').hide();
|
||||||
$('#light_set').hide();
|
$('#seq_labels .spacer').eq(1).hide();
|
||||||
ipcRenderer.sendSync(this.id, obj);
|
$('#light_set').hide();
|
||||||
|
return ipcRenderer.invoke(this.id, obj);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
enable() {
|
enable() {
|
||||||
const obj = {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
enable: true,
|
const obj = {
|
||||||
id: uuid()
|
enable: true,
|
||||||
};
|
id: uuid()
|
||||||
light.disabled = false;
|
};
|
||||||
$('#tb_toolbar_item_light').show();
|
this.disabled = false;
|
||||||
$('#seq_labels .spacer').eq(1).show();
|
$('#tb_toolbar_item_light').show();
|
||||||
$('#light_set').show();
|
$('#seq_labels .spacer').eq(1).show();
|
||||||
ipcRenderer.sendSync(light.id, obj);
|
$('#light_set').show();
|
||||||
|
return ipcRenderer.invoke(this.id, obj);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
colorPickers() {
|
colorPickers() {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
let timing;
|
let timing;
|
||||||
class Timing {
|
class Timing {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -85,14 +94,15 @@ class Timing {
|
||||||
restore(timing) {
|
restore(timing) {
|
||||||
for (let key in timing) {
|
for (let key in timing) {
|
||||||
this.data[key] = timing[key];
|
this.data[key] = timing[key];
|
||||||
|
//log.info(`Timing [${key}] restored to ${timing[key]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//update with rolling average
|
//update with rolling average
|
||||||
update(c, ms, force = false) {
|
update(c, ms, force = false) {
|
||||||
let cmd = this.fromArduino[c];
|
let cmd = this.fromArduino[c];
|
||||||
let id;
|
let id;
|
||||||
log.info(c);
|
//log.info(c)
|
||||||
log.info(cmd);
|
//log.info(cmd)
|
||||||
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
||||||
if (force) {
|
if (force) {
|
||||||
log.info(`Forcing update of timing, ${ms}`);
|
log.info(`Forcing update of timing, ${ms}`);
|
||||||
|
@ -128,7 +138,14 @@ class Timing {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
store() {
|
store() {
|
||||||
ipcRenderer.send('profile', { timing: this.data });
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
yield ipcRenderer.invoke('profile', { timing: this.data });
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
log.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timing = new Timing();
|
timing = new Timing();
|
||||||
|
|
|
@ -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;IAkCX;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AC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtB;QACD,OAAO,CAAC,CAAC;IACV,CAAC;IAEY,KAAK;;YACjB,IAAI;gBACH,MAAM,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,MAAM,EAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;aAC5D;YAAC,OAAO,GAAG,EAAE;gBACb,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACf;QACF,CAAC;KAAA;CACD;AAED,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAEtB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
|
16
app/main.js
16
app/main.js
|
@ -106,9 +106,12 @@ var init = async function () {
|
||||||
arduino = require('arduino')(cfg, ee, errorState)
|
arduino = require('arduino')(cfg, ee, errorState)
|
||||||
|
|
||||||
dev = require('devices')(arduino, settings, mainWindow)
|
dev = require('devices')(arduino, settings, mainWindow)
|
||||||
|
server = require('server')(mainWindow.webContents)
|
||||||
//why is delay happening still?
|
light = require('light')(arduino, cfg, mainWindow.webContents)
|
||||||
await delay(2000)
|
filmout = require('filmout')(display, server, ffmpeg, ffprobe, mainWindow.webContents, light)
|
||||||
|
cam = require('cam')(arduino, cfg, mainWindow.webContents, filmout)
|
||||||
|
proj = require('proj')(arduino, cfg, mainWindow.webContents, filmout)
|
||||||
|
alert = require('alert')(mainWindow.webContents)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await dev.enumerate()
|
await dev.enumerate()
|
||||||
|
@ -117,13 +120,6 @@ var init = async function () {
|
||||||
log.error('Error enumerating connected devices', err)
|
log.error('Error enumerating connected devices', err)
|
||||||
}
|
}
|
||||||
|
|
||||||
server = require('server')(mainWindow.webContents)
|
|
||||||
light = require('light')(arduino, cfg, mainWindow.webContents)
|
|
||||||
filmout = require('filmout')(display, server, ffmpeg, ffprobe, mainWindow.webContents, light)
|
|
||||||
cam = require('cam')(arduino, cfg, mainWindow.webContents, filmout)
|
|
||||||
proj = require('proj')(arduino, cfg, mainWindow.webContents, filmout)
|
|
||||||
alert = require('alert')(mainWindow.webContents)
|
|
||||||
|
|
||||||
if (dev && dev.connected && dev.connected.camera_second) {
|
if (dev && dev.connected && dev.connected.camera_second) {
|
||||||
cam2 = require('cam')(arduino, cfg, mainWindow.webContents, filmout, true)
|
cam2 = require('cam')(arduino, cfg, mainWindow.webContents, filmout, true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"description": "GUI for the mcopy small gauge film optical printer platform",
|
"description": "GUI for the mcopy small gauge film optical printer platform",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Devices {
|
||||||
}
|
}
|
||||||
init () {
|
init () {
|
||||||
this.listen();
|
this.listen();
|
||||||
this.profiles();
|
this.layoutProfiles();
|
||||||
gui.overlay(true);
|
gui.overlay(true);
|
||||||
gui.spinner(true, 'Checking for connected devices...');
|
gui.spinner(true, 'Checking for connected devices...');
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class Devices {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof arg !== 'undefined' && typeof arg.profile !== 'undefined') {
|
if (typeof arg !== 'undefined' && typeof arg.profile !== 'undefined') {
|
||||||
devices.profile(arg.profile);
|
await devices.profile(arg.profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof arg !== 'undefined' && typeof arg.timing !== 'undefined') {
|
if (typeof arg !== 'undefined' && typeof arg.timing !== 'undefined') {
|
||||||
|
@ -78,23 +78,22 @@ class Devices {
|
||||||
//add second row of projector pads to grid
|
//add second row of projector pads to grid
|
||||||
proj.second.enable();
|
proj.second.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof arg !== 'undefined' && typeof arg.camera_second !== 'undefined') {
|
if (typeof arg !== 'undefined' && typeof arg.camera_second !== 'undefined') {
|
||||||
//add second row of camera pads to grid
|
//add second row of camera pads to grid
|
||||||
cam.second.enable();
|
cam.second.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof arg !== 'undefined' && typeof arg.capper !== 'undefined') {
|
if (typeof arg !== 'undefined' && typeof arg.capper !== 'undefined') {
|
||||||
//add capper features to grid
|
//add capper features to grid
|
||||||
capper.enable();
|
capper.enable();
|
||||||
}
|
}
|
||||||
log.info("Before stats");
|
|
||||||
seq.set(0, cfg.cmd.camera_forward);
|
seq.set(0, cfg.cmd.camera_forward);
|
||||||
seq.set(1, cfg.cmd.projector_forward);
|
seq.set(1, cfg.cmd.projector_forward);
|
||||||
grid.state(0);
|
grid.state(0);
|
||||||
grid.state(1);
|
grid.state(1);
|
||||||
seq.stats();
|
seq.stats();
|
||||||
log.info('Got past stats');
|
|
||||||
//@ts-ignore
|
|
||||||
await delay(1000);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gui.spinner(false);
|
gui.spinner(false);
|
||||||
|
@ -102,11 +101,32 @@ class Devices {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
}
|
}
|
||||||
log.info("Got here");
|
|
||||||
return event.returnValue = true;
|
return event.returnValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
profiles () {
|
async profile (profile : string) {
|
||||||
|
log.info(`Changed configuration profile to "${profile}"`, 'DEVICES', true, true);
|
||||||
|
const p : any = cfg.profiles[profile];
|
||||||
|
const keys : any[] = Object.keys(p);
|
||||||
|
for (let key of keys) {
|
||||||
|
cfg[key] = keys[key];
|
||||||
|
}
|
||||||
|
$('#profile').val(profile);
|
||||||
|
|
||||||
|
timing.reset(p);
|
||||||
|
|
||||||
|
if (typeof p.light !== 'undefined' && p.light === false) {
|
||||||
|
await light.disable();
|
||||||
|
} else {
|
||||||
|
await light.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
await ipcRenderer.invoke('profile', { profile });
|
||||||
|
await timing.store();
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutProfiles () {
|
||||||
const keys : string[] = Object.keys(cfg.profiles);
|
const keys : string[] = Object.keys(cfg.profiles);
|
||||||
const elem : any = $('#profile');
|
const elem : any = $('#profile');
|
||||||
let opt;
|
let opt;
|
||||||
|
@ -123,25 +143,6 @@ class Devices {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
profile (profile : string) {
|
|
||||||
log.info(`Changed configuration profile to "${profile}"`, 'DEVICES', true, true);
|
|
||||||
const p : any = cfg.profiles[profile];
|
|
||||||
const keys : any[] = Object.keys(p);
|
|
||||||
for (let key of keys) {
|
|
||||||
cfg[key] = keys[key];
|
|
||||||
}
|
|
||||||
$('#profile').val(profile);
|
|
||||||
timing.reset(p);
|
|
||||||
if (typeof p.light !== 'undefined' && p.light === false) {
|
|
||||||
light.disable();
|
|
||||||
} else {
|
|
||||||
light.enable();
|
|
||||||
}
|
|
||||||
ipcRenderer.send('profile', { profile });
|
|
||||||
timing.store();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
intval () {
|
intval () {
|
||||||
const url : string = $('#intval').val() as string;
|
const url : string = $('#intval').val() as string;
|
||||||
let proceed : boolean = false;
|
let proceed : boolean = false;
|
||||||
|
|
|
@ -121,7 +121,7 @@ class Light {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public disable () {
|
public async disable () {
|
||||||
const obj : LightEvent = {
|
const obj : LightEvent = {
|
||||||
disable : true,
|
disable : true,
|
||||||
id : uuid()
|
id : uuid()
|
||||||
|
@ -131,20 +131,20 @@ class Light {
|
||||||
$('#seq_labels .spacer').eq(1).hide();
|
$('#seq_labels .spacer').eq(1).hide();
|
||||||
$('#light_set').hide();
|
$('#light_set').hide();
|
||||||
|
|
||||||
ipcRenderer.sendSync(this.id, obj);
|
return ipcRenderer.invoke(this.id, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enable () {
|
public async enable () {
|
||||||
const obj = {
|
const obj = {
|
||||||
enable : true,
|
enable : true,
|
||||||
id : uuid()
|
id : uuid()
|
||||||
};
|
};
|
||||||
light.disabled = false;
|
this.disabled = false;
|
||||||
$('#tb_toolbar_item_light').show();
|
$('#tb_toolbar_item_light').show();
|
||||||
$('#seq_labels .spacer').eq(1).show();
|
$('#seq_labels .spacer').eq(1).show();
|
||||||
$('#light_set').show();
|
$('#light_set').show();
|
||||||
|
|
||||||
ipcRenderer.sendSync(light.id, obj);
|
return ipcRenderer.invoke(this.id, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public colorPickers () {
|
public colorPickers () {
|
||||||
|
|
|
@ -100,6 +100,7 @@ class Timing {
|
||||||
public restore (timing : TimingData) {
|
public restore (timing : TimingData) {
|
||||||
for (let key in timing) {
|
for (let key in timing) {
|
||||||
this.data[key] = timing[key];
|
this.data[key] = timing[key];
|
||||||
|
//log.info(`Timing [${key}] restored to ${timing[key]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +108,8 @@ class Timing {
|
||||||
public update (c : string, ms : number, force : boolean = false) {
|
public update (c : string, ms : number, force : boolean = false) {
|
||||||
let cmd : string = this.fromArduino[c];
|
let cmd : string = this.fromArduino[c];
|
||||||
let id : string;
|
let id : string;
|
||||||
log.info(c)
|
//log.info(c)
|
||||||
log.info(cmd)
|
//log.info(cmd)
|
||||||
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
||||||
if (force) {
|
if (force) {
|
||||||
log.info(`Forcing update of timing, ${ms}`);
|
log.info(`Forcing update of timing, ${ms}`);
|
||||||
|
@ -144,8 +145,12 @@ class Timing {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public store () {
|
public async store () {
|
||||||
ipcRenderer.send('profile', { timing : this.data })
|
try {
|
||||||
|
await ipcRenderer.invoke('profile', { timing : this.data });
|
||||||
|
} catch (err) {
|
||||||
|
log.error(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alert": "file:app/lib/alert",
|
"alert": "file:app/lib/alert",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"description": "Small gauge film optical printer platform",
|
"description": "Small gauge film optical printer platform",
|
||||||
"main": "build.js",
|
"main": "build.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.101",
|
"version": "1.8.102",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -46,23 +46,24 @@ class Devices {
|
||||||
* Listen to the "profile" channel for messages from the UI.
|
* Listen to the "profile" channel for messages from the UI.
|
||||||
**/
|
**/
|
||||||
private listen () {
|
private listen () {
|
||||||
this.ipc.on('profile', this.listener.bind(this));
|
this.ipc.handle('profile', this.listener.bind(this));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The "profile" channel callback. If a profile is changed, set it in the
|
* The "profile" channel callback. If a profile is changed, set it in the
|
||||||
* local settings object.
|
* local settings object.
|
||||||
**/
|
**/
|
||||||
private listener (event : any, arg : any){
|
private async listener (event : any, arg : any){
|
||||||
if (typeof arg.profile !== 'undefined') {
|
if (typeof arg.profile !== 'undefined') {
|
||||||
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
||||||
this.settings.update('profile', arg.profile);
|
this.settings.update('profile', arg.profile);
|
||||||
this.settings.save();
|
await this.settings.save();
|
||||||
}
|
}
|
||||||
if (typeof arg.timing !== 'undefined') {
|
if (typeof arg.timing !== 'undefined') {
|
||||||
this.log.info(`Saving timing info`, 'SETTINGS', false, false);
|
this.log.info(`Saving timing info`, 'SETTINGS', false, false);
|
||||||
this.settings.update('timing', arg.timing);
|
this.settings.update('timing', arg.timing);
|
||||||
this.settings.save();
|
await this.settings.save();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -140,7 +141,7 @@ class Devices {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
this.remember('arduino', device, serial)
|
this.remember(device, serial, 'arduino')
|
||||||
this.log.info(`Determined ${device} to be ${device}`, 'SERIAL', true, true)
|
this.log.info(`Determined ${device} to be ${device}`, 'SERIAL', true, true)
|
||||||
|
|
||||||
|
|
||||||
|
@ -504,7 +505,6 @@ class Devices {
|
||||||
|
|
||||||
if (this.settings.state.camera && this.settings.state.camera.intval) {
|
if (this.settings.state.camera && this.settings.state.camera.intval) {
|
||||||
c.intval = this.settings.state.camera.intval
|
c.intval = this.settings.state.camera.intval
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ready(p, c, l, cs, ps, capper)
|
return this.ready(p, c, l, cs, ps, capper)
|
||||||
|
@ -515,13 +515,15 @@ class Devices {
|
||||||
private remember (device: string, serial : string, type : string) {
|
private remember (device: string, serial : string, type : string) {
|
||||||
let deviceEntry : any;
|
let deviceEntry : any;
|
||||||
const match = this.settings.state.devices.filter((dev : any) => {
|
const match = this.settings.state.devices.filter((dev : any) => {
|
||||||
if (dev[device] && dev[device] === serial) {
|
if (typeof dev.device !== 'undefined' && dev.device === device &&
|
||||||
|
typeof dev.serial !== 'undefined' && dev.serial === serial) {
|
||||||
return dev
|
return dev
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (match.length === 0) {
|
if (match.length === 0) {
|
||||||
deviceEntry = {
|
deviceEntry = {
|
||||||
device,
|
device,
|
||||||
|
type,
|
||||||
serial
|
serial
|
||||||
}
|
}
|
||||||
this.settings.state.devices.push(deviceEntry)
|
this.settings.state.devices.push(deviceEntry)
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Light {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
private listen () {
|
private listen () {
|
||||||
this.ipc.on(this.id, this.listener.bind(this));
|
this.ipc.handle(this.id, this.listener.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,7 @@ class Light {
|
||||||
} else if (typeof arg.disable !== 'undefined') {
|
} else if (typeof arg.disable !== 'undefined') {
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
}
|
}
|
||||||
event.returnValue = true
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue