Merge in 9 months of work on capper branch #71

Merged
mattmcw merged 95 commits from capper into main 2023-02-19 05:28:46 +00:00
24 changed files with 318 additions and 12 deletions
Showing only changes of commit 70c2c695f0 - Show all commits

View File

@ -183,8 +183,8 @@
"camera_capper_identifier" : "8", "camera_capper_identifier" : "8",
"camera_capper_projector_identifier" : "9", "camera_capper_projector_identifier" : "9",
"camera_capper_projectors_identifier" : "0", "camera_capper_projectors_identifier" : "0",
"cap_on" : "A", "capper_on" : "A",
"cap_off" : "B" "capper_off" : "B"
} }
} }
} }

View File

@ -45,6 +45,8 @@
<div id="camera_second_backward" class="row cam2" y="2"></div> <div id="camera_second_backward" class="row cam2" y="2"></div>
<div id="projector_backward" class="row" y="1"></div> <div id="projector_backward" class="row" y="1"></div>
<div id="projector_second_backward" class="row proj2" y="3"></div> <div id="projector_second_backward" class="row proj2" y="3"></div>
<div id="capper" class="row capper" y="4"></div>
<div id="light_set" class="row spacer"></div> <div id="light_set" class="row spacer"></div>
<div id="numbers" class="row"></div> <div id="numbers" class="row"></div>
@ -60,6 +62,8 @@
<div><span>PROJ </span><i class="fa fa-minus"></i></div> <div><span>PROJ </span><i class="fa fa-minus"></i></div>
<div class="proj2"><span>PROJ2 </span><i class="fa fa-minus"></i></div> <div class="proj2"><span>PROJ2 </span><i class="fa fa-minus"></i></div>
<div class="capper"><span>BLANK </span><i class="fa fa-times"></i></div>
<div class="spacer"><span>LIGHT</span></div> <div class="spacer"><span>LIGHT</span></div>
</div> </div>
</div> </div>

View File

@ -2496,6 +2496,7 @@ const cmd = require('./lib/ui/cmd.js');
const devices = require('./lib/ui/devices.js'); const devices = require('./lib/ui/devices.js');
const filmout = require('./lib/ui/filmout.js'); const filmout = require('./lib/ui/filmout.js');
const mse = require('./lib/ui/mscript.js'); const mse = require('./lib/ui/mscript.js');
const capper = require('./lib/ui/capper.js');
const Mscript = require('./lib/mscript'); const Mscript = require('./lib/mscript');
const { delay } = require('./lib/delay'); const { delay } = require('./lib/delay');
@ -2525,4 +2526,5 @@ async function init () {
proj.init(); proj.init();
cam.init(); cam.init();
seq.init(); seq.init();
capper.init();
}; };

View File

