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
32 changed files with 443 additions and 116 deletions
Showing only changes of commit 9d0545aa4f - Show all commits

View File

@ -484,6 +484,9 @@ button:focus {
#sequence #projector_second_backward > div { #sequence #projector_second_backward > div {
color: #bf2e39; color: #bf2e39;
} }
#sequence #black input[type=checkbox]:checked {
background: white;
}
#sequence input[type=checkbox] { #sequence input[type=checkbox] {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
@ -500,6 +503,10 @@ button:focus {
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
} }
#sequence input[type=checkbox].disabled {
cursor: not-allowed;
border-color: #646464;
}
#sequence .L { #sequence .L {
display: inline-block; display: inline-block;
width: 35px; width: 35px;
@ -627,6 +634,11 @@ button:focus {
background: #AB1A25; background: #AB1A25;
border-color: #AB1A25; border-color: #AB1A25;
} }
.cmd:active.capper,
.cmd.active.capper {
background: white;
color: #272b30;
}
.cmd:active i, .cmd:active i,
.cmd.active i { .cmd.active i {
color: #272b30; color: #272b30;
@ -1140,19 +1152,23 @@ button:focus {
float: right; float: right;
} }
.cam2, .cam2,
.proj2 { .proj2,
.black {
display: none; display: none;
} }
.cam2 > *, .cam2 > *,
.proj2 > * { .proj2 > *,
.black > * {
visibility: hidden; visibility: hidden;
} }
.cam2.on, .cam2.on,
.proj2.on { .proj2.on,
.black.on {
display: block; display: block;
} }
.cam2.on > *, .cam2.on > *,
.proj2.on > * { .proj2.on > *,
.black.on > * {
visibility: visible; visibility: visible;
} }
#overlay { #overlay {

View File

@ -15,8 +15,8 @@
"momentary": 0 "momentary": 0
}, },
"black": { "black": {
"before": 0, "before": 100,
"after": 0 "after": 100
}, },
"light": false "light": false
}, },

View File

@ -46,7 +46,7 @@
<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="black" class="row black"></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>
@ -62,7 +62,7 @@
<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="black"><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>
@ -162,6 +162,20 @@
<i class="fa fa-step-backward"></i> <i class="fa fa-step-backward"></i>
</button> </button>
</div> </div>
<div class="hide">
<button id="cmd_capper_on" onclick="cmd.capper_on();" class="cmd capper">
<i class="fa fa-times-circle"></i>
CAPPER ON
<i class="fa fa-eye"></i>
</button>
</div>
<div class="hide">
<button id="cmd_capper_off" onclick="cmd.capper_off();" class="cmd capper active">
<i class="fa fa-eye"></i>
CAPPER OFF
<i class="fa fa-eye"></i>
</button>
</div>
</div> </div>
<div> <div>
<div> <div>

View File

