All remaining dual projector, dual camera work.

This commit is contained in:
mmcwilliams 2019-04-20 10:15:28 -04:00
parent 1a612376cb
commit ad558608ee
22 changed files with 242 additions and 51 deletions

View File

@ -205,28 +205,28 @@
<div id="buttons_2" class="clearfix"> <div id="buttons_2" class="clearfix">
<div class="cam2"> <div class="cam2">
<div> <div>
<button id="cmd_cam_forward" onclick="cmd.camera_second_forward(light.color);" class="cmd fwd"> <button id="cmd_cam2_forward" onclick="cmd.camera_second_forward(light.color);" class="cmd fwd">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
CAMERA 2 +1 CAMERA 2 +1
<i class="fa fa-step-forward"></i> <i class="fa fa-step-forward"></i>
</button> </button>
</div> </div>
<div> <div>
<button id="cmd_cam_backward" onclick="cmd.camera_backward(light.color);" class="cmd bwd"> <button id="cmd_cam2_backward" onclick="cmd.camera_second_backward(light.color);" class="cmd bwd">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
CAMERA 2 -1 CAMERA 2 -1
<i class="fa fa-step-backward"></i> <i class="fa fa-step-backward"></i>
</button> </button>
</div> </div>
<div> <div>
<button id="cmd_black_forward" onclick="cmd.black_forward();" class="cmd fwd"> <button id="cmd_black2_forward" onclick="cmd.black2_forward();" class="cmd fwd">
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
BLANK +1 BLANK +1
<i class="fa fa-step-forward"></i> <i class="fa fa-step-forward"></i>
</button> </button>
</div> </div>
<div> <div>
<button id="cmd_black_backward" onclick="cmd.black_backward();" class="cmd bwd"> <button id="cmd_black2_backward" onclick="cmd.black2_backward();" class="cmd bwd">
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
BLANK -1 BLANK -1
<i class="fa fa-step-backward"></i> <i class="fa fa-step-backward"></i>
@ -235,14 +235,14 @@
</div> </div>
<div class="proj2"> <div class="proj2">
<div> <div>
<button id="cmd_proj_forward" onclick="cmd.projector_forward();" class="cmd fwd"> <button id="cmd_proj2_forward" onclick="cmd.projector_second_forward();" class="cmd fwd">
<i class="fa fa-film"></i> <i class="fa fa-film"></i>
PROJECTOR 2 +1 PROJECTOR 2 +1
<i class="fa fa-step-forward"></i> <i class="fa fa-step-forward"></i>
</button> </button>
</div> </div>
<div> <div>
<button id="cmd_proj_backward" onclick="cmd.projector_backward();" class="cmd bwd"> <button id="cmd_proj2_backward" onclick="cmd.projector_second_backward();" class="cmd bwd">
<i class="fa fa-film"></i> <i class="fa fa-film"></i>
PROJECTOR 2 -1 PROJECTOR 2 -1
<i class="fa fa-step-backward"></i> <i class="fa fa-step-backward"></i>

View File

@ -2478,7 +2478,7 @@ const { remote, ipcRenderer } = require('electron');
const dialog = require('electron').remote.dialog; const dialog = require('electron').remote.dialog;
const notifier = require('node-notifier'); const notifier = require('node-notifier');
const fs = require('fs'); const fs = require('fs');
const uuid = require('uuid'); const uuid = require('uuid').v4;
const moment = require('moment'); const moment = require('moment');
const humanizeDuration = require('humanize-duration'); const humanizeDuration = require('humanize-duration');
const PACKAGE = require('./package.json'); const PACKAGE = require('./package.json');

View File