@ -360,7 +360,9 @@ class Arduino {
write: async function (cmd, cb) { write: async function (cmd, cb) {
const t = { const t = {
c: cfg.arduino.cam.time + cfg.arduino.cam.delay, c: cfg.arduino.cam.time + cfg.arduino.cam.delay,
p: cfg.arduino.proj.time + cfg.arduino.proj.delay p: cfg.arduino.proj.time + cfg.arduino.proj.delay,
A: 180,
B: 180
}; };
let timeout = t[cmd]; let timeout = t[cmd];
if (typeof timeout === 'undefined') if (typeof timeout === 'undefined')

File diff suppressed because one or more lines are too long

89
app/lib/capper/index.js Normal file
View File

@ -0,0 +1,89 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
/** class representing capper functions **/
class Capper {
/**
*
**/
constructor(arduino, cfg, ui, filmout) {
this.state = {
capper: false
};
this.arduino = null;
this.id = 'capper';
this.arduino = arduino;
this.cfg = cfg;
this.ui = ui;
this.filmout = filmout;
this.init();
}
/**
*
**/
async init() {
const Log = require('log');
this.log = await Log({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
*
**/
listen() {
this.ipc.on(this.id, this.listener.bind(this));
}
/**
*
**/
async capper(state, id) {
let cmd;
let ms;
if (state) {
cmd = this.cfg.arduino.cmd[`${this.id}_on`];
}
else {
cmd = this.cfg.arduino.cmd[`${this.id}_off`];
}
this.state.capper = state;
try {
ms = await this.arduino.send(this.id, cmd);
}
catch (err) {
this.log.error(err);
}
return await this.end(cmd, id, ms);
}
/**
*
**/
async listener(event, arg) {
if (typeof arg.capper !== 'undefined') {
try {
await this.capper(arg.capper, arg.id);
}
catch (err) {
this.log.error(err);
}
}
event.returnValue = true;
}
/**
*
**/
async end(cmd, id, ms) {
let message = '';
if (cmd === this.cfg.arduino.cmd.capper_on) {
message = 'Capper set to ON';
}
else if (cmd === this.cfg.arduino.cmd.capper_off) {
message = 'Capper set to OFF';
}
message += ` ${ms}ms`;
this.log.info(message);
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
}
}
module.exports = function (arduino, cfg, ui, filmout) {
return new Capper(arduino, cfg, ui, filmout);
};
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capper/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAMb,2CAA2C;AAE3C,MAAM,MAAM;IAWX;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAa;QAb1D,UAAK,GAAS;YACrB,MAAM,EAAG,KAAK;SACd,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAMzB,OAAE,GAAY,QAAQ,CAAC;QAK9B,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,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3B,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;;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;IACI,KAAK,CAAC,MAAM,CAAE,KAAe,EAAE,EAAW;QACjD,IAAI,GAAY,CAAC;QACjB,IAAI,EAAW,CAA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,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;YACnD,OAAO,GAAG,mBAAmB,CAAC;SAC9B;QAED,OAAO,IAAI,IAAI,EAAE,IAAI,CAAA;QAErB,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;IACpD,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAY;IAC9E,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC,CAAA"}

View File

@ -170,6 +170,22 @@ class Devices {
this.log.info('Connected to fake LIGHT device', 'SERIAL', true, true); this.log.info('Connected to fake LIGHT device', 'SERIAL', true, true);
return true; return true;
} }
/**
*
**/
async fakeCapper() {
this.connected.capper = '/dev/fake';
try {
await this.arduino.fakeConnect('capper');
}
catch (err) {
console.error(err);
this.log.error(`Error connecting to fake CAPPER device`, 'SERIAL', true, true);
return false;
}
this.log.info('Connected to fake CAPPER device', 'SERIAL', true, true);
return true;
}
/** /**
* *
**/ **/
@ -449,6 +465,9 @@ class Devices {
if (this.connected.capper) { if (this.connected.capper) {
capper = { arduino: this.connected.capper }; capper = { arduino: this.connected.capper };
} }
else {
await this.fakeCapper();
}
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;
} }
@ -484,7 +503,6 @@ class Devices {
light, light,
profile: this.settings.state.profile profile: this.settings.state.profile
}; };
console.log("CHECK " + camera);
if (projector_second && projector_second.arduino) { if (projector_second && projector_second.arduino) {
args.projector_second = projector_second; args.projector_second = projector_second;
this.settings.update('projector_second', projector_second); this.settings.update('projector_second', projector_second);

File diff suppressed because one or more lines are too long

57
app/lib/ui/capper.js Normal file
View File

@ -0,0 +1,57 @@
'use strict';
let capper;
class Capper {
constructor() {
this.queue = {};
this.lock = false;
this.id = 'capper';
this.state = true;
}
init() {
this.listen();
}
enable() {
$('.capper').addClass('on');
}
set(state, callback) {
let obj;
if (this.lock) {
return false;
}
obj = {
state,
id: uuid()
};
ipcRenderer.sendSync(this.id, obj);
if (typeof callback !== 'undefined') {
obj.callback = callback;
}
this.queue[obj.id] = obj;
this.lock = true;
}
end(c, id, ms) {
if (c === cfg.arduino.cmd.capper_on) {
this.state = true;
}
else if (c === cfg.arduino.cmd.capper_off) {
this.state = false;
}
if (typeof this.queue[id] !== 'undefined') {
if (typeof this.queue[id].callback !== 'undefined') {
this.queue[id].callback(ms);
}
delete this.queue[id];
this.lock = false;
}
}
listen() {
ipcRenderer.on(this.id, function (event, arg) {
capper.end(arg.cmd, arg.id, arg.ms);
return event.returnValue = true;
});
}
;
}
capper = new Capper();
module.exports = capper;
//# sourceMappingURL=capper.js.map

1
app/lib/ui/capper.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"capper.js","sourceRoot":"","sources":["../../src/lib/ui/capper.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAQb,IAAI,MAAe,CAAC;AAQpB,MAAM,MAAM;IAMX;QALA,UAAK,GAAS,EAAE,CAAC;QACjB,SAAI,GAAa,KAAK,CAAC;QACvB,OAAE,GAAY,QAAQ,CAAC;QACvB,UAAK,GAAa,IAAI,CAAC;IAIvB,CAAC;IAED,IAAI;QACH,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAEM,MAAM;QACZ,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAE,KAAe,EAAE,QAAmB;QA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G,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;YACpC,OAAO,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QACjC,CAAC,CAAC,CAAC;IACJ,CAAC;IAAA,CAAC;CAEF;AAED,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AACtB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}

View File

@ -98,6 +98,9 @@ class Devices {
//add second row of camera pads to grid //add second row of camera pads to grid
cam.second.enable(); cam.second.enable();
} }
if (arg.capper) {
capper.enable();
}
return event.returnValue = true; return event.returnValue = true;
}); });
} }