@ -175,7 +175,8 @@
} }
.cam2, .cam2,
.proj2{ .proj2,
.black{
display : none; display : none;
> * { > * {
visibility: hidden; visibility: hidden;

View File

@ -42,6 +42,10 @@
background: @BACKWARD; background: @BACKWARD;
border-color: @BACKWARD; border-color: @BACKWARD;
} }
&.capper{
background: white;
color: @BG;
}
i{ i{
color: @BG; color: @BG;
} }

View File

@ -126,6 +126,13 @@
color: @BACKWARD + @SECOND; color: @BACKWARD + @SECOND;
} }
} }
#black{
input[type=checkbox]{
&:checked{
background: white;
}
}
}
input[type=checkbox]{ input[type=checkbox]{
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
@ -141,6 +148,10 @@
display: inline-block; display: inline-block;
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
&.disabled{
cursor: not-allowed;
border-color: rgb(100, 100, 100);
}
} }
.L{ .L{
display: inline-block; display: inline-block;

View File

@ -57,9 +57,9 @@ class Capper {
* *
**/ **/
async listener(event, arg) { async listener(event, arg) {
if (typeof arg.capper !== 'undefined') { if (typeof arg.state !== 'undefined') {
try { try {
await this.capper(arg.capper, arg.id); await this.capper(arg.state, arg.id);
} }
catch (err) { catch (err) {
this.log.error(err); this.log.error(err);

View File

@ -1 +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,CA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 class Commands {
* @param {object} cam2 (optional) Camera 2 * @param {object} cam2 (optional) Camera 2
* @param {object} proj2 {optional} Projector 2 * @param {object} proj2 {optional} Projector 2
**/ **/
constructor(cfg, proj, cam, light, cam2 = null, proj2 = null) { constructor(cfg, proj, cam, light, cam2 = null, proj2 = null, capper = null) {
this.cfg = cfg; this.cfg = cfg;
this.proj = proj; this.proj = proj;
this.cam = cam; this.cam = cam;
this.light = light; this.light = light;
if (cam2) if (cam2 !== null)
this.cam2 = cam2; this.cam2 = cam2;
if (proj2) if (proj2 !== null)
this.proj2 = proj2; this.proj2 = proj2;
if (capper !== null)
this.capper = capper;
this.ipc = require('electron').ipcMain; this.ipc = require('electron').ipcMain;
} }
/** /**
@ -101,18 +103,25 @@ class Commands {
async black_forward() { async black_forward() {
const id = uuid_1.v4(); const id = uuid_1.v4();
const off = [0, 0, 0]; const off = [0, 0, 0];
let ms; let ms = 0;
try { try {
if (!this.cam.state.dir) { if (!this.cam.state.dir) {
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
await this.cam.set(true); await this.cam.set(true);
} }
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
if (this.capper) {
ms += await this.capper.capper(true, id);
}
await delay_1.delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off await this.light.set(off, id); //make sure set to off
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
ms = await this.cam.move(); ms += await this.cam.move();
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); await this.light.set(off, id);
if (this.capper) {
ms += await this.capper.capper(false, id);
}
} }
catch (err) { catch (err) {
throw err; throw err;
@ -155,18 +164,24 @@ class Commands {
async black_backward() { async black_backward() {
const id = uuid_1.v4(); const id = uuid_1.v4();
const off = [0, 0, 0]; const off = [0, 0, 0];
let ms; let ms = 0;
try { try {
if (this.cam.state.dir) { if (this.cam.state.dir) {
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
await this.cam.set(false); await this.cam.set(false);
} }
if (this.capper) {
ms += await this.capper.capper(true, id);
}
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off await this.light.set(off, id); //make sure set to off
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
ms = await this.cam.move(); ms += await this.cam.move();
await delay_1.delay(this.cfg.arduino.serialDelay); await delay_1.delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); await this.light.set(off, id);
if (this.capper) {
ms += await this.capper.capper(false, id);
}
} }
catch (err) { catch (err) {
throw err; throw err;
@ -571,7 +586,7 @@ class Commands {
return ms; return ms;
} }
} }
module.exports = function (cfg, proj, cam, light, cam2, proj2) { module.exports = function (cfg, proj, cam, light, cam2, proj2, capper) {
return new Commands(cfg, proj, cam, light, cam2, proj2); return new Commands(cfg, proj, cam, light, cam2, proj2, capper);
}; };
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -418,7 +418,7 @@ class Devices {
let d; let d;
let cs = {}; let cs = {};
let ps = {}; let ps = {};
let capper; let capper = {};
let checklist = []; let checklist = [];
this.connected = { this.connected = {
projector: false, projector: false,
@ -457,16 +457,13 @@ class Devices {
} }
l.arduino = this.connected.light; l.arduino = this.connected.light;
if (this.connected.camera_second) { if (this.connected.camera_second) {
cs = { arduino: this.connected.camera_second }; cs.arduino = this.connected.camera_second;
} }
if (this.connected.projector_second) { if (this.connected.projector_second) {
ps = { arduino: this.connected.projector_second }; ps.arduino = this.connected.projector_second;
} }
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;
@ -518,7 +515,7 @@ class Devices {
this.mainWindow.setSize(800, 800); this.mainWindow.setSize(800, 800);
} }
} }
if (capper) { if (capper && capper.arduino) {
args.capper = capper; args.capper = capper;
this.mainWindow.setSize(800, 800); this.mainWindow.setSize(800, 800);
this.settings.update('capper', capper); this.settings.update('capper', capper);

File diff suppressed because one or more lines are too long

View File

@ -2,18 +2,24 @@
let capper; let capper;
class Capper { class Capper {
constructor() { constructor() {
this.enabled = false;
this.queue = {}; this.queue = {};
this.lock = false; this.lock = false;
this.id = 'capper'; this.id = 'capper';
this.state = true; this.state = false;
} }
init() { init() {
this.listen(); this.listen();
} }
enable() { enable() {
$('.capper').addClass('on'); $('.black').addClass('on');
$('#cmd_black_forward').parent().removeClass('hide');
$('#cmd_black_backward').parent().removeClass('hide');
$('#cmd_capper_on').parent().removeClass('hide');
$('#cmd_capper_off').parent().removeClass('hide');
this.enabled = true;
} }
set(state, callback) { capper(state, callback) {
let obj; let obj;
if (this.lock) { if (this.lock) {
return false; return false;
@ -28,6 +34,15 @@ class Capper {
} }
this.queue[obj.id] = obj; this.queue[obj.id] = obj;
this.lock = true; this.lock = true;
this.state = state;
if (state) {
$('#cmd_capper_on').addClass('active');
$('#cmd_capper_off').removeClass('active');
}
else {
$('#cmd_capper_off').addClass('active');
$('#cmd_capper_on').removeClass('active');
}
} }
end(c, id, ms) { end(c, id, ms) {
if (c === cfg.arduino.cmd.capper_on) { if (c === cfg.arduino.cmd.capper_on) {

View File

@ -1 +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,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AAI,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,WAAW,EAAE;YAC1C,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,QAAQ,KAAK,WAAW,EAAE;gBACnD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;aAC5B;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACtB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;SAClB;IACF,CAAC;IACO,MAAM;QACb,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,KAAa,EAAE,GAAS;YACzD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,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

@ -155,24 +155,63 @@ cmd.black_forward = function (callback) {
if (callback) { callback(ms); } if (callback) { callback(ms); }
}; };
$('#cmd_black_forward').addClass('active'); $('#cmd_black_forward').addClass('active');
if (!cam.dir) { if (!cam.dir) {
cam.set(true, function () { if (capper.enabled) {
setTimeout( function () { cam.set(true, function () {
light.display(off); setTimeout( function () {
light.set(off, function () { capper.capper(true, function () {
setTimeout( function () { setTimeout( function () {
cam.move(res); light.display(off);
}, cfg.arduino.serialDelay); light.set(off, function () {
}); setTimeout( function () {
}, cfg.arduino.serialDelay); cam.move(function () {
}); setTimeout(function () {
capper.capper(false, res);
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay)
})
}, cfg.arduino.serialDelay);
});
} else {
cam.set(true, function () {
setTimeout( function () {
light.display(off);
light.set(off, function () {
setTimeout( function () {
cam.move(res);
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
}
} else { } else {
light.display(off); if (capper.enabled) {
light.set(off, function () { capper.capper(true, function () {
setTimeout(function () { setTimeout( function () {
cam.move(res); light.display(off);
}, cfg.arduino.serialDelay); light.set(off, function () {
}); setTimeout( function () {
cam.move(function () {
setTimeout(function () {
capper.capper(false, res);
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
} else {
light.display(off);
light.set(off, function () {
setTimeout(function () {
cam.move(res);
}, cfg.arduino.serialDelay);
});
}
} }
}; };
/** /**
@ -226,21 +265,57 @@ cmd.black_backward = function (callback) {
}; };
$('#cmd_black_backward').addClass('active'); $('#cmd_black_backward').addClass('active');
if (cam.dir) { if (cam.dir) {
cam.set(false, function () { if (capper.enabled) {
cam.set(false, function () {
setTimeout( function () {
capper.capper(true, function () {
setTimeout(function () {
light.display(off);
light.set(off, function () {
cam.move(function () {
setTimeout(function () {
capper.capper(false, res);
}, cfg.arduino.serialDelay);
});
});
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
} else {
cam.set(false, function () {
setTimeout(function () {
light.display(off);
light.set(off, function () {
cam.move(res);
});
}, cfg.arduino.serialDelay);
});
}
} else {
if (capper.enabled) {
capper.capper(true, function () {
setTimeout( function () {
light.display(off);
light.set(off, function () {
setTimeout( function () {
cam.move(function () {
setTimeout(function () {
capper.capper(false, res);
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
} else {
setTimeout(function () { setTimeout(function () {
light.display(off); light.display(off);
light.set(off, function () { light.set(off, function () {
cam.move(res); cam.move(res);
}); });
}, cfg.arduino.serialDelay); }, cfg.arduino.serialDelay);
}); }
} else {
setTimeout(function () {
light.display(off);
light.set(off, function () {
cam.move(res);
});
}, cfg.arduino.serialDelay);
} }
}; };
@ -534,4 +609,32 @@ cmd.projector_second_to = function (t) {
} }
} }
/**
* Turn the capper on (block the camera)
*
* @param {function} callback Function to call after capper is on
**/
cmd.capper_on = function (callback) {
'use strict';
var res = function (ms) {
gui.updateState();
if (callback) { callback(ms); }
};
capper.capper(true, res);
};
/**
* Turn the capper off (not blocking the camera)
*
* @param {function} callback Function to call after capper is off
**/
cmd.capper_off = function (callback) {
'use strict';
var res = function (ms) {
gui.updateState();
if (callback) { callback(ms); }
};
capper.capper(false, res);
};
module.exports = cmd; module.exports = cmd;

View File

@ -85,11 +85,6 @@ class Devices {
} }
//devices.profile(arg.profile) //devices.profile(arg.profile)
} }
seq.set(0, cfg.cmd.camera_forward);
seq.set(1, cfg.cmd.projector_forward);
grid.state(0);
grid.state(1);
seq.stats();
if (arg.projector_second) { if (arg.projector_second) {
//add second row of projector pads to grid //add second row of projector pads to grid
proj.second.enable(); proj.second.enable();
@ -99,8 +94,14 @@ class Devices {
cam.second.enable(); cam.second.enable();
} }
if (arg.capper) { if (arg.capper) {
//add capper features to grid
capper.enable(); capper.enable();
} }
seq.set(0, cfg.cmd.camera_forward);
seq.set(1, cfg.cmd.projector_forward);
grid.state(0);
grid.state(1);
seq.stats();
return event.returnValue = true; return event.returnValue = true;
}); });
} }

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,9 @@ let grid;
class Grid { class Grid {
constructor() { constructor() {
this.swatchesElem = {}; this.swatchesElem = {};
this.projector_cmds = [
'PF', 'PB', 'P2F', 'P2B', 'PPF', 'PPB'
];
} }
init() { init() {
this.refresh(); this.refresh();
@ -24,8 +27,8 @@ class Grid {
const step = seq.grid[x]; const step = seq.grid[x];
let className; let className;
let className2; let className2;
elem.prop('checked', false);
if (typeof step !== 'undefined') { if (typeof step !== 'undefined') {
elem.prop('checked', false);
if (step.cmd === cfg.cmd.cameras_forward) { if (step.cmd === cfg.cmd.cameras_forward) {
className = cfg.cmd.camera_forward; className = cfg.cmd.camera_forward;
className2 = cfg.cmd.camera_second_forward; className2 = cfg.cmd.camera_second_forward;
@ -58,6 +61,14 @@ class Grid {
className = cfg.cmd.projector_backward; className = cfg.cmd.projector_backward;
className2 = cfg.cmd.projector_second_forward; className2 = cfg.cmd.projector_second_forward;
} }
else if (step.cmd === cfg.cmd.black_forward) {
className = cfg.cmd.camera_forward;
className2 = 'black';
}
else if (step.cmd === cfg.cmd.black_backward) {
className = cfg.cmd.camera_backward;
className2 = 'black';
}
else { else {
className = step.cmd; className = step.cmd;
} }
@ -75,6 +86,12 @@ class Grid {
.removeClass('a') .removeClass('a')
.prop('title', ''); .prop('title', '');
} }
if (capper.enabled && this.projector_cmds.indexOf(step.cmd) !== -1) {
$(`.black[x=${x}]`).addClass('disabled');
}
else if (capper.enabled) {
$(`.black[x=${x}]`).removeClass('disabled');
}
} }
else { else {
lightElem.css('background', 'transparent') lightElem.css('background', 'transparent')
@ -113,6 +130,7 @@ class Grid {
'camera_second_backward', 'camera_second_backward',
'projector_backward', 'projector_backward',
'projector_second_backward', 'projector_second_backward',
'black',
'light_set', 'light_set',
'numbers' 'numbers'
]; ];
@ -132,6 +150,10 @@ class Grid {
elem = `<div x="${x}" class="L"></div>`; elem = `<div x="${x}" class="L"></div>`;
$(cmd).append($(elem)); $(cmd).append($(elem));
} }
else if (cmds[i] === 'black') {
elem = `<input type="checkbox" x="${x}" class="black" />`;
$(cmd).append($(elem));
}
else { else {
elem = `<input type="checkbox" x="${x}" />`; elem = `<input type="checkbox" x="${x}" />`;
$(cmd).append($(elem).addClass(cfg.cmd[cmds[i]])); $(cmd).append($(elem).addClass(cfg.cmd[cmds[i]]));
@ -159,7 +181,24 @@ class Grid {
current = seq.grid[x].cmd + ''; // cast to string, bad hack current = seq.grid[x].cmd + ''; // cast to string, bad hack
} }
if (checked) { if (checked) {
if (cam.second.enabled && current.indexOf('C') !== -1) { if (c.indexOf('black') !== -1) {
if (other === '') {
c = cfg.cmd.black_forward;
}
else if (current.indexOf('C') !== -1) {
if (other == cfg.cmd.camera_forward) {
c = cfg.cmd.black_forward;
}
else if (other === cfg.cmd.camera_backward) {
c = cfg.cmd.black_backward;
}
}
else if (current.indexOf('P') !== -1) {
$(elem).prop('checked', false);
return;
}
}
else if (cam.second.enabled && current.indexOf('C') !== -1) {
if (c === cfg.cmd.camera_forward) { if (c === cfg.cmd.camera_forward) {
if (other === cfg.cmd.camera_second_forward) { if (other === cfg.cmd.camera_second_forward) {
c = cfg.cmd.cameras_forward; c = cfg.cmd.cameras_forward;
@ -254,7 +293,27 @@ class Grid {
seq.set(x, c); seq.set(x, c);
} }
else { else {
if (cam.second.enabled && current.indexOf('C') !== -1) { if (c.indexOf('black') !== -1) {
if (current === 'BF' || current === 'BB') {
if (other === cfg.cmd.camera_forward) {
c = cfg.cmd.camera_forward;
}
else if (other === cfg.cmd.camera_backward) {
c = cfg.cmd.camera_backward;
}
}
else if (current.indexOf('P') !== -1) {
$(elem).prop('checked', false);
return;
}
}
else if (other === 'black' && current === cfg.cmd.camera_forward) {
c = '';
}
else if (other === 'black' && current === cfg.cmd.camera_backward) {
c = '';
}
else if (cam.second.enabled && current.indexOf('C') !== -1) {
if (current === cfg.cmd.cameras_forward) { if (current === cfg.cmd.cameras_forward) {
if (other === cfg.cmd.camera_second_forward) { if (other === cfg.cmd.camera_second_forward) {
c = cfg.cmd.camera_second_forward; c = cfg.cmd.camera_second_forward;

File diff suppressed because one or more lines are too long

View File

@ -47,10 +47,19 @@ class Sequence {
log.info('Sequence stopped', 'SERIAL', true); log.info('Sequence stopped', 'SERIAL', true);
timeStr = (arg.ms < 2000) ? `${arg.ms}ms` : humanizeDuration(arg.ms); timeStr = (arg.ms < 2000) ? `${arg.ms}ms` : humanizeDuration(arg.ms);
gui.notify(`SEQUENCE`, `Sequence finished in ${timeStr}`); gui.notify(`SEQUENCE`, `Sequence finished in ${timeStr}`);
if (capper.enabled && this.arr.some(this.hasCapper)) {
$('#cmd_capper_off').addClass('active');
$('#cmd_capper_on').removeClass('active');
}
} }
} }
return event.returnValue = true; return event.returnValue = true;
} }
hasCapper(el) {
if (['BF', 'BB'].indexOf(el.cmd) !== -1) {
return true;
}
}
progress(step, loop) { progress(step, loop) {
const elem = $('.progress-bar'); const elem = $('.progress-bar');
const len = this.arr.length; const len = this.arr.length;

File diff suppressed because one or more lines are too long

View File

@ -127,12 +127,11 @@ var init = async function () {
if (dev && dev.connected && dev.connected.projector_second) { if (dev && dev.connected && dev.connected.projector_second) {
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) { if (dev && dev.connected && dev.connected.capper) {
capper = require('capper')(arduino, cfg, mainWindow.webContents, filmout, true) 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, capper)
seq = require('sequencer')(cfg, cmd, mainWindow.webContents) seq = require('sequencer')(cfg, cmd, mainWindow.webContents)
} }

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -e
# compile main process code # compile main process code
cd .. cd ..
npm run compile npm run compile

View File

@ -19,7 +19,7 @@ class Capper {
queue : any = {}; queue : any = {};
lock : boolean = false; lock : boolean = false;
id : string = 'capper'; id : string = 'capper';
state : boolean = true; state : boolean = false;
constructor () { constructor () {
@ -30,11 +30,15 @@ class Capper {
} }
public enable () { public enable () {
$('.capper').addClass('on'); $('.black').addClass('on');
enabled = true $('#cmd_black_forward').parent().removeClass('hide');
$('#cmd_black_backward').parent().removeClass('hide');
$('#cmd_capper_on').parent().removeClass('hide');
$('#cmd_capper_off').parent().removeClass('hide');
this.enabled = true;
} }
public set (state : boolean, callback : Function) { public capper (state : boolean, callback : Function) {
let obj : CapperEvent; let obj : CapperEvent;
if (this.lock) { if (this.lock) {
@ -54,6 +58,15 @@ class Capper {
this.queue[obj.id] = obj; this.queue[obj.id] = obj;
this.lock = true; this.lock = true;
this.state = state;
if (state) {
$('#cmd_capper_on').addClass('active');
$('#cmd_capper_off').removeClass('active');
} else {
$('#cmd_capper_off').addClass('active');
$('#cmd_capper_on').removeClass('active');
}
} }
public end (c : string, id : string, ms : number) { public end (c : string, id : string, ms : number) {

View File

@ -81,12 +81,6 @@ class Devices {
} }
//devices.profile(arg.profile) //devices.profile(arg.profile)
} }
seq.set(0, cfg.cmd.camera_forward);
seq.set(1, cfg.cmd.projector_forward);
grid.state(0);
grid.state(1);
seq.stats();
if (arg.projector_second) { if (arg.projector_second) {
//add second row of projector pads to grid //add second row of projector pads to grid
@ -97,8 +91,16 @@ class Devices {
cam.second.enable(); cam.second.enable();
} }
if (arg.capper) { if (arg.capper) {
//add capper features to grid
capper.enable(); capper.enable();
} }
seq.set(0, cfg.cmd.camera_forward);
seq.set(1, cfg.cmd.projector_forward);
grid.state(0);
grid.state(1);
seq.stats();
return event.returnValue = true; return event.returnValue = true;
} }

View File

@ -19,6 +19,9 @@ let grid : Grid;
*******/ *******/
class Grid { class Grid {
private swatchesElem : any = {}; private swatchesElem : any = {};
private projector_cmds : string[] = [
'PF', 'PB', 'P2F', 'P2B', 'PPF', 'PPB'
];
constructor () { constructor () {
} }
@ -40,8 +43,9 @@ class Grid {
const step : Step = seq.grid[x]; const step : Step = seq.grid[x];
let className : string; let className : string;
let className2 : string; let className2 : string;
elem.prop('checked', false);
if (typeof step !== 'undefined') { if (typeof step !== 'undefined') {
elem.prop('checked', false);
if (step.cmd === cfg.cmd.cameras_forward) { if (step.cmd === cfg.cmd.cameras_forward) {
className = cfg.cmd.camera_forward; className = cfg.cmd.camera_forward;
className2 = cfg.cmd.camera_second_forward; className2 = cfg.cmd.camera_second_forward;
@ -67,6 +71,12 @@ class Grid {
} else if (step.cmd === cfg.cmd.projector_backward_projector_second_forward) { } else if (step.cmd === cfg.cmd.projector_backward_projector_second_forward) {
className = cfg.cmd.projector_backward; className = cfg.cmd.projector_backward;
className2 = cfg.cmd.projector_second_forward; className2 = cfg.cmd.projector_second_forward;
} else if (step.cmd === cfg.cmd.black_forward) {
className = cfg.cmd.camera_forward;
className2 = 'black';
} else if (step.cmd === cfg.cmd.black_backward) {
className = cfg.cmd.camera_backward;
className2 = 'black';
} else { } else {
className = step.cmd; className = step.cmd;
} }
@ -80,12 +90,17 @@ class Grid {
lightElem.css('background', `rgb(${step.light})`) lightElem.css('background', `rgb(${step.light})`)
.addClass('a') .addClass('a')
.prop('title', `rgb(${seq.light})`); .prop('title', `rgb(${seq.light})`);
} else { } else {
lightElem.css('background', 'transparent') lightElem.css('background', 'transparent')
.removeClass('a') .removeClass('a')
.prop('title', ''); .prop('title', '');
} }
if (capper.enabled && this.projector_cmds.indexOf(step.cmd) !== -1) {
$(`.black[x=${x}]`).addClass('disabled');
} else if (capper.enabled) {
$(`.black[x=${x}]`).removeClass('disabled');
}
} else { } else {
lightElem.css('background', 'transparent') lightElem.css('background', 'transparent')
.removeClass('a') .removeClass('a')
@ -142,6 +157,9 @@ class Grid {
} else if (cmds[i] === 'light_set') { } else if (cmds[i] === 'light_set') {
elem = `<div x="${x}" class="L"></div>` elem = `<div x="${x}" class="L"></div>`
$(cmd).append($(elem)); $(cmd).append($(elem));
} else if (cmds[i] === 'black') {
elem = `<input type="checkbox" x="${x}" class="black" />`;
$(cmd).append($(elem));
} else { } else {
elem = `<input type="checkbox" x="${x}" />`; elem = `<input type="checkbox" x="${x}" />`;
$(cmd).append($(elem).addClass(cfg.cmd[cmds[i]])); $(cmd).append($(elem).addClass(cfg.cmd[cmds[i]]));
@ -170,7 +188,20 @@ class Grid {
current = seq.grid[x].cmd + ''; // cast to string, bad hack current = seq.grid[x].cmd + ''; // cast to string, bad hack
} }
if (checked) { if (checked) {
if (cam.second.enabled && current.indexOf('C') !== -1) { if (c.indexOf('black') !== -1) {
if (other === '') {
c = cfg.cmd.black_forward;
} else if (current.indexOf('C') !== -1) {
if (other == cfg.cmd.camera_forward) {
c = cfg.cmd.black_forward;
} else if (other === cfg.cmd.camera_backward) {
c = cfg.cmd.black_backward;
}
} else if (current.indexOf('P') !== -1) {
$(elem).prop('checked', false);
return;
}
} else if (cam.second.enabled && current.indexOf('C') !== -1) {
if (c === cfg.cmd.camera_forward) { if (c === cfg.cmd.camera_forward) {
if (other === cfg.cmd.camera_second_forward) { if (other === cfg.cmd.camera_second_forward) {
c = cfg.cmd.cameras_forward; c = cfg.cmd.cameras_forward;
@ -198,7 +229,6 @@ class Grid {
} }
} else if (proj.second.enabled && current.indexOf('P') !== -1) { } else if (proj.second.enabled && current.indexOf('P') !== -1) {
if (c === cfg.cmd.projector_forward) { if (c === cfg.cmd.projector_forward) {
if (current === cfg.cmd.projectors_backward) { if (current === cfg.cmd.projectors_backward) {
c = cfg.cmd.projector_forward_projector_second_backward; c = cfg.cmd.projector_forward_projector_second_backward;
} else if (current === cfg.cmd.projector_backward_projector_second_forward) { } else if (current === cfg.cmd.projector_backward_projector_second_forward) {
@ -209,7 +239,6 @@ class Grid {
c = cfg.cmd.projector_forward_projector_second_backward; c = cfg.cmd.projector_forward_projector_second_backward;
} }
} else if (c === cfg.cmd.projector_backward) { } else if (c === cfg.cmd.projector_backward) {
if (current === cfg.cmd.projectors_forward) { if (current === cfg.cmd.projectors_forward) {
c = cfg.cmd.projector_backward_projector_second_forward; c = cfg.cmd.projector_backward_projector_second_forward;
} else if (current === cfg.cmd.projector_forward_projector_second_backward) { } else if (current === cfg.cmd.projector_forward_projector_second_backward) {
@ -220,7 +249,6 @@ class Grid {
c = cfg.cmd.projectors_backward; c = cfg.cmd.projectors_backward;
} }
} else if (c === cfg.cmd.projector_second_forward) { } else if (c === cfg.cmd.projector_second_forward) {
if (current === cfg.cmd.projectors_backward) { if (current === cfg.cmd.projectors_backward) {
c = cfg.cmd.projector_backward_projector_second_forward; c = cfg.cmd.projector_backward_projector_second_forward;
} else if (current === cfg.cmd.projector_forward_projector_second_backward) { } else if (current === cfg.cmd.projector_forward_projector_second_backward) {
@ -231,7 +259,6 @@ class Grid {
c = cfg.cmd.projector_backward_projector_second_forward; c = cfg.cmd.projector_backward_projector_second_forward;
} }
} else if (c === cfg.cmd.projector_second_backward) { } else if (c === cfg.cmd.projector_second_backward) {
if (current === cfg.cmd.projectors_forward) { if (current === cfg.cmd.projectors_forward) {
c = cfg.cmd.projector_forward_projector_second_backward; c = cfg.cmd.projector_forward_projector_second_backward;
} else if (current === cfg.cmd.projector_backward_projector_second_forward) { } else if (current === cfg.cmd.projector_backward_projector_second_forward) {
@ -245,7 +272,22 @@ class Grid {
} }
seq.set(x, c); seq.set(x, c);
} else { } else {
if (cam.second.enabled && current.indexOf('C') !== -1) { if (c.indexOf('black') !== -1) {
if (current === 'BF' || current === 'BB') {
if (other === cfg.cmd.camera_forward) {
c = cfg.cmd.camera_forward;
} else if (other === cfg.cmd.camera_backward) {
c = cfg.cmd.camera_backward;
}
} else if (current.indexOf('P') !== -1) {
$(elem).prop('checked', false);
return;
}
} else if (other === 'black' && current === cfg.cmd.camera_forward) {
c = '';
} else if (other === 'black' && current === cfg.cmd.camera_backward) {
c = '';
} else if (cam.second.enabled && current.indexOf('C') !== -1) {
if (current === cfg.cmd.cameras_forward) { if (current === cfg.cmd.cameras_forward) {
if (other === cfg.cmd.camera_second_forward) { if (other === cfg.cmd.camera_second_forward) {
c = cfg.cmd.camera_second_forward; c = cfg.cmd.camera_second_forward;

View File

@ -71,11 +71,21 @@ class Sequence {
log.info('Sequence stopped', 'SERIAL', true); log.info('Sequence stopped', 'SERIAL', true);
timeStr = ( arg.ms < 2000 ) ? `${arg.ms}ms` : humanizeDuration(arg.ms); timeStr = ( arg.ms < 2000 ) ? `${arg.ms}ms` : humanizeDuration(arg.ms);
gui.notify(`SEQUENCE`, `Sequence finished in ${timeStr}`); gui.notify(`SEQUENCE`, `Sequence finished in ${timeStr}`);
if (capper.enabled && this.arr.some(this.hasCapper)) {
$('#cmd_capper_off').addClass('active');
$('#cmd_capper_on').removeClass('active');
}
} }
} }
return event.returnValue = true; return event.returnValue = true;
} }
private hasCapper (el : any) {
if (['BF', 'BB'].indexOf(el.cmd) !== -1) {
return true;
}
}
private progress (step : number, loop : number) { private progress (step : number, loop : number) {
const elem : any = $('.progress-bar'); const elem : any = $('.progress-bar');
const len : number = this.arr.length; const len : number = this.arr.length;

View File

@ -15,8 +15,8 @@
"momentary": 0 "momentary": 0
}, },
"black": { "black": {
"before": 0, "before": 100,
"after": 0 "after": 100
}, },
"light": false "light": false
}, },

View File

@ -15,8 +15,8 @@
"momentary": 0 "momentary": 0
}, },
"black": { "black": {
"before": 0, "before": 100,
"after": 0 "after": 100
}, },
"light": false "light": false
}, },

View File

@ -65,17 +65,17 @@ class Capper {
} catch (err) { } catch (err) {
this.log.error(err); this.log.error(err);
} }
return await this.end(cmd, id, ms); return await this.end(cmd, id, ms);
} }
/** /**
* *
**/ **/
private async listener (event : any, arg : any) { private async listener (event : any, arg : any) {
if (typeof arg.capper !== 'undefined') { if (typeof arg.state !== 'undefined') {
try { try {
await this.capper(arg.capper, arg.id) await this.capper(arg.state, arg.id)
} catch (err) { } catch (err) {
this.log.error(err) this.log.error(err)
} }

View File

@ -11,6 +11,8 @@ class Commands {
private cam2 : any; private cam2 : any;
private proj2 : any; private proj2 : any;
private capper : any;
private cfg : any; private cfg : any;
private ipc : any; private ipc : any;
@ -26,15 +28,16 @@ class Commands {
* @param {object} proj2 {optional} Projector 2 * @param {object} proj2 {optional} Projector 2
**/ **/
constructor (cfg : any, proj : any, cam : any, light : any, cam2 : any = null, proj2 : any = null) { constructor (cfg : any, proj : any, cam : any, light : any, cam2 : any = null, proj2 : any = null, capper : any = null) {
this.cfg = cfg; this.cfg = cfg;
this.proj = proj; this.proj = proj;
this.cam = cam; this.cam = cam;
this.light = light; this.light = light;
if (cam2) this.cam2 = cam2; if (cam2 !== null) this.cam2 = cam2;
if (proj2) this.proj2 = proj2; if (proj2 !== null) this.proj2 = proj2;
if (capper !== null) this.capper = capper;
this.ipc = require('electron').ipcMain; this.ipc = require('electron').ipcMain;
} }
@ -111,18 +114,25 @@ class Commands {
public async black_forward () { public async black_forward () {
const id : string = uuid(); const id : string = uuid();
const off : number[] = [0, 0, 0]; const off : number[] = [0, 0, 0];
let ms : number; let ms : number = 0;
try { try {
if (!this.cam.state.dir) { if (!this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
await this.cam.set(true); await this.cam.set(true);
} }
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
if (this.capper) {
ms += await this.capper.capper(true, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off await this.light.set(off, id); //make sure set to off
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
ms = await this.cam.move(); ms += await this.cam.move();
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); await this.light.set(off, id);
if (this.capper) {
ms += await this.capper.capper(false, id);
}
} catch (err) { } catch (err) {
throw err; throw err;
} }
@ -163,18 +173,24 @@ class Commands {
public async black_backward () { public async black_backward () {
const id : string = uuid(); const id : string = uuid();
const off : number[] = [0, 0, 0]; const off : number[] = [0, 0, 0];
let ms : number; let ms : number = 0;
try { try {
if (this.cam.state.dir) { if (this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
await this.cam.set(false); await this.cam.set(false);
} }
if (this.capper) {
ms += await this.capper.capper(true, id);
}
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off await this.light.set(off, id); //make sure set to off
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
ms = await this.cam.move(); ms += await this.cam.move();
await delay(this.cfg.arduino.serialDelay); await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); await this.light.set(off, id);
if (this.capper) {
ms += await this.capper.capper(false, id);
}
} catch (err) { } catch (err) {
throw err; throw err;
} }
@ -575,6 +591,6 @@ class Commands {
} }
} }
module.exports = function (cfg : any, proj : any, cam : any, light : any, cam2 : any, proj2 : any) { module.exports = function (cfg : any, proj : any, cam : any, light : any, cam2 : any, proj2 : any, capper : any) {
return new Commands(cfg, proj, cam, light, cam2, proj2); return new Commands(cfg, proj, cam, light, cam2, proj2, capper);
} }

View File

@ -403,7 +403,7 @@ class Devices {
let d : any let d : any
let cs : any = {} let cs : any = {}
let ps : any = {} let ps : any = {}
let capper : any; let capper : any = {}
let checklist : any[] = [] let checklist : any[] = []
this.connected = { this.connected = {
@ -448,17 +448,15 @@ class Devices {
l.arduino = this.connected.light l.arduino = this.connected.light
if (this.connected.camera_second) { if (this.connected.camera_second) {
cs = { arduino : this.connected.camera_second } cs.arduino = this.connected.camera_second
} }
if (this.connected.projector_second) { if (this.connected.projector_second) {
ps = { arduino : this.connected.projector_second } ps.arduino = this.connected.projector_second
} }
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) {
@ -514,7 +512,7 @@ class Devices {
} }
} }
if (capper) { if (capper && capper.arduino) {
args.capper = capper args.capper = capper
this.mainWindow.setSize(800, 800) this.mainWindow.setSize(800, 800)
this.settings.update('capper', capper) this.settings.update('capper', capper)