@ -103,7 +103,6 @@ class Camera {
return this.end(cmd, id, ms); return this.end(cmd, id, ms);
} }
async both(frame, id) { async both(frame, id) {
id = 'cameras';
const cmd = this.cfg.arduino.cmd[id]; const cmd = this.cfg.arduino.cmd[id];
let ms; let ms;
try { try {

File diff suppressed because one or more lines are too long

View File

@ -88,8 +88,7 @@ class Projector {
return await this.end(cmd, id, ms); return await this.end(cmd, id, ms);
} }
async both(frame, id) { async both(frame, id) {
id = 'projectors'; const cmd = this.cfg.arduino.cmd[this.id + 's'];
const cmd = this.cfg.arduino.cmd[id];
let ms; let ms;
try { try {
ms = await this.arduino.send(this.id, cmd); ms = await this.arduino.send(this.id, cmd);

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ cam.set = function (dir, callback) {
} }
obj = { obj = {
dir : dir, dir : dir,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(cam.id, obj); ipcRenderer.sendSync(cam.id, obj);
@ -33,7 +33,7 @@ cam.setValue = function (val) {
'use strict'; 'use strict';
var obj = { var obj = {
val: val, val: val,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(cam.id, obj); ipcRenderer.sendSync(cam.id, obj);
}; };
@ -45,7 +45,7 @@ cam.move = function (callback) {
} }
obj = { obj = {
frame : true, frame : true,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(cam.id, obj); ipcRenderer.sendSync(cam.id, obj);
@ -67,6 +67,18 @@ cam.end = function (c, id, ms) {
} else { } else {
cam.pos -= 1; cam.pos -= 1;
} }
} else if (c === cfg.arduino.cmd.cameras) {
if (cam.dir) {
cam.pos += 1;
} else {
cam.pos -= 1;
}
if (cam.second.dir) {
cam.second.pos += 1;
} else {
cam.second.pos -= 1;
}
gui.counterUpdate('cam2', cam.second.pos);
} }
gui.counterUpdate('cam', cam.pos) gui.counterUpdate('cam', cam.pos)
if (typeof cam.queue[id] !== 'undefined') { if (typeof cam.queue[id] !== 'undefined') {
@ -120,7 +132,7 @@ cam.second.set = function (dir, callback) {
} }
obj = { obj = {
dir : dir, dir : dir,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(cam.second.id, obj); ipcRenderer.sendSync(cam.second.id, obj);
@ -135,7 +147,7 @@ cam.second.setValue = function (val) {
'use strict'; 'use strict';
var obj = { var obj = {
val: val, val: val,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(cam.second.id, obj); ipcRenderer.sendSync(cam.second.id, obj);
}; };
@ -147,7 +159,7 @@ cam.second.move = function (callback) {
} }
obj = { obj = {
frame : true, frame : true,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(cam.second.id, obj); ipcRenderer.sendSync(cam.second.id, obj);
@ -164,13 +176,13 @@ cam.second.end = function (c, id, ms) {
} else if (c === cfg.arduino.cmd.camera_second_backward) { } else if (c === cfg.arduino.cmd.camera_second_backward) {
cam.second.dir = false; cam.second.dir = false;
} else if (c === cfg.arduino.cmd.camera_second) { } else if (c === cfg.arduino.cmd.camera_second) {
if (cam.dir) { if (cam.second.dir) {
cam.second.pos += 1; cam.second.pos += 1;
} else { } else {
cam.second.pos -= 1; cam.second.pos -= 1;
} }
} }
gui.counterUpdate('cam', cam.second.pos) gui.counterUpdate('cam2', cam.second.pos)
if (typeof cam.second.queue[id] !== 'undefined') { if (typeof cam.second.queue[id] !== 'undefined') {
if (typeof cam.queue[id].callback !== 'undefined') { if (typeof cam.queue[id].callback !== 'undefined') {
cam.second.queue[id].callback(ms); cam.second.queue[id].callback(ms);
@ -179,7 +191,7 @@ cam.second.end = function (c, id, ms) {
cam.second.lock = false; cam.second.lock = false;
} }
}; };
cam.listen = function () { cam.second.listen = function () {
'use strict'; 'use strict';
ipcRenderer.on(cam.second.id, function (event, arg) { ipcRenderer.on(cam.second.id, function (event, arg) {
cam.second.end(arg.cmd, arg.id, arg.ms); cam.second.end(arg.cmd, arg.id, arg.ms);

View File

@ -50,6 +50,57 @@ cmd.projector_backward = function (callback) {
}, cfg.arduino.serialDelay); }, cfg.arduino.serialDelay);
} }
}; };
cmd.projector_second_forward = function (callback) {
'use strict';
var res = function (ms) {
$('#cmd_proj2_forward').removeClass('active');
gui.updateState();
if (callback) { callback(ms); }
};
$('#cmd_proj2_forward').addClass('active');
if (!proj.second.dir) {
proj.second.set(true, function (ms) {
setTimeout(function () {
proj.second.move(res);
}, cfg.arduino.serialDelay);
});
} else {
setTimeout(function () {
proj.second.move(res);
}, cfg.arduino.serialDelay);
}
};
cmd.projector_second_backward = function (callback) {
'use strict';
var res = function (ms) {
$('#cmd_proj2_backward').removeClass('active');
gui.updateState();
if (callback) { callback(ms); }
};
$('#cmd_proj2_backward').addClass('active');
if (proj.second.dir) {
proj.second.set(false, function (ms) {
setTimeout(function () {
proj.second.move(res);
}, cfg.arduino.serialDelay);
});
} else {
setTimeout(function () {
proj.second.move(res);
}, cfg.arduino.serialDelay);
}
};
/*
no ui for these?
cmd.projectors_forward = function (callback) {};
cmd.projectors_backward = function (callback) {};
cmd.projector_forward_projector_second_backward = function (callback) {};
cmd.projector_backward_projector_second_forward = function (callback) {};
*/
/** /**
* Move the camera one frame forward * Move the camera one frame forward
* *
@ -208,14 +259,136 @@ cmd.black_backward = function (callback) {
* *
* @param {function} callback Function to call after action * @param {function} callback Function to call after action
**/ **/
cmd.projector_second_forward = function (callback) {}; cmd.camera_second_forward = function (callback) {
cmd.projector_second_backward = function (callback) {}; 'use strict';
var off = [0, 0, 0];
var res = function (ms) {
gui.updateState();
setTimeout(function () {
light.display(off);
light.set(off, function () {
$('#cmd_cam2_forward').removeClass('active');
if (callback) { callback(ms); }
});
}, cfg.arduino.serialDelay);
};
$('#cmd_cam2_forward').addClass('active');
if (!cam.second.dir) {
cam.second.set(true, function () {
setTimeout( function () {
light.display(rgb);
light.set(rgb, function () {
setTimeout( function () {
cam.second.move(res);
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
} else {
light.display(rgb);
light.set(rgb, function () {
setTimeout(function () {
cam.second.move(res);
}, cfg.arduino.serialDelay);
});
}
};
cmd.camera_second_backward = function (callback) {
'use strict';
var off = [0, 0, 0];
var res = function (ms) {
gui.updateState();
light.display(off);
light.set(off, function () {
$('#cmd_cam_backward').removeClass('active');
if (callback) { callback(ms); }
});
};
$('#cmd_cam_backward').addClass('active');
if (cam.second.dir) {
cam.second.set(false, function () {
setTimeout(function () {
light.display(rgb);
light.set(rgb, function () {
cam.second.move(res);
});
}, cfg.arduino.serialDelay);
});
} else {
setTimeout(function () {
light.display(rgb);
light.set(rgb, function () {
cam.second.move(res);
});
}, cfg.arduino.serialDelay);
}
};
cmd.projectors_forward = function (callback) {}; cmd.black_second_forward = function (callback) {
cmd.projectors_backward = function (callback) {}; 'use strict';
var off = [0, 0, 0];
var res = function (ms) {
$('#cmd_black2_forward').removeClass('active');
gui.updateState();
if (callback) { callback(ms); }
};
$('#cmd_black2_forward').addClass('active');
if (!cam.second.dir) {
cam.second.set(true, function () {
setTimeout( function () {
light.display(off);
light.set(off, function () {
setTimeout( function () {
cam.second.move(res);
}, cfg.arduino.serialDelay);
});
}, cfg.arduino.serialDelay);
});
} else {
light.display(off);
light.set(off, function () {
setTimeout(function () {
cam.second.move(res);
}, cfg.arduino.serialDelay);
});
}
};
cmd.projector_forward_projector_second_backward = function (callback) {}; cmd.black2_backward = function (callback) {
cmd.projector_backward_projector_second_forward = function (callback) {}; 'use strict';
var off = [0, 0, 0];
var res = function (ms) {
$('#cmd_black2_backward').removeClass('active');
gui.updateState();
if (callback) { callback(ms); }
};
$('#cmd_black2_backward').addClass('active');
if (cam.second.dir) {
cam.second.set(false, function () {
setTimeout(function () {
light.display(off);
light.set(off, function () {
cam.second.move(res);
});
}, cfg.arduino.serialDelay);
});
} else {
setTimeout(function () {
light.display(off);
light.set(off, function () {
cam.second.move(res);
});
}, cfg.arduino.serialDelay);
}
};
/*
cmd.cameras_forward = function (callback) {};
cmd.cameras_backward = function (callback) {};
cmd.camera_forward_camera_second_backward = function (callback) {};
cmd.camera_backward_camera_second_forward = function (callback) {};
*/
/** /**
* 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"

View File

@ -122,6 +122,7 @@ gui.updateState = function () {
'use strict'; 'use strict';
const cpos = cam.pos; const cpos = cam.pos;
const ppos = proj.pos; const ppos = proj.pos;
const p2pos = proj.second.pos; const p2pos = proj.second.pos;
const c2pos = cam.second.pos; const c2pos = cam.second.pos;

View File

@ -92,7 +92,7 @@ light.init = function () {
light.disable = function () { light.disable = function () {
const obj = { const obj = {
disable : true, disable : true,
id : uuid.v4() id : uuid()
}; };
light.disabled = true; light.disabled = true;
$('#tb_toolbar_item_light').hide(); $('#tb_toolbar_item_light').hide();
@ -104,7 +104,7 @@ light.disable = function () {
light.enable = function () { light.enable = function () {
const obj = { const obj = {
enable : true, enable : true,
id : uuid.v4() id : uuid()
}; };
light.disabled = false; light.disabled = false;
$('#tb_toolbar_item_light').show(); $('#tb_toolbar_item_light').show();
@ -156,7 +156,7 @@ light.set = function (rgb, callback) { //rgb = [0,0,0]
obj = { obj = {
rgb, rgb,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(light.id, obj); ipcRenderer.sendSync(light.id, obj);

View File

@ -18,7 +18,7 @@ proj.set = function (dir, callback) {
} }
obj = { obj = {
dir : dir, dir : dir,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(proj.id, obj); ipcRenderer.sendSync(proj.id, obj);
@ -36,7 +36,7 @@ proj.move = function (callback) {
} }
obj = { obj = {
frame : true, frame : true,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(proj.id, obj); ipcRenderer.sendSync(proj.id, obj);
@ -58,6 +58,18 @@ proj.end = function (c, id, ms) {
} else { } else {
proj.pos -= 1; proj.pos -= 1;
} }
} else if (c === cfg.arduino.cmd.projectors) {
if (proj.dir) {
proj.pos += 1;
} else {
proj.pos -= 1;
}
if (proj.second.dir) {
proj.second.pos += 1;
} else {
proj.second.pos -= 1;
}
gui.counterUpdate('proj2', proj.second.pos)
} }
gui.counterUpdate('proj', proj.pos) gui.counterUpdate('proj', proj.pos)
if (typeof proj.queue[id] !== 'undefined') { if (typeof proj.queue[id] !== 'undefined') {
@ -71,6 +83,7 @@ proj.end = function (c, id, ms) {
proj.listen = function () { proj.listen = function () {
'use strict'; 'use strict';
ipcRenderer.on(proj.id, function (event, arg) { ipcRenderer.on(proj.id, function (event, arg) {
console.dir(arg)
proj.end(arg.cmd, arg.id, arg.ms); proj.end(arg.cmd, arg.id, arg.ms);
return event.returnValue = true; return event.returnValue = true;
}); });
@ -80,7 +93,7 @@ proj.setValue = function (val) {
'use strict'; 'use strict';
var obj = { var obj = {
val: val, val: val,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(proj.id, obj); ipcRenderer.sendSync(proj.id, obj);
}; };
@ -120,7 +133,7 @@ proj.second.set = function (dir, callback) {
} }
obj = { obj = {
dir : dir, dir : dir,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(proj.second.id, obj); ipcRenderer.sendSync(proj.second.id, obj);
@ -138,7 +151,7 @@ proj.second.move = function (callback) {
} }
obj = { obj = {
frame : true, frame : true,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(proj.second.id, obj); ipcRenderer.sendSync(proj.second.id, obj);
@ -155,7 +168,7 @@ proj.second.end = function (c, id, ms) {
} else if (c === cfg.arduino.cmd.projector_second_backward) { } else if (c === cfg.arduino.cmd.projector_second_backward) {
proj.second.dir = false; proj.second.dir = false;
} else if (c === cfg.arduino.cmd.projector_second) { } else if (c === cfg.arduino.cmd.projector_second) {
if (proj.dir) { if (proj.second.dir) {
proj.second.pos += 1; proj.second.pos += 1;
} else { } else {
proj.second.pos -= 1; proj.second.pos -= 1;
@ -182,7 +195,7 @@ proj.second.setValue = function (val) {
'use strict'; 'use strict';
var obj = { var obj = {
val: val, val: val,
id : uuid.v4() id : uuid()
}; };
ipcRenderer.sendSync(proj.second.id, obj); ipcRenderer.sendSync(proj.second.id, obj);
}; };

View File

@ -4,7 +4,7 @@ const { remote, ipcRenderer } = require('electron');
const dialog = require('electron').remote.dialog; const dialog = require('electron').remote.dialog;
const notifier = require('node-notifier'); const notifier = require('node-notifier');
const fs = require('fs'); const fs = require('fs');
const uuid = require('uuid'); const uuid = require('uuid').v4;
const moment = require('moment'); const moment = require('moment');
const humanizeDuration = require('humanize-duration'); const humanizeDuration = require('humanize-duration');
const PACKAGE = require('./package.json'); const PACKAGE = require('./package.json');

View File

@ -103,7 +103,6 @@ class Camera {
return this.end(cmd, id, ms); return this.end(cmd, id, ms);
} }
async both(frame, id) { async both(frame, id) {
id = 'cameras';
const cmd = this.cfg.arduino.cmd[id]; const cmd = this.cfg.arduino.cmd[id];
let ms; let ms;
try { try {

File diff suppressed because one or more lines are too long

View File

@ -88,8 +88,7 @@ class Projector {
return await this.end(cmd, id, ms); return await this.end(cmd, id, ms);
} }
async both(frame, id) { async both(frame, id) {
id = 'projectors'; const cmd = this.cfg.arduino.cmd[this.id + 's'];
const cmd = this.cfg.arduino.cmd[id];
let ms; let ms;
try { try {
ms = await this.arduino.send(this.id, cmd); ms = await this.arduino.send(this.id, cmd);

File diff suppressed because one or more lines are too long

View File

@ -103,7 +103,6 @@ class Camera {
return this.end(cmd, id, ms); return this.end(cmd, id, ms);
} }
async both(frame, id) { async both(frame, id) {
id = 'cameras';
const cmd = this.cfg.arduino.cmd[id]; const cmd = this.cfg.arduino.cmd[id];
let ms; let ms;
try { try {

File diff suppressed because one or more lines are too long

View File

@ -88,8 +88,7 @@ class Projector {
return await this.end(cmd, id, ms); return await this.end(cmd, id, ms);
} }
async both(frame, id) { async both(frame, id) {
id = 'projectors'; const cmd = this.cfg.arduino.cmd[this.id + 's'];
const cmd = this.cfg.arduino.cmd[id];
let ms; let ms;
try { try {
ms = await this.arduino.send(this.id, cmd); ms = await this.arduino.send(this.id, cmd);

File diff suppressed because one or more lines are too long

View File

@ -110,7 +110,6 @@ class Camera {
} }
public async both (frame : any, id : string) { public async both (frame : any, id : string) {
id = 'cameras';
const cmd : string = this.cfg.arduino.cmd[id]; const cmd : string = this.cfg.arduino.cmd[id];
let ms : number; let ms : number;
try { try {

View File

@ -92,8 +92,7 @@ class Projector {
} }
public async both (frame : any, id : string) { public async both (frame : any, id : string) {
id = 'projectors'; const cmd : string = this.cfg.arduino.cmd[this.id + 's'];
const cmd : string = this.cfg.arduino.cmd[id];
let ms : number; let ms : number;
try { try {
ms = await this.arduino.send(this.id, cmd) ms = await this.arduino.send(this.id, cmd)