Layout all commands that need to be added for dual projector functionality.

This commit is contained in:
mmcwilliams 2019-03-20 15:44:07 -04:00
parent 4236651a09
commit 7f0ab0fee3
2 changed files with 48 additions and 29 deletions

View File

@ -192,6 +192,27 @@ cmd.black_backward = function (callback) {
}, mcopy.cfg.arduino.serialDelay); }, mcopy.cfg.arduino.serialDelay);
} }
}; };
/*
cam2_forward : 'C2F',
cam2_backward : 'C2B',
cams_forward : 'CCF',
cams_forward : 'CCB',
cam_forward_cam2_backward : 'CFCB',
cam_backward_cam2_forward : 'CBCF',
proj2_forward : 'P2F',
proj2_backward : 'P2B',
projs_forward : 'PPF',
projs_backward : 'PPB',
proj_forward_proj2_backward : 'PFPB',
proj_backward_proj2_forward : 'PBPF'
*/
/** /**
* Move the camera to a specific frame. Accepts the input with the "move_cam_to" * Move the camera to a specific frame. Accepts the input with the "move_cam_to"
* value. Moves as black frames to prevent multiple exposure. * value. Moves as black frames to prevent multiple exposure.
@ -226,6 +247,12 @@ cmd.cam_to = function (t) {
} }
} }
}; };
/**
* Move the projector to a specific frame. Accepts the input with the "move_proj_to"
* value.
*
* @param {object} t HTML input element with the move to val
**/
cmd.proj_to = function (t) { cmd.proj_to = function (t) {
const raw = $('#move_proj_to').val(); const raw = $('#move_proj_to').val();
const val = parseInt(raw); const val = parseInt(raw);

View File

@ -1,5 +1,4 @@
var seq = {}, const seq = {};
capture = {};
/****** /******
Sequence Object Sequence Object
@ -10,10 +9,8 @@ seq.stopState = false;
mcopy.loop = 1; mcopy.loop = 1;
mcopy.loopCount = 0; mcopy.loopCount = 0;
capture.active = false;
capture.report = '';
seq.cmds = { seq.cmd = {
cam_forward : 'CF', cam_forward : 'CF',
cam_backward : 'CB', cam_backward : 'CB',
@ -72,19 +69,19 @@ seq.run = function () {
$('#numbers div').removeClass('h'); $('#numbers div').removeClass('h');
$('.row input[x=' + seq.i + ']').addClass('h'); $('.row input[x=' + seq.i + ']').addClass('h');
$('#numbers div[x=' + seq.i + ']').addClass('h'); $('#numbers div[x=' + seq.i + ']').addClass('h');
if (c === 'CF'){ if (c === seq.cmd.cam_forward){
rgb = mcopy.state.sequence.light[seq.i].split(','); rgb = mcopy.state.sequence.light[seq.i].split(',');
cmd.cam_forward(rgb, action); cmd.cam_forward(rgb, action);
} else if (c === 'CB') { } else if (c === seq.cmd.cam_backward) {
rgb = mcopy.state.sequence.light[seq.i].split(','); rgb = mcopy.state.sequence.light[seq.i].split(',');
cmd.cam_backward(rgb, action); cmd.cam_backward(rgb, action);
} else if (c === 'PF') { } else if (c === seq.cmd.proj_forward) {
cmd.proj_forward(action); cmd.proj_forward(action);
} else if (c === 'PB') { } else if (c === seq.cmd.proj_backward) {
cmd.proj_backward(action); cmd.proj_backward(action);
} else if (c === 'BF') { } else if (c === seq.cmd.black_forward) {
cmd.black_forward(action); cmd.black_forward(action);
} else if (c === 'BB') { } else if (c === seq.cmd.black_backward) {
cmd.black_backward(action); cmd.black_backward(action);
} }
} else { } else {
@ -105,10 +102,6 @@ seq.run = function () {
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true); log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true);
} }
ipcRenderer.send('seq', { action : 'stop' }); ipcRenderer.send('seq', { action : 'stop' });
//capture.report = ipcRenderer.sendSync('transfer', { action: 'end'});
//if (capture.active) {
//alert(capture.report);
//}
gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd)); gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd));
//clear gui //clear gui
$('.row input').removeClass('h'); $('.row input').removeClass('h');
@ -146,7 +139,6 @@ seq.init = function (start) {
seq.stop(false); seq.stop(false);
seq.i = start; seq.i = start;
//ipcRenderer.sendSync('transfer', { action: 'start'});
ipcRenderer.send('seq', { action : 'start' }); ipcRenderer.send('seq', { action : 'start' });
seq.run(); seq.run();
}; };
@ -166,17 +158,17 @@ seq.stats = function () {
//timing //timing
for (var i = 0; i < mcopy.state.sequence.arr.length; i++) { for (var i = 0; i < mcopy.state.sequence.arr.length; i++) {
c = mcopy.state.sequence.arr[i]; c = mcopy.state.sequence.arr[i];
if (c === 'CF' || c === 'CB'){ if (c === seq.cmd.cam_forward || c === seq.cmd.cam_backward){
ms += mcopy.cfg.arduino.cam.time; ms += mcopy.cfg.arduino.cam.time;
ms += mcopy.cfg.arduino.cam.delay; ms += mcopy.cfg.arduino.cam.delay;
ms += mcopy.cfg.arduino.serialDelay; ms += mcopy.cfg.arduino.serialDelay;
} }
if (c === 'PF' || c === 'PB'){ if (c === seq.cmd.proj_forward || c === seq.cmd.proj_backward){
ms += mcopy.cfg.arduino.proj.time; ms += mcopy.cfg.arduino.proj.time;
ms += mcopy.cfg.arduino.proj.delay; ms += mcopy.cfg.arduino.proj.delay;
ms += mcopy.cfg.arduino.serialDelay; ms += mcopy.cfg.arduino.serialDelay;
} }
if (c === 'BF' || c === 'BB'){ if (c === seq.cmd.black_forward || c === seq.cmd.black_backward){
ms += mcopy.cfg.arduino.black.before; ms += mcopy.cfg.arduino.black.before;
ms += mcopy.cfg.arduino.black.after; ms += mcopy.cfg.arduino.black.after;
ms += mcopy.cfg.arduino.cam.time; ms += mcopy.cfg.arduino.cam.time;
@ -185,16 +177,16 @@ seq.stats = function () {
} }
ms += mcopy.cfg.arduino.sequenceDelay; ms += mcopy.cfg.arduino.sequenceDelay;
if (c === 'CF' || c === 'BF') { if (c === seq.cmd.cam_forward || c === seq.cmd.black_forward) {
cam_total++; cam_total++;
} }
if (c === 'CB' || c === 'BB') { if (c === seq.cmd.cam_backward || c === seq.cmd.black_backward) {
cam_total--; cam_total--;
} }
if (c === 'PF') { if (c === seq.cmd.proj_forward) {
proj_total++; proj_total++;
} }
if (c === 'PB') { if (c === seq.cmd.proj_backward) {
proj_total--; proj_total--;
} }
} }
@ -288,17 +280,17 @@ seq.step = function () {
max = seq.state.len; max = seq.state.len;
gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100, true); gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100, true);
log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true); log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true);
if (c === 'CF'){ if (c === seq.cmd.cam_forward){
cmd.cam_forward(rgb, seq.step); cmd.cam_forward(rgb, seq.step);
} else if (c === 'CB') { } else if (c === seq.cmd.cam_backward) {
cmd.cam_backward(rgb, seq.step); cmd.cam_backward(rgb, seq.step);
} else if (c === 'PF') { } else if (c === seq.cmd.proj_forward) {
cmd.proj_forward(seq.step); cmd.proj_forward(seq.step);
} else if (c === 'PB') { } else if (c === seq.cmd.proj_backward) {
cmd.proj_backward(seq.step); cmd.proj_backward(seq.step);
} else if (c === 'BF') { } else if (c === seq.cmd.black_forward) {
cmd.black_forward(seq.step); cmd.black_forward(seq.step);
} else if (c === 'BB') { } else if (c === seq.cmd.black_backward) {
cmd.black_backward(seq.step); cmd.black_backward(seq.step);
} }
} }