File diff suppressed because one or more lines are too long

View File

@ -37,6 +37,7 @@ let filmout;
let dev; let dev;
let cmd; let cmd;
let seq; let seq;
let capper;
const cfg = require('./data/cfg.json') const cfg = require('./data/cfg.json')
@ -127,6 +128,10 @@ var init = async function () {
proj2 = require('proj')(arduino, cfg, mainWindow.webContents, filmout, true) proj2 = require('proj')(arduino, cfg, mainWindow.webContents, filmout, true)
} }
if (dev && dev.connected && dev.connected.capper) {
capper = require('capper')(arduino, cfg, mainWindow.webContents, filmout, true)
}
cmd = require('cmd')(cfg, proj, cam, light, cam2, proj2) cmd = require('cmd')(cfg, proj, cam, light, cam2, proj2)
seq = require('sequencer')(cfg, cmd, mainWindow.webContents) seq = require('sequencer')(cfg, cmd, mainWindow.webContents)
} }

9
app/package-lock.json generated
View File

@ -14,6 +14,7 @@
"animated-gif-detector": "^1.2.0", "animated-gif-detector": "^1.2.0",
"arduino": "file:lib/arduino", "arduino": "file:lib/arduino",
"cam": "file:lib/cam", "cam": "file:lib/cam",
"capper": "file:lib/capper",
"capture": "file:lib/capture", "capture": "file:lib/capture",
"cmd": "file:lib/cmd", "cmd": "file:lib/cmd",
"delay": "file:lib/delay", "delay": "file:lib/delay",
@ -75,6 +76,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC" "license": "ISC"
}, },
"lib/capper": {},
"lib/capture": { "lib/capture": {
"version": "1.0.0", "version": "1.0.0",
"license": "ISC" "license": "ISC"
@ -2070,6 +2072,10 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/capper": {
"resolved": "lib/capper",
"link": true
},
"node_modules/capture": { "node_modules/capture": {
"resolved": "lib/capture", "resolved": "lib/capture",
"link": true "link": true
@ -12940,6 +12946,9 @@
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"optional": true "optional": true
}, },
"capper": {
"version": "file:lib/capper"
},
"capture": { "capture": {
"version": "file:lib/capture" "version": "file:lib/capture"
}, },

View File

@ -54,6 +54,7 @@
"animated-gif-detector": "^1.2.0", "animated-gif-detector": "^1.2.0",
"arduino": "file:lib/arduino", "arduino": "file:lib/arduino",
"cam": "file:lib/cam", "cam": "file:lib/cam",
"capper" : "file:lib/capper",
"capture": "file:lib/capture", "capture": "file:lib/capture",
"cmd": "file:lib/cmd", "cmd": "file:lib/cmd",
"delay": "file:lib/delay", "delay": "file:lib/delay",

View File

@ -22,6 +22,7 @@ const cmd = require('./lib/ui/cmd.js');
const devices = require('./lib/ui/devices.js'); const devices = require('./lib/ui/devices.js');
const filmout = require('./lib/ui/filmout.js'); const filmout = require('./lib/ui/filmout.js');
const mse = require('./lib/ui/mscript.js'); const mse = require('./lib/ui/mscript.js');
const capper = require('./lib/ui/capper.js');
const Mscript = require('./lib/mscript'); const Mscript = require('./lib/mscript');
const { delay } = require('./lib/delay'); const { delay } = require('./lib/delay');
@ -51,4 +52,5 @@ async function init () {
proj.init(); proj.init();
cam.init(); cam.init();
seq.init(); seq.init();
capper.init();
}; };

83
app/src/lib/ui/capper.ts Normal file
View File

@ -0,0 +1,83 @@
'use strict';
/// <reference path ="jquery.d.ts"/>
declare var uuid : any;
declare var ipcRenderer : any;
declare var w2ui : any;
let capper : Capper;
interface CapperEvent {
id : string;
state : boolean;
callback? : Function;
}
class Capper {
public enabled = false;
queue : any = {};
lock : boolean = false;
id : string = 'capper';
state : boolean = true;
constructor () {
}
init () {
this.listen();
}
public enable () {
$('.capper').addClass('on');
enabled = true
}
public set (state : boolean, callback : Function) {
let obj : CapperEvent;
if (this.lock) {
return false;
}
obj = {
state,
id : uuid()
};
ipcRenderer.sendSync(this.id, obj);
if (typeof callback !== 'undefined') {
obj.callback = callback;
}
this.queue[obj.id] = obj;
this.lock = true;
}
public end (c : string, id : string, ms : number) {
if (c === cfg.arduino.cmd.capper_on) {
this.state = true;
} else if (c === cfg.arduino.cmd.capper_off) {
this.state = false;
}
if (typeof this.queue[id] !== 'undefined') {
if (typeof this.queue[id].callback !== 'undefined') {
this.queue[id].callback(ms);
}
delete this.queue[id];
this.lock = false;
}
}
private listen () {
ipcRenderer.on(this.id, function (event : Event, arg : any) {
capper.end(arg.cmd, arg.id, arg.ms);
return event.returnValue = true;
});
};
}
capper = new Capper();
module.exports = capper;

View File

@ -96,6 +96,9 @@ class Devices {
//add second row of camera pads to grid //add second row of camera pads to grid
cam.second.enable(); cam.second.enable();
} }
if (arg.capper) {
capper.enable();
}
return event.returnValue = true; return event.returnValue = true;
} }

View File

@ -122,7 +122,8 @@ class Grid {
'camera_backward', 'camera_backward',
'camera_second_backward', 'camera_second_backward',
'projector_backward', 'projector_backward',
'projector_second_backward', 'projector_second_backward',
'black',
'light_set', 'light_set',
'numbers' 'numbers'
]; ];

View File

@ -183,8 +183,8 @@
"camera_capper_identifier" : "8", "camera_capper_identifier" : "8",
"camera_capper_projector_identifier" : "9", "camera_capper_projector_identifier" : "9",
"camera_capper_projectors_identifier" : "0", "camera_capper_projectors_identifier" : "0",
"cap_on" : "A", "capper_on" : "A",
"cap_off" : "B" "capper_off" : "B"
} }
} }
} }

View File

@ -219,6 +219,10 @@ module Debug () {
//translate([1.5, -38 + 2 -10, -11.8 + 11 + 2 +.75]) rotate([90, 0, 0])OptoEndstop(); //translate([1.5, -38 + 2 -10, -11.8 + 11 + 2 +.75]) rotate([90, 0, 0])OptoEndstop();
} }
module Base () {
}
Render="Cap"; Render="Cap";
if (Render=="Debug") { if (Render=="Debug") {
@ -234,4 +238,6 @@ if (Render=="Debug") {
} else if (Render=="OptoEndstopMount") { } else if (Render=="OptoEndstopMount") {
echo("Deprecated"); echo("Deprecated");
//rotate([-90,0,0]) OptoEndstopMount(); //rotate([-90,0,0]) OptoEndstopMount();
} else if (Render=="Base") {
} }

View File

@ -360,7 +360,9 @@ class Arduino {
write : async function (cmd : string, cb : any) { write : async function (cmd : string, cb : any) {
const t : any = { const t : any = {
c : cfg.arduino.cam.time + cfg.arduino.cam.delay, c : cfg.arduino.cam.time + cfg.arduino.cam.delay,
p : cfg.arduino.proj.time + cfg.arduino.proj.delay p : cfg.arduino.proj.time + cfg.arduino.proj.delay,
A : 180,
B : 180
} }
let timeout : number = t[cmd] let timeout : number = t[cmd]
if (typeof timeout === 'undefined') timeout = 10 if (typeof timeout === 'undefined') timeout = 10

View File

@ -182,6 +182,22 @@ class Devices {
this.log.info('Connected to fake LIGHT device', 'SERIAL', true, true) this.log.info('Connected to fake LIGHT device', 'SERIAL', true, true)
return true return true
} }
/**
*
**/
private async fakeCapper () {
this.connected.capper = '/dev/fake'
try {
await this.arduino.fakeConnect('capper')
} catch (err) {
console.error(err)
this.log.error(`Error connecting to fake CAPPER device`, 'SERIAL', true, true)
return false
}
this.log.info('Connected to fake CAPPER device', 'SERIAL', true, true)
return true
}
/** /**
* *
**/ **/
@ -441,6 +457,8 @@ class Devices {
if (this.connected.capper) { if (this.connected.capper) {
capper = { arduino : this.connected.capper } capper = { arduino : this.connected.capper }
} else {
await this.fakeCapper()
} }
if (this.settings.state.camera && this.settings.state.camera.intval) { if (this.settings.state.camera && this.settings.state.camera.intval) {
@ -480,7 +498,6 @@ class Devices {
profile: this.settings.state.profile profile: this.settings.state.profile
} }
console.log("CHECK " + camera)
if (projector_second && projector_second.arduino) { if (projector_second && projector_second.arduino) {
args.projector_second = projector_second args.projector_second = projector_second
this.settings.update('projector_second', projector_second) this.settings.update('projector_second', projector_second)