Rename all keys to full "camera_" vs "cam_" and "projector_" vs "proj_" for consistency across the app.
Successfully separate and refactor gui.grid object to gui.
This commit is contained in:
parent
e5a1654341
commit
48e8415ee4
|
@ -104,32 +104,32 @@
|
||||||
"camera" : "c",
|
"camera" : "c",
|
||||||
"projector" : "p",
|
"projector" : "p",
|
||||||
"black" : "b",
|
"black" : "b",
|
||||||
"cam_forward" : "e",
|
"camera_forward" : "e",
|
||||||
"cam_backward" : "f",
|
"camera_backward" : "f",
|
||||||
"proj_forward" : "g",
|
"projector_forward" : "g",
|
||||||
"proj_backward" : "h",
|
"projector_backward" : "h",
|
||||||
"proj_identifier" : "j",
|
"projector_identifier" : "j",
|
||||||
"cam_identifier" : "k",
|
"camera_identifier" : "k",
|
||||||
"mcopy_identifier" : "m",
|
"mcopy_identifier" : "m",
|
||||||
"cam_timed" : "n",
|
"camera_timed" : "n",
|
||||||
"proj_identifier" : "j",
|
"projector_identifier" : "j",
|
||||||
"cam_identifier" : "k",
|
"camera_identifier" : "k",
|
||||||
"light_identifier" : "o",
|
"light_identifier" : "o",
|
||||||
"proj_light_identifier" : "q",
|
"projector_light_identifier" : "q",
|
||||||
"proj_cam_light_identifier" : "r",
|
"projector_camera_light_identifier" : "r",
|
||||||
"proj_cam_identifier" : "s",
|
"projector_camera_identifier" : "s",
|
||||||
|
|
||||||
"proj_second_identifier" : "t",
|
"projector_second_identifier" : "t",
|
||||||
"proj_dual_identifier" : "d",
|
"projectors_identifier" : "d",
|
||||||
"proj_second_forward" : "u",
|
"projector_second_forward" : "u",
|
||||||
"proj_second_backward" : "v",
|
"projector_second_backward" : "v",
|
||||||
"projector_second" : "w",
|
"projector_second" : "w",
|
||||||
"projectors" : "x",
|
"projectors" : "x",
|
||||||
|
|
||||||
"cam_second_identifier" : "y",
|
"camera_second_identifier" : "y",
|
||||||
"cam_dual_identifier" : "a",
|
"cameras_identifier" : "a",
|
||||||
"cam_second_forward" : "1",
|
"camera_second_forward" : "1",
|
||||||
"cam_second_backward" : "2",
|
"camera_second_backward" : "2",
|
||||||
"camera_second" : "3",
|
"camera_second" : "3",
|
||||||
"cameras" : "4"
|
"cameras" : "4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
<div id="actions">
|
<div id="actions">
|
||||||
<button id="seq_run" onclick="seq.init();">RUN</button>
|
<button id="seq_run" onclick="seq.init();">RUN</button>
|
||||||
<button id="seq_stop" onclick="seq.stop(true);">STOP</button>
|
<button id="seq_stop" onclick="seq.stop(true);">STOP</button>
|
||||||
<button id="seq_clear" onclick="gui.grid.clear();">CLEAR</button>
|
<button id="seq_clear" onclick="grid.clear();">CLEAR</button>
|
||||||
<button id="seq_plus24" onclick="gui.grid.plus_24();">+ 24</button>
|
<button id="seq_plus24" onclick="grid.plus_24();">+ 24</button>
|
||||||
<button id="seq_mscript" onclick="mse.mscript.fromSequence();">TO SCRIPT</button>
|
<button id="seq_mscript" onclick="mse.mscript.fromSequence();">TO SCRIPT</button>
|
||||||
<input id="seq_scroll_state" type="number" min="0" value="00000" />
|
<input id="seq_scroll_state" type="number" min="0" value="00000" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="seq_loop_wrap">
|
<div id="seq_loop_wrap">
|
||||||
<h3>LOOPS</h3>
|
<h3>LOOPS</h3>
|
||||||
<input type="number" min="1" id="seq_loop" value="00001" onchange="this.value = gui.fmtZero(this.value, 6); gui.grid.loopChange(this);"/>
|
<input type="number" min="1" id="seq_loop" value="00001" onchange="this.value = gui.fmtZero(this.value, 6); grid.loopChange(this);"/>
|
||||||
<div id="loop_current"></div>
|
<div id="loop_current"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -91,28 +91,28 @@
|
||||||
<!--<label>MOVE TO</label>-->
|
<!--<label>MOVE TO</label>-->
|
||||||
<div>
|
<div>
|
||||||
<input type="number" id="move_cam_to" class="count" value="00000" onchange="gui.counterFormat(this, this.value);" />
|
<input type="number" id="move_cam_to" class="count" value="00000" onchange="gui.counterFormat(this, this.value);" />
|
||||||
<button id="move_cam_to_go" onclick="return cmd.cam_to();">GO TO</button>
|
<button id="move_cam_to_go" onclick="return cmd.camera_to();">GO TO</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="proj">
|
<div class="proj">
|
||||||
<!--<label>MOVE TO</label>-->
|
<!--<label>MOVE TO</label>-->
|
||||||
<div>
|
<div>
|
||||||
<input type="number" id="move_proj_to" class="count" value="00000" onchange="gui.counterFormat(this, this.value);"/>
|
<input type="number" id="move_proj_to" class="count" value="00000" onchange="gui.counterFormat(this, this.value);"/>
|
||||||
<button id="move_proj_to_go" onclick="return cmd.proj_to();">GO TO</button>
|
<button id="move_proj_to_go" onclick="return cmd.projector_to();">GO TO</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="buttons" class="clearfix">
|
<div id="buttons" class="clearfix">
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<button id="cmd_cam_forward" onclick="cmd.cam_forward(light.color);" class="cmd fwd">
|
<button id="cmd_cam_forward" onclick="cmd.camera_forward(light.color);" class="cmd fwd">
|
||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
CAMERA +1
|
CAMERA +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.cam_backward(light.color);" class="cmd bwd">
|
<button id="cmd_cam_backward" onclick="cmd.camera_backward(light.color);" class="cmd bwd">
|
||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
CAMERA -1
|
CAMERA -1
|
||||||
<i class="fa fa-step-backward"></i>
|
<i class="fa fa-step-backward"></i>
|
||||||
|
@ -135,14 +135,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<button id="cmd_proj_forward" onclick="cmd.proj_forward();" class="cmd fwd">
|
<button id="cmd_proj_forward" onclick="cmd.projector_forward();" class="cmd fwd">
|
||||||
<i class="fa fa-film"></i>
|
<i class="fa fa-film"></i>
|
||||||
PROJECTOR +1
|
PROJECTOR +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.proj_backward();" class="cmd bwd">
|
<button id="cmd_proj_backward" onclick="cmd.projector_backward();" class="cmd bwd">
|
||||||
<i class="fa fa-film"></i>
|
<i class="fa fa-film"></i>
|
||||||
PROJECTOR -1
|
PROJECTOR -1
|
||||||
<i class="fa fa-step-backward"></i>
|
<i class="fa fa-step-backward"></i>
|
||||||
|
|
|
@ -2484,6 +2484,7 @@ const moment = require('moment');
|
||||||
const humanizeDuration = require('humanize-duration');
|
const humanizeDuration = require('humanize-duration');
|
||||||
const cfg = require('./data/cfg.json');
|
const cfg = require('./data/cfg.json');
|
||||||
const gui = require('./lib/ui');
|
const gui = require('./lib/ui');
|
||||||
|
const grid = require('./lib/ui/grid.js');
|
||||||
const light = require('./lib/ui/light.js');
|
const light = require('./lib/ui/light.js');
|
||||||
const proj = require('./lib/ui/proj.js');
|
const proj = require('./lib/ui/proj.js');
|
||||||
const cam = require('./lib/ui/cam.js');
|
const cam = require('./lib/ui/cam.js');
|
||||||
|
@ -2563,7 +2564,7 @@ async function init () {
|
||||||
log = await require('log')({})
|
log = await require('log')({})
|
||||||
|
|
||||||
nav.init();
|
nav.init();
|
||||||
gui.grid.init();
|
grid.init();
|
||||||
mse.mscript.init();
|
mse.mscript.init();
|
||||||
mse.console.init();
|
mse.console.init();
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,11 @@ class Arduino {
|
||||||
this.lock = false;
|
this.lock = false;
|
||||||
this.locks = {};
|
this.locks = {};
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Enumerate all connected devices that might be Arduinos
|
||||||
|
*
|
||||||
|
* @returns {Promise} Resolves after enumerating
|
||||||
|
**/
|
||||||
async enumerate() {
|
async enumerate() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
return SerialPort.list((err, ports) => {
|
return SerialPort.list((err, ports) => {
|
||||||
|
@ -200,22 +205,22 @@ class Arduino {
|
||||||
confirmEnd(data) {
|
confirmEnd(data) {
|
||||||
//console.dir(data)
|
//console.dir(data)
|
||||||
if (data === cfg.arduino.cmd.connect
|
if (data === cfg.arduino.cmd.connect
|
||||||
|| data === cfg.arduino.cmd.proj_identifier
|
|| data === cfg.arduino.cmd.projector_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_identifier
|
|| data === cfg.arduino.cmd.camera_identifier
|
||||||
|| data === cfg.arduino.cmd.light_identifier
|
|| data === cfg.arduino.cmd.light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_light_identifier
|
|| data === cfg.arduino.cmd.projector_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_light_identifier
|
|| data === cfg.arduino.cmd.projector_camera_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_identifier
|
|| data === cfg.arduino.cmd.projector_camera_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_second_identifier
|
|| data === cfg.arduino.cmd.projector_second_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_dual_identifier
|
|| data === cfg.arduino.cmd.projectors_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_second_forward
|
|| data === cfg.arduino.cmd.projector_second_forward
|
||||||
|| data === cfg.arduino.cmd.proj_second_backward
|
|| data === cfg.arduino.cmd.projector_second_backward
|
||||||
|| data === cfg.arduino.cmd.projector_second
|
|| data === cfg.arduino.cmd.projector_second
|
||||||
|| data === cfg.arduino.cmd.projectors
|
|| data === cfg.arduino.cmd.projectors
|
||||||
|| data === cfg.arduino.cmd.cam_second_identifier
|
|| data === cfg.arduino.cmd.camera_second_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_dual_identifier
|
|| data === cfg.arduino.cmd.cameras_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_second_forward
|
|| data === cfg.arduino.cmd.camera_second_forward
|
||||||
|| data === cfg.arduino.cmd.cam_second_backward
|
|| data === cfg.arduino.cmd.camera_second_backward
|
||||||
|| data === cfg.arduino.cmd.camera_second
|
|| data === cfg.arduino.cmd.camera_second
|
||||||
|| data === cfg.arduino.cmd.cameras) {
|
|| data === cfg.arduino.cmd.cameras) {
|
||||||
this.confirmExec(null, data);
|
this.confirmExec(null, data);
|
||||||
|
@ -250,34 +255,34 @@ class Arduino {
|
||||||
let writeSuccess;
|
let writeSuccess;
|
||||||
let type;
|
let type;
|
||||||
this.confirmExec = function (err, data) {
|
this.confirmExec = function (err, data) {
|
||||||
if (data === cfg.arduino.cmd.proj_identifier) {
|
if (data === cfg.arduino.cmd.projector_identifier) {
|
||||||
type = 'projector';
|
type = 'projector';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.cam_identifier) {
|
else if (data === cfg.arduino.cmd.camera_identifier) {
|
||||||
type = 'camera';
|
type = 'camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.light_identifier) {
|
else if (data === cfg.arduino.cmd.light_identifier) {
|
||||||
type = 'light';
|
type = 'light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_light_identifier) {
|
else if (data === cfg.arduino.cmd.projector_light_identifier) {
|
||||||
type = 'projector,light';
|
type = 'projector,light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_cam_light_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_light_identifier) {
|
||||||
type = 'projector,camera,light';
|
type = 'projector,camera,light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_cam_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera';
|
type = 'projector,camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.proj_second_identifier) {
|
else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second';
|
type = 'projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.proj_dual_identifier) {
|
else if (data === cfg.ardino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second';
|
type = 'projector,projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cam_second_identifier) {
|
else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second';
|
type = 'camera_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cam_dual_identifier) {
|
else if (data === cfg.ardino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second';
|
type = 'camera,camera_second';
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
//camera,projector,projector_second
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@ class Camera {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor(arduino, cfg, ui, dig) {
|
constructor(arduino, cfg, ui, dig, second = false) {
|
||||||
this.state = {
|
this.state = {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
dir: true,
|
dir: true,
|
||||||
|
@ -20,6 +20,8 @@ class Camera {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second)
|
||||||
|
this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -44,10 +46,10 @@ class Camera {
|
||||||
let cmd;
|
let cmd;
|
||||||
let ms;
|
let ms;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.cam_forward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd = this.cfg.arduino.cmd.cam_backward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
}
|
}
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
if (this.intval) {
|
if (this.intval) {
|
||||||
|
@ -164,12 +166,18 @@ class Camera {
|
||||||
**/
|
**/
|
||||||
async end(cmd, id, ms) {
|
async end(cmd, id, ms) {
|
||||||
let message = '';
|
let message = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.cam_forward) {
|
if (cmd === this.cfg.arduino.cmd.camera_forward) {
|
||||||
message = 'Camera set to FORWARD';
|
message = 'Camera set to FORWARD';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.cam_backward) {
|
else if (cmd === this.cfg.arduino.cmd.camera_backward) {
|
||||||
message = 'Camera set to BACKWARD';
|
message = 'Camera set to BACKWARD';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camera_second_forward) {
|
||||||
|
message = 'Camera second set to FORWARD';
|
||||||
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camera_second_backward) {
|
||||||
|
message = 'Camera second set to BACKWARD';
|
||||||
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.camera) {
|
else if (cmd === this.cfg.arduino.cmd.camera) {
|
||||||
message = 'Camera ';
|
message = 'Camera ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -180,7 +188,17 @@ class Camera {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
this.log.info(message, 'CAMERA', true, true);
|
else if (cmd === this.cfg.arduino.cmd.camera_second) {
|
||||||
|
message = 'Camera second ';
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message += 'REWOUND';
|
||||||
|
}
|
||||||
|
message += ' 1 frame';
|
||||||
|
}
|
||||||
|
this.log.info(message);
|
||||||
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame forward
|
* Move the projector one frame forward
|
||||||
**/
|
**/
|
||||||
async proj_forward() {
|
async projector_forward() {
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
if (!this.proj.state.dir) {
|
if (!this.proj.state.dir) {
|
||||||
|
@ -30,7 +30,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame backward
|
* Move the projector one frame backward
|
||||||
**/
|
**/
|
||||||
async proj_backward() {
|
async projector_backward() {
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
if (this.proj.state.dir) {
|
if (this.proj.state.dir) {
|
||||||
|
@ -50,7 +50,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
async cam_forward(rgb = [255, 255, 255]) {
|
async camera_forward(rgb = [255, 255, 255]) {
|
||||||
const off = [0, 0, 0];
|
const off = [0, 0, 0];
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
|
@ -98,7 +98,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
async cam_backward(rgb = [255, 255, 255]) {
|
async camera_backward(rgb = [255, 255, 255]) {
|
||||||
const off = [0, 0, 0];
|
const off = [0, 0, 0];
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
|
@ -143,21 +143,21 @@ class Commands {
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
cam2_forward : 'C2F',
|
camera_second_forward : 'C2F',
|
||||||
cam2_backward : 'C2B',
|
camera_second_backward : 'C2B',
|
||||||
|
|
||||||
cams_forward : 'CCF',
|
cameras_forward : 'CCF',
|
||||||
cams_forward : 'CCB',
|
cameras_forward : 'CCB',
|
||||||
|
|
||||||
cam_forward_cam2_backward : 'CFCB',
|
camera_forward_camera_second_backward : 'CFCB',
|
||||||
cam_backward_cam2_forward : 'CBCF',
|
camera_backward_camera_second_forward : 'CBCF',
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Move the secondary projector forward one frame
|
* Move the secondary projector forward one frame
|
||||||
*
|
*
|
||||||
* @param {function} callback Function to call after action
|
* @param {function} callback Function to call after action
|
||||||
**/
|
**/
|
||||||
/*cmd.proj2_forward = function (callback) {
|
/*cmd.projector_second_forward = function (callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
$('#cmd_proj2_forward').removeClass('active');
|
$('#cmd_proj2_forward').removeClass('active');
|
||||||
|
@ -177,20 +177,20 @@ class Commands {
|
||||||
}, mcopy.cfg.arduino.serialDelay);
|
}, mcopy.cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cmd.proj2_backward = function (callback) {};
|
cmd.projector_second_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.projs_forward = function (callback) {};
|
cmd.projectors_forward = function (callback) {};
|
||||||
cmd.projs_backward = function (callback) {};
|
cmd.projectors_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.proj_forward_proj2_backward = function (callback) {};
|
cmd.projector_forward_projector_second_backward = function (callback) {};
|
||||||
cmd.proj_backward_proj2_forward = function (callback) {};
|
cmd.projector_backward_projector_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"
|
||||||
* value. Moves as black frames to prevent multiple exposure.
|
* value. Moves as black frames to prevent multiple exposure.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
async cam_to() {
|
async camera_to() {
|
||||||
/*const raw = $('#move_cam_to').val();
|
/*const raw = $('#move_cam_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
@ -223,7 +223,7 @@ class Commands {
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
async proj_to() {
|
async projector_to() {
|
||||||
/*const raw = $('#move_proj_to').val();
|
/*const raw = $('#move_proj_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cmd/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,QAAQ;IAQb,YAAa,GAAS,EAAE,IAAU,EAAE,GAAS,EAAE,KAAW;QACzD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;IACxC,CAAC;IAED;;QAEI;IACG,KAAK,CAAC,YAAY;QACxB,IAAI,EAAW,CAAC;QAChB,IAAI;YACH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;gBACzB,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBA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C,CAAC;YAC1C,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAC3B,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACb,MAAM,GAAG,CAAC;SACV;QACD,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;;;;;MASE;IACF;;;;QAII;IACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BE;IAGF;;;;QAII;IACG,KAAK,CAAC,SAAS;QACrB;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;IACJ,CAAC;IAED;;;;QAII;IACG,KAAK,CAAC,YAAY;QACxB;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;IACJ,CAAC;CAED;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,GAAS,EAAE,IAAU,EAAE,GAAS,EAAE,KAAW;IACvE,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA"}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<a name="delay"></a>
|
||||||
|
|
||||||
|
## delay(ms) ⇒ <code>Promise</code>
|
||||||
|
Delay in an async/await function
|
||||||
|
|
||||||
|
**Kind**: global function
|
||||||
|
**Returns**: <code>Promise</code> - Promise to resolve after timeout
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| ms | <code>integer</code> | Milliseconds to delay for |
|
||||||
|
|
|
@ -296,6 +296,9 @@ class Devices {
|
||||||
return false
|
return false
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
//camera,projector,projector_second
|
||||||
|
//camera,camera_second,projector
|
||||||
|
//camera,camera_second,projector,projector_second
|
||||||
return connectSuccess;
|
return connectSuccess;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -384,7 +387,7 @@ class Devices {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.profile
|
profile: this.settings.state.profile
|
||||||
};
|
};
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second && projector_second.arduino) {
|
||||||
args.projector_second = projector_second;
|
args.projector_second = projector_second;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@ class Projector {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor(arduino, cfg, ui, dig) {
|
constructor(arduino, cfg, ui, dig, second = false) {
|
||||||
this.state = {
|
this.state = {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
dir: true,
|
dir: true,
|
||||||
|
@ -18,6 +18,8 @@ class Projector {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second)
|
||||||
|
this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -41,10 +43,10 @@ class Projector {
|
||||||
let cmd;
|
let cmd;
|
||||||
let ms;
|
let ms;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.proj_forward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd = this.cfg.arduino.cmd.proj_backward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
}
|
}
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
if (this.dig.state.enabled) {
|
if (this.dig.state.enabled) {
|
||||||
|
@ -55,7 +57,7 @@ class Projector {
|
||||||
ms = await this.arduino.send(this.id, cmd);
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.log.error('Error setting projector direction', err);
|
this.log.error(`Error setting ${this.id} direction`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await this.end(cmd, id, ms);
|
return await this.end(cmd, id, ms);
|
||||||
|
@ -79,7 +81,7 @@ class Projector {
|
||||||
ms = await this.arduino.send(this.id, cmd);
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.log.error('Error moving projector', err);
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
this.log.info('Projector move time', { ms });
|
||||||
|
@ -116,12 +118,18 @@ class Projector {
|
||||||
**/
|
**/
|
||||||
async end(cmd, id, ms) {
|
async end(cmd, id, ms) {
|
||||||
let message = '';
|
let message = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.proj_forward) {
|
if (cmd === this.cfg.arduino.cmd.projector_forward) {
|
||||||
message = 'Projector set to FORWARD';
|
message = 'Projector set to FORWARD';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.proj_backward) {
|
else if (cmd === this.cfg.arduino.cmd.projector_backward) {
|
||||||
message = 'Projector set to BACKWARD';
|
message = 'Projector set to BACKWARD';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second_forward) {
|
||||||
|
message = 'Projector second set to FORWARD';
|
||||||
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second_backward) {
|
||||||
|
message = 'Projector second set to BACKWARD';
|
||||||
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.projector) {
|
else if (cmd === this.cfg.arduino.cmd.projector) {
|
||||||
message = 'Projector ';
|
message = 'Projector ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -132,6 +140,16 @@ class Projector {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
|
message = 'Projector second';
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message += 'REWOUND';
|
||||||
|
}
|
||||||
|
message += ' 1 frame';
|
||||||
|
}
|
||||||
this.log.info(message, 'PROJECTOR');
|
this.log.info(message, 'PROJECTOR');
|
||||||
return await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
return await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/proj/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;;AAEjD,2BAA4B;AAE5B,MAAM,SAAS;IAed;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,GAAS;QAjBtD,UAAK,GAAS;YACrB,GAAG,EAAG,CAAC;YACP,GAAG,EAAG,IAAI;YACV,OAAO,EAAG,KAAK;SACf,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAOzB,OAAE,GAAY,WAAW,CAAC;QAMjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,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,CAAA;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE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AC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QACnC,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC,CAAA;IAChE,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,GAAS;IAC3E,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAA"}
|
|
@ -33,14 +33,14 @@ seq.run = function () {
|
||||||
$('#numbers div[x=' + seq.i + ']').addClass('h');
|
$('#numbers div[x=' + seq.i + ']').addClass('h');
|
||||||
if (c === 'CF'){
|
if (c === 'CF'){
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
||||||
cmd.cam_forward(rgb, action);
|
cmd.camera_forward(rgb, action);
|
||||||
} else if (c === 'CB') {
|
} else if (c === 'CB') {
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
||||||
cmd.cam_backward(rgb, action);
|
cmd.camera_backward(rgb, action);
|
||||||
} else if (c === 'PF') {
|
} else if (c === 'PF') {
|
||||||
cmd.proj_forward(action);
|
cmd.projector_forward(action);
|
||||||
} else if (c === 'PB') {
|
} else if (c === 'PB') {
|
||||||
cmd.proj_backward(action);
|
cmd.projector_backward(action);
|
||||||
} else if (c === 'BF') {
|
} else if (c === 'BF') {
|
||||||
cmd.black_forward(action);
|
cmd.black_forward(action);
|
||||||
} else if (c === 'BB') {
|
} else if (c === 'BB') {
|
||||||
|
@ -229,13 +229,13 @@ seq.step = function () {
|
||||||
gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100);
|
gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100);
|
||||||
log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true);
|
log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true);
|
||||||
if (c === 'CF'){
|
if (c === 'CF'){
|
||||||
cmd.cam_forward(rgb, seq.step);
|
cmd.camera_forward(rgb, seq.step);
|
||||||
} else if (c === 'CB') {
|
} else if (c === 'CB') {
|
||||||
cmd.cam_backward(rgb, seq.step);
|
cmd.camera_backward(rgb, seq.step);
|
||||||
} else if (c === 'PF') {
|
} else if (c === 'PF') {
|
||||||
cmd.proj_forward(seq.step);
|
cmd.projector_forward(seq.step);
|
||||||
} else if (c === 'PB') {
|
} else if (c === 'PB') {
|
||||||
cmd.proj_backward(seq.step);
|
cmd.projector_backward(seq.step);
|
||||||
} else if (c === 'BF') {
|
} else if (c === 'BF') {
|
||||||
cmd.black_forward(seq.step);
|
cmd.black_forward(seq.step);
|
||||||
} else if (c === 'BB') {
|
} else if (c === 'BB') {
|
||||||
|
@ -257,9 +257,9 @@ proj.set = async function (dir, id) {
|
||||||
let cmd
|
let cmd
|
||||||
let ms
|
let ms
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_forward
|
cmd = mcopy.cfg.arduino.cmd.projector_forward
|
||||||
} else {
|
} else {
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_backward
|
cmd = mcopy.cfg.arduino.cmd.projector_backward
|
||||||
}
|
}
|
||||||
proj.state.dir = dir
|
proj.state.dir = dir
|
||||||
if (proj.state.digital) {
|
if (proj.state.digital) {
|
||||||
|
@ -314,9 +314,9 @@ proj.listen = function () {
|
||||||
}
|
}
|
||||||
proj.end = async function (cmd, id, ms) {
|
proj.end = async function (cmd, id, ms) {
|
||||||
let message = ''
|
let message = ''
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.proj_forward) {
|
if (cmd === mcopy.cfg.arduino.cmd.projector_forward) {
|
||||||
message = 'Projector set to FORWARD'
|
message = 'Projector set to FORWARD'
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.proj_backward) {
|
} else if (cmd === mcopy.cfg.arduino.cmd.projector_backward) {
|
||||||
message = 'Projector set to BACKWARD'
|
message = 'Projector set to BACKWARD'
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.projector) {
|
} else if (cmd === mcopy.cfg.arduino.cmd.projector) {
|
||||||
message = 'Projector '
|
message = 'Projector '
|
||||||
|
@ -426,9 +426,9 @@ cam.set = async function (dir, id) {
|
||||||
let cmd
|
let cmd
|
||||||
let ms
|
let ms
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_forward
|
cmd = mcopy.cfg.arduino.cmd.camera_forward
|
||||||
} else {
|
} else {
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_backward
|
cmd = mcopy.cfg.arduino.cmd.camera_backward
|
||||||
}
|
}
|
||||||
cam.state.dir = dir
|
cam.state.dir = dir
|
||||||
|
|
||||||
|
@ -528,9 +528,9 @@ cam.listen = function () {
|
||||||
}
|
}
|
||||||
cam.end = async function (cmd, id, ms) {
|
cam.end = async function (cmd, id, ms) {
|
||||||
var message = ''
|
var message = ''
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.cam_forward) {
|
if (cmd === mcopy.cfg.arduino.cmd.camera_forward) {
|
||||||
message = 'Camera set to FORWARD'
|
message = 'Camera set to FORWARD'
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.cam_backward) {
|
} else if (cmd === mcopy.cfg.arduino.cmd.camera_backward) {
|
||||||
message = 'Camera set to BACKWARD'
|
message = 'Camera set to BACKWARD'
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.camera) {
|
} else if (cmd === mcopy.cfg.arduino.cmd.camera) {
|
||||||
message = 'Camera '
|
message = 'Camera '
|
||||||
|
|
|
@ -1,581 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
let log;
|
let log;
|
||||||
let seq;
|
let seq;
|
||||||
//var seq = {};
|
|
||||||
/******
|
|
||||||
Sequence Object
|
|
||||||
|
|
||||||
seq.i = 0;
|
|
||||||
seq.time = 0;
|
|
||||||
seq.stopState = false;
|
|
||||||
|
|
||||||
mcopy.loop = 1; //
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
|
|
||||||
seq.queue = [];
|
|
||||||
seq.running = false;
|
|
||||||
seq.state = {};
|
|
||||||
|
|
||||||
*******/
|
|
||||||
/**
|
|
||||||
* Run the sequence
|
|
||||||
|
|
||||||
seq.run = function () {
|
|
||||||
'use strict';
|
|
||||||
var c = mcopy.state.sequence.arr[seq.i],
|
|
||||||
timeEnd = 0,
|
|
||||||
rgb,
|
|
||||||
action = function () {
|
|
||||||
setTimeout(function () {
|
|
||||||
seq.i++;
|
|
||||||
seq.run();
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
}
|
|
||||||
if (seq.i == 0) {
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
ipcRenderer.send('seq', { action : 'loop' });
|
|
||||||
}
|
|
||||||
if (seq.stop()) {
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
log.info('Sequence stopped', 'SERIAL', true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (seq.i <= mcopy.state.sequence.arr.length && c !== undefined) {
|
|
||||||
log.info('Step ' + seq.i + ' command ' + c, 'SEQUENCE', true);
|
|
||||||
//gui action
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('.row input[x=' + seq.i + ']').addClass('h');
|
|
||||||
$('#numbers div[x=' + seq.i + ']').addClass('h');
|
|
||||||
if (c === 'CF'){
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_forward(rgb, action);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_backward(rgb, action);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(action);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(action);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(action);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(action);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mcopy.loopCount++;
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
if (mcopy.loopCount < mcopy.loop) {
|
|
||||||
log.info('Loop ' + mcopy.loopCount + ' completed', 'SEQUENCE', true);
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
seq.i = 0;
|
|
||||||
seq.run();
|
|
||||||
} else {
|
|
||||||
timeEnd = +new Date();
|
|
||||||
timeEnd = timeEnd - seq.time;
|
|
||||||
if (timeEnd < 2000) {
|
|
||||||
log.info('Sequence completed in ' + timeEnd + 'ms', 'SEQUENCE', true);
|
|
||||||
} else {
|
|
||||||
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true);
|
|
||||||
}
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd));
|
|
||||||
//clear gui
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('#loop_current').text('');
|
|
||||||
seq.stats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
seq.stop = function (state) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof state === 'undefined') {
|
|
||||||
if (seq.stopState === true) {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return seq.stopState;
|
|
||||||
} else {
|
|
||||||
seq.stopState = state;
|
|
||||||
}
|
|
||||||
if (state === false) {
|
|
||||||
mcopy.loopCount = 0
|
|
||||||
$('#loop_current').text('');
|
|
||||||
} else {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return state
|
|
||||||
};
|
|
||||||
seq.init = function (start) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof start === 'undefined') {
|
|
||||||
start = 0;
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
seq.time = +new Date();
|
|
||||||
}
|
|
||||||
seq.stop(false);
|
|
||||||
seq.i = start;
|
|
||||||
|
|
||||||
ipcRenderer.send('seq', { action : 'start' });
|
|
||||||
seq.run();
|
|
||||||
};
|
|
||||||
//!!! redo
|
|
||||||
seq.stats = function () {
|
|
||||||
'use strict';
|
|
||||||
var ms = 0,
|
|
||||||
c = '',
|
|
||||||
cam_total = 0,
|
|
||||||
proj_total = 0,
|
|
||||||
real_total = mcopy.state.sequence.arr.filter(function (elem) {
|
|
||||||
if (elem === undefined) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//timing
|
|
||||||
for (var i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
|
||||||
c = mcopy.state.sequence.arr[i];
|
|
||||||
if (c === 'CF' || c === 'CB'){
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'PF' || c === 'PB'){
|
|
||||||
ms += mcopy.cfg.arduino.proj.time;
|
|
||||||
ms += mcopy.cfg.arduino.proj.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'BF' || c === 'BB'){
|
|
||||||
ms += mcopy.cfg.arduino.black.before;
|
|
||||||
ms += mcopy.cfg.arduino.black.after;
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
ms += mcopy.cfg.arduino.sequenceDelay;
|
|
||||||
|
|
||||||
if (c === 'CF' || c === 'BF') {
|
|
||||||
cam_total++;
|
|
||||||
}
|
|
||||||
if (c === 'CB' || c === 'BB') {
|
|
||||||
cam_total--;
|
|
||||||
}
|
|
||||||
if (c === 'PF') {
|
|
||||||
proj_total++;
|
|
||||||
}
|
|
||||||
if (c === 'PB') {
|
|
||||||
proj_total--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//timing
|
|
||||||
ms = ms * mcopy.loop;
|
|
||||||
if (ms < 2000) {
|
|
||||||
$('#seq_stats .timing span').text(ms + 'ms');
|
|
||||||
} else {
|
|
||||||
$('#seq_stats .timing span').text(humanizeDuration(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
//ending frames
|
|
||||||
cam_total = cam_total * mcopy.loop;
|
|
||||||
proj_total = proj_total * mcopy.loop;
|
|
||||||
|
|
||||||
$('#seq_stats .cam_end span').text(gui.fmtZero(mcopy.state.camera.pos + cam_total, 6));
|
|
||||||
$('#seq_stats .proj_end span').text(gui.fmtZero(mcopy.state.projector.pos + proj_total, 6));
|
|
||||||
|
|
||||||
//count
|
|
||||||
$('#seq_stats .seq_count span').text(real_total.length * mcopy.loop);
|
|
||||||
return ms;
|
|
||||||
};
|
|
||||||
seq.clear = function () {
|
|
||||||
'use strict';
|
|
||||||
mcopy.state.sequence.size = 24;
|
|
||||||
mcopy.state.sequence.arr = [];
|
|
||||||
};
|
|
||||||
seq.exec = function (arr) {
|
|
||||||
'use strict';
|
|
||||||
seq.running = true;
|
|
||||||
seq.state.len = arr.length;
|
|
||||||
//setup queue
|
|
||||||
seq.queue = arr;
|
|
||||||
//console.dir(arr);
|
|
||||||
gui.overlay(true);
|
|
||||||
gui.spinner(true, `Running sequence of ${arr.length} frame${(arr.length === 1 ? '' : 's')}`, 0);
|
|
||||||
log.info(`Sequence started`, 'SEQUENCE', true);
|
|
||||||
seq.step();
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.execStop = function (msg) {
|
|
||||||
'use strict';
|
|
||||||
gui.overlay(false);
|
|
||||||
gui.spinner(false);
|
|
||||||
log.info(`Sequence ${msg}`, 'SEQUENCE', true);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.step = function () {
|
|
||||||
'use strict';
|
|
||||||
let elem;
|
|
||||||
let c;
|
|
||||||
let rgb;
|
|
||||||
let current;
|
|
||||||
let max;
|
|
||||||
|
|
||||||
if (!seq.running) {
|
|
||||||
return seq.execStop('stopped');
|
|
||||||
}
|
|
||||||
|
|
||||||
return setTimeout(() => {
|
|
||||||
elem = seq.queue.shift();
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
c = elem.cmd;
|
|
||||||
if (typeof elem.light !== 'undefined') {
|
|
||||||
rgb = elem.light.split(',');
|
|
||||||
} else {
|
|
||||||
rgb = light.color;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return seq.execStop('completed');
|
|
||||||
}
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
current = seq.state.len - seq.queue.length;
|
|
||||||
max = seq.state.len;
|
|
||||||
gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100);
|
|
||||||
log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true);
|
|
||||||
if (c === 'CF'){
|
|
||||||
cmd.cam_forward(rgb, seq.step);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
cmd.cam_backward(rgb, seq.step);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(seq.step);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(seq.step);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(seq.step);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(seq.step);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
};
|
|
||||||
|
|
||||||
// FROM SERVER SIDE
|
|
||||||
proj.state = {
|
|
||||||
dir : true, //default dir
|
|
||||||
digital : false
|
|
||||||
}
|
|
||||||
proj.init = function () {
|
|
||||||
proj.listen()
|
|
||||||
}
|
|
||||||
proj.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_backward
|
|
||||||
}
|
|
||||||
proj.state.dir = dir
|
|
||||||
if (proj.state.digital) {
|
|
||||||
dig.set(dir)
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
proj.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.projector
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
try {
|
|
||||||
ms = await dig.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(mcopy.cfg.arduino.cmd.projector, id, ms)
|
|
||||||
}
|
|
||||||
proj.listen = function () {
|
|
||||||
ipcMain.on('proj', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.val !== 'undefined') {
|
|
||||||
dig.state.frame = arg.val
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('digital', proj.connectDigital)
|
|
||||||
}
|
|
||||||
proj.end = async function (cmd, id, ms) {
|
|
||||||
let message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.proj_forward) {
|
|
||||||
message = 'Projector set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.proj_backward) {
|
|
||||||
message = 'Projector set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.projector) {
|
|
||||||
message = 'Projector '
|
|
||||||
if (proj.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'PROJECTOR', true, true)
|
|
||||||
return await mainWindow.webContents.send('proj', {cmd: cmd, id : id, ms: ms})
|
|
||||||
}
|
|
||||||
proj.connectDigital = async function (evt, arg) {
|
|
||||||
let info;
|
|
||||||
let frames = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
info = await ffprobe.info(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
frames = await ffprobe.frames(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.state.frame = 0;
|
|
||||||
dig.state.path = arg.path;
|
|
||||||
dig.state.fileName = arg.fileName;
|
|
||||||
dig.state.frames = frames;
|
|
||||||
dig.state.info = info;
|
|
||||||
|
|
||||||
//console.dir(dig.state);
|
|
||||||
|
|
||||||
log.info(`Opened ${dig.state.fileName}`, 'DIGITAL', true, true);
|
|
||||||
log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
|
||||||
proj.digital = true;
|
|
||||||
return await mainWindow.webContents.send('digital', { valid : true, state : JSON.stringify(dig.state) });
|
|
||||||
}
|
|
||||||
|
|
||||||
const dig = {};
|
|
||||||
dig.state = {
|
|
||||||
frame : 0,
|
|
||||||
frames : 0,
|
|
||||||
path : null,
|
|
||||||
fileName : null,
|
|
||||||
info : {},
|
|
||||||
dir : true
|
|
||||||
};
|
|
||||||
|
|
||||||
dig.set = function (dir) {
|
|
||||||
dig.state.dir = dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.move = async function () {
|
|
||||||
let start = +new Date()
|
|
||||||
let last = dig.state.dir + 0;
|
|
||||||
if (dig.state.dir) {
|
|
||||||
dig.state.frame++
|
|
||||||
} else {
|
|
||||||
dig.state.frame--
|
|
||||||
}
|
|
||||||
if (dig.state.frame < 1) {
|
|
||||||
dig.state.frame = 1
|
|
||||||
}
|
|
||||||
return (+new Date()) - start
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.start = async function () {
|
|
||||||
try {
|
|
||||||
await ffmpeg.clearAll()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ffmpeg.frame(dig.state, light.state)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
display.start(dig.state.frame)
|
|
||||||
await delay(20)
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.end = async function () {
|
|
||||||
await delay(20)
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.intval = null
|
|
||||||
cam.state = {
|
|
||||||
dir : true //default dir
|
|
||||||
}
|
|
||||||
cam.init = function () {
|
|
||||||
cam.listen()
|
|
||||||
}
|
|
||||||
cam.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_backward
|
|
||||||
}
|
|
||||||
cam.state.dir = dir
|
|
||||||
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.setDir(dir)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.camera
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.start()
|
|
||||||
}
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.end()
|
|
||||||
}
|
|
||||||
log.info('Camera move time', { ms })
|
|
||||||
return cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.exposure = function (exposure, id) {
|
|
||||||
let cmd = 'E'
|
|
||||||
cam.intval.setExposure('camera', exposure, ms => {
|
|
||||||
cam.end(cmd, id, ms)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.connectIntval = async function (event, arg) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (arg.connect) {
|
|
||||||
cam.intval = new Intval(arg.url)
|
|
||||||
cam.intval.connect((err, ms, state) => {
|
|
||||||
if (err) {
|
|
||||||
mainWindow.webContents.send('intval', { connected : false })
|
|
||||||
log.info(`Cannot connect to ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
cam.intval = null
|
|
||||||
delete cam.intval
|
|
||||||
} else {
|
|
||||||
mainWindow.webContents.send('intval', { connected : true, url : arg.url, state : state })
|
|
||||||
log.info(`Connected to INTVAL3 @ ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
settings.update('camera', { intval : arg.url })
|
|
||||||
settings.save()
|
|
||||||
dev.remember('intval', arg.url, 'camera')
|
|
||||||
}
|
|
||||||
return resolve(true)
|
|
||||||
})
|
|
||||||
} else if (arg.disconnect) {
|
|
||||||
cam.intval = null
|
|
||||||
return resolve(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.listen = function () {
|
|
||||||
ipcMain.on('cam', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('intval', cam.connectIntval)
|
|
||||||
}
|
|
||||||
cam.end = async function (cmd, id, ms) {
|
|
||||||
var message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.cam_forward) {
|
|
||||||
message = 'Camera set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.cam_backward) {
|
|
||||||
message = 'Camera set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.camera) {
|
|
||||||
message = 'Camera '
|
|
||||||
if (cam.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'CAMERA', true, true)
|
|
||||||
mainWindow.webContents.send('cam', {cmd: cmd, id : id, ms: ms})
|
|
||||||
};
|
|
||||||
|
|
||||||
const seq = {};
|
|
||||||
seq.init = function () {
|
|
||||||
seq.listen();
|
|
||||||
}
|
|
||||||
|
|
||||||
seq.listen = function () {
|
|
||||||
ipcMain.on('seq', async (evt, arg) => {
|
|
||||||
if (arg.action === 'stop' && proj.digital) {
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
class Sequence {
|
class Sequence {
|
||||||
constructor(cfg, cmd) {
|
constructor(cfg, cmd) {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
|
@ -594,6 +19,7 @@ class Sequence {
|
||||||
* Stop the sequence
|
* Stop the sequence
|
||||||
**/
|
**/
|
||||||
stop() {
|
stop() {
|
||||||
|
this.running = false;
|
||||||
}
|
}
|
||||||
exec() {
|
exec() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sequence/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,GAAS,CAAC;AACd,IAAI,GAAc,CAAC;AAEnB,eAAe;AAEf;;;;;;;;;;;;;;QAcQ;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC;AACd,IAAI,GAAc,CAAC;AAEnB,MAAM,QAAQ;IAOb,YAAa,GAAS,EAAE,GAAS;QAChC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IACD,wBAAwB;IACjB,IAAI;IAEX,CAAC;IACD,KAAK;IACE,KAAK;IAEZ,CAAC;IACD,KAAK;IACE,KAAK;IAEZ,CAAC;IACD;;QAEI;IACG,IAAI;QACV,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC;IAEM,IAAI;IAEX,CAAC;IAEM,QAAQ;IAEf,CAAC;IAED,SAAS;IACD,GAAG;IAEX,CAAC;IACO,IAAI;IAEZ,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,GAAS,EAAE,GAAS,EAAE,CAAO;IACvD,GAAG,GAAG,CAAC,CAAC;IACR,GAAG,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAA"}
|
|
@ -46,13 +46,13 @@ class Server {
|
||||||
mcopy.log('Receiving command from mobile: ' + req.params.cmd);
|
mcopy.log('Receiving command from mobile: ' + req.params.cmd);
|
||||||
cmd = req.params.cmd;
|
cmd = req.params.cmd;
|
||||||
if (cmd === 'CF'){
|
if (cmd === 'CF'){
|
||||||
mcopy.cmd.cam_forward(success);
|
mcopy.cmd.camera_forward(success);
|
||||||
} else if (cmd === 'CB') {
|
} else if (cmd === 'CB') {
|
||||||
mcopy.cmd.cam_backward(success);
|
mcopy.cmd.camera_backward(success);
|
||||||
} else if (cmd === 'PF') {
|
} else if (cmd === 'PF') {
|
||||||
mcopy.cmd.proj_forward(success);
|
mcopy.cmd.projector_forward(success);
|
||||||
} else if (cmd === 'PB') {
|
} else if (cmd === 'PB') {
|
||||||
mcopy.cmd.proj_backward(success);
|
mcopy.cmd.projector_backward(success);
|
||||||
} else {
|
} else {
|
||||||
mcopy.mobile.fail(res, 'Command ' + cmd + ' not found');
|
mcopy.mobile.fail(res, 'Command ' + cmd + ' not found');
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<a name="Settings"></a>
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
**Kind**: global class
|
||||||
|
|
||||||
|
* [Settings](#Settings)
|
||||||
|
* [.checkDir()](#Settings+checkDir)
|
||||||
|
* [.save()](#Settings+save)
|
||||||
|
* [.update()](#Settings+update)
|
||||||
|
* [.get()](#Settings+get)
|
||||||
|
* [.all()](#Settings+all)
|
||||||
|
* [.restore()](#Settings+restore)
|
||||||
|
* [.reset()](#Settings+reset)
|
||||||
|
|
||||||
|
<a name="Settings+checkDir"></a>
|
||||||
|
|
||||||
|
### settings.checkDir()
|
||||||
|
**Kind**: instance method of [<code>Settings</code>](#Settings)
|
||||||
|
<a name="Settings+save"></a>
|
||||||
|
|
||||||
|
### settings.save()
|
||||||
|
**Kind**: instance method of [<code>Settings</code>](#Settings)
|
||||||
|
<a name="Settings+update"></a>
|
||||||
|
|
||||||
|
### settings.update()
|
||||||
|
**Kind**: instance method of [<code>Settings</code>](#Settings)
|
||||||
|
<a name="Settings+get"></a>
|
||||||
|
|
||||||
|
### settings.get()
|
||||||
|
**Kind**: instance method of [<code>Settings</code>](#Settings)
|
||||||
|
<a name="Settings+all"></a>
|
||||||
|
|
||||||
|
### settings.all()
|
||||||
|
**Kind**: instance method of [<code>Settings</code>](#Settings)
|
||||||
|
<a name="Settings+restore"></a>
|
||||||
|
|
||||||
|
### settings.restore()
|
||||||
|
**Kind**: instance method of [<code>Settings</code>](#Settings)
|
||||||
|
<a name="Settings+reset"></a>
|
||||||
|
|
||||||
|
### settings.reset()
|
||||||
|
**Kind**: instance method of [<code>Settings</code>](#Settings)
|
|
@ -3,6 +3,7 @@ const cam = {};
|
||||||
cam.queue = {};
|
cam.queue = {};
|
||||||
cam.lock = false;
|
cam.lock = false;
|
||||||
cam.id = 'camera';
|
cam.id = 'camera';
|
||||||
|
|
||||||
cam.init = function () {
|
cam.init = function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
cam.listen();
|
cam.listen();
|
||||||
|
@ -54,9 +55,9 @@ cam.move = function (callback) {
|
||||||
};
|
};
|
||||||
cam.end = function (c, id, ms) {
|
cam.end = function (c, id, ms) {
|
||||||
'use strict';
|
'use strict';
|
||||||
if (c === mcopy.cfg.arduino.cmd.cam_forward) {
|
if (c === mcopy.cfg.arduino.cmd.camera_forward) {
|
||||||
mcopy.state.camera.direction = true;
|
mcopy.state.camera.direction = true;
|
||||||
} else if (c === mcopy.cfg.arduino.cmd.cam_backward) {
|
} else if (c === mcopy.cfg.arduino.cmd.camera_backward) {
|
||||||
mcopy.state.camera.direction = false;
|
mcopy.state.camera.direction = false;
|
||||||
} else if (c === mcopy.cfg.arduino.cmd.camera) {
|
} else if (c === mcopy.cfg.arduino.cmd.camera) {
|
||||||
if (mcopy.state.camera.direction) {
|
if (mcopy.state.camera.direction) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ const cmd = {};
|
||||||
*
|
*
|
||||||
* @param {function} callback Function to call after projector moves one frame
|
* @param {function} callback Function to call after projector moves one frame
|
||||||
**/
|
**/
|
||||||
cmd.proj_forward = function (callback) {
|
cmd.projector_forward = function (callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
$('#cmd_proj_forward').removeClass('active');
|
$('#cmd_proj_forward').removeClass('active');
|
||||||
|
@ -30,7 +30,7 @@ cmd.proj_forward = function (callback) {
|
||||||
*
|
*
|
||||||
* @param {function} callback Function to call after projector moves one frame
|
* @param {function} callback Function to call after projector moves one frame
|
||||||
**/
|
**/
|
||||||
cmd.proj_backward = function (callback) {
|
cmd.projector_backward = function (callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
$('#cmd_proj_backward').removeClass('active');
|
$('#cmd_proj_backward').removeClass('active');
|
||||||
|
@ -56,7 +56,7 @@ cmd.proj_backward = function (callback) {
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
* @param {function} callback Function to call after camera moves one frame
|
* @param {function} callback Function to call after camera moves one frame
|
||||||
**/
|
**/
|
||||||
cmd.cam_forward = function (rgb, callback) {
|
cmd.camera_forward = function (rgb, callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var off = [0, 0, 0];
|
var off = [0, 0, 0];
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
|
@ -130,7 +130,7 @@ cmd.black_forward = function (callback) {
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
* @param {function} callback Function to call after camera moves one frame
|
* @param {function} callback Function to call after camera moves one frame
|
||||||
**/
|
**/
|
||||||
cmd.cam_backward = function (rgb, callback) {
|
cmd.camera_backward = function (rgb, callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var off = [0, 0, 0];
|
var off = [0, 0, 0];
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
|
@ -208,33 +208,14 @@ cmd.black_backward = function (callback) {
|
||||||
*
|
*
|
||||||
* @param {function} callback Function to call after action
|
* @param {function} callback Function to call after action
|
||||||
**/
|
**/
|
||||||
cmd.proj2_forward = function (callback) {
|
cmd.projector_second_forward = function (callback) {};
|
||||||
'use strict';
|
cmd.projector_second_backward = function (callback) {};
|
||||||
var res = function (ms) {
|
|
||||||
$('#cmd_proj2_forward').removeClass('active');
|
|
||||||
gui.updateState();
|
|
||||||
if (callback) { callback(ms); }
|
|
||||||
};
|
|
||||||
$('#cmd_proj2_forward').addClass('active');
|
|
||||||
if (!mcopy.state.projector2.direction) {
|
|
||||||
proj.set2(true, function (ms) {
|
|
||||||
setTimeout(function () {
|
|
||||||
proj.move2(res);
|
|
||||||
}, mcopy.cfg.arduino.serialDelay);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setTimeout(function () {
|
|
||||||
proj.move2(res);
|
|
||||||
}, mcopy.cfg.arduino.serialDelay);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
cmd.proj2_backward = function (callback) {};
|
|
||||||
|
|
||||||
cmd.projs_forward = function (callback) {};
|
cmd.projectors_forward = function (callback) {};
|
||||||
cmd.projs_backward = function (callback) {};
|
cmd.projectors_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.proj_forward_proj2_backward = function (callback) {};
|
cmd.projector_forward_projector_second_backward = function (callback) {};
|
||||||
cmd.proj_backward_proj2_forward = function (callback) {};
|
cmd.projector_backward_projector_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"
|
||||||
|
@ -242,7 +223,7 @@ cmd.proj_backward_proj2_forward = function (callback) {};
|
||||||
*
|
*
|
||||||
* @param {object} t HTML input element with the move to val
|
* @param {object} t HTML input element with the move to val
|
||||||
**/
|
**/
|
||||||
cmd.cam_to = function (t) {
|
cmd.camera_to = function (t) {
|
||||||
const raw = $('#move_cam_to').val();
|
const raw = $('#move_cam_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
@ -276,7 +257,7 @@ cmd.cam_to = function (t) {
|
||||||
*
|
*
|
||||||
* @param {object} t HTML input element with the move to val
|
* @param {object} t HTML input element with the move to val
|
||||||
**/
|
**/
|
||||||
cmd.proj_to = function (t) {
|
cmd.projector_to = function (t) {
|
||||||
const raw = $('#move_proj_to').val();
|
const raw = $('#move_proj_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
|
|
@ -219,9 +219,9 @@ devices.digitalCb = function (evt, args) {
|
||||||
gui.notify('DEVICES', `Using video ${state.fileName}`);
|
gui.notify('DEVICES', `Using video ${state.fileName}`);
|
||||||
|
|
||||||
mcopy.state.sequence.arr = ['PF', 'CF'];
|
mcopy.state.sequence.arr = ['PF', 'CF'];
|
||||||
gui.grid.setLight(1, color);
|
grid.setLight(1, color);
|
||||||
gui.grid.state(0);
|
grid.state(0);
|
||||||
gui.grid.state(1);
|
grid.state(1);
|
||||||
|
|
||||||
if (light.disabled) {
|
if (light.disabled) {
|
||||||
light.enable();
|
light.enable();
|
||||||
|
|
|
@ -188,282 +188,4 @@ gui.warn = function (title, message) {
|
||||||
};
|
};
|
||||||
gui.error = function () {};
|
gui.error = function () {};
|
||||||
|
|
||||||
/******
|
|
||||||
Sequencer grid
|
|
||||||
*******/
|
|
||||||
gui.grid = {};
|
|
||||||
gui.grid.swatchesElem = {};
|
|
||||||
gui.grid.init = function () {
|
|
||||||
'use strict';
|
|
||||||
gui.grid.refresh();
|
|
||||||
seq.stats();
|
|
||||||
gui.grid.events();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a specific grid pad to the state stored in the sequence
|
|
||||||
* array at that step
|
|
||||||
*
|
|
||||||
* @param {integer} i Step in sequence
|
|
||||||
**/
|
|
||||||
gui.grid.state = function (i) {
|
|
||||||
'use strict';
|
|
||||||
const elem = $(`input[x=${i}]`);
|
|
||||||
const lightElem = $(`.L[x=${i}]`);
|
|
||||||
if (typeof mcopy.state.sequence.arr[i] !== 'undefined') {
|
|
||||||
elem.prop('checked', false);
|
|
||||||
$(`.${mcopy.state.sequence.arr[i]}[x=${i}]`).prop('checked', true);
|
|
||||||
if (mcopy.state.sequence.arr[i] === 'CF' || mcopy.state.sequence.arr[i] === 'CB') {
|
|
||||||
lightElem.css('background', `rgb(${mcopy.state.sequence.light[i]})`)
|
|
||||||
.addClass('a')
|
|
||||||
.prop('title', `rgb(${mcopy.state.sequence.light[i]})`);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
lightElem.css('background', 'transparent')
|
|
||||||
.removeClass('a')
|
|
||||||
.prop('title', '');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lightElem.css('background', 'transparent')
|
|
||||||
.removeClass('a')
|
|
||||||
.prop('title', '');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Clears the UI of the grid and restores it to the
|
|
||||||
* state of the sequence.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
gui.grid.refresh = function () {
|
|
||||||
'use strict';
|
|
||||||
const cmds = ['cam_forward', 'proj_forward', 'cam_backward', 'proj_backward', 'light_set', 'numbers'];
|
|
||||||
const check = '<input type="checkbox" x="xxxx" />';
|
|
||||||
const div = '<div x="xxxx"></div>';
|
|
||||||
const width = 970 - 34 + ((940 / 24) * Math.abs(24 - mcopy.state.sequence.size));
|
|
||||||
let elem;
|
|
||||||
|
|
||||||
$('#sequence').width(`${width}px`);
|
|
||||||
for (let i = 0; i < cmds.length; i++) {
|
|
||||||
$('#' + cmds[i]).empty();
|
|
||||||
for (let x = 0; x < mcopy.state.sequence.size; x++) {
|
|
||||||
if (i === cmds.length - 1) {
|
|
||||||
elem = div.replace('xxxx', x);
|
|
||||||
$('#' + cmds[i]).append($(elem).text(x));
|
|
||||||
} else if (i === cmds.length - 2) {
|
|
||||||
elem = div.replace('xxxx', x);
|
|
||||||
$('#' + cmds[i]).append($(elem).addClass(mcopy.state.sequence.pads[cmds[i]]));
|
|
||||||
} else {
|
|
||||||
elem = check.replace('xxxx', x);
|
|
||||||
$('#' + cmds[i]).append($(elem).addClass(mcopy.state.sequence.pads[cmds[i]]));
|
|
||||||
}
|
|
||||||
gui.grid.state(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Function bound to click on grid pad elements
|
|
||||||
*
|
|
||||||
* @param {object} t This, passed from clicked element
|
|
||||||
**/
|
|
||||||
gui.grid.click = function (t) {
|
|
||||||
'use strict';
|
|
||||||
const i = parseInt($(t).attr('x'));
|
|
||||||
let c;
|
|
||||||
if ($(t).prop('checked')) {
|
|
||||||
c = $(t).attr('class').replace('.', '');
|
|
||||||
mcopy.state.sequence.arr[i] = c;
|
|
||||||
if (c === 'CF' || c === 'CB') {
|
|
||||||
mcopy.state.sequence.light[i] = light.color.join(',');
|
|
||||||
} else {
|
|
||||||
mcopy.state.sequence.light[i] = '';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mcopy.state.sequence.arr[i] = undefined;
|
|
||||||
delete mcopy.state.sequence.arr[i];
|
|
||||||
}
|
|
||||||
gui.grid.state(i);
|
|
||||||
seq.stats();
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Clears the state of the sequence and then refreshes
|
|
||||||
* the grid and then recalculates the stats on the sequence
|
|
||||||
**/
|
|
||||||
gui.grid.clear = function () {
|
|
||||||
'use strict';
|
|
||||||
const doit = confirm('Are you sure you want to clear this sequence?');
|
|
||||||
if (doit) {
|
|
||||||
seq.clear();
|
|
||||||
gui.grid.refresh();
|
|
||||||
seq.stats();
|
|
||||||
console.log('Sequencer cleared');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Function bound to the change event on the loop counter
|
|
||||||
* input element
|
|
||||||
*
|
|
||||||
* @param {object} t This, passed from changed element
|
|
||||||
*/
|
|
||||||
gui.grid.loopChange = function (t) {
|
|
||||||
'use strict';
|
|
||||||
const count = parseInt(t.value);
|
|
||||||
mcopy.loop = count;
|
|
||||||
seq.stats();
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Add 24 frames to the sequence in the GUI
|
|
||||||
**/
|
|
||||||
gui.grid.plus_24 = function () {
|
|
||||||
'use strict';
|
|
||||||
mcopy.state.sequence.size += 24;
|
|
||||||
gui.grid.refresh();
|
|
||||||
console.log(`Sequencer expanded to ${mcopy.state.sequence.size} steps`);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Set the light value at a specific step and then update
|
|
||||||
* GUI grid via .state()
|
|
||||||
*
|
|
||||||
* @param {integer} x Step in sequence
|
|
||||||
* @param {array} rgb Light value in RGB
|
|
||||||
**/
|
|
||||||
gui.grid.setLight = function (x, rgb) {
|
|
||||||
'use strict';
|
|
||||||
mcopy.state.sequence.light[x] = rgb.join(',');
|
|
||||||
gui.grid.state(x);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Set light value to black (0,0,0) when double clicked
|
|
||||||
*
|
|
||||||
* @param {object} t This, passed from clicked element
|
|
||||||
**/
|
|
||||||
gui.grid.blackout = function (t) {
|
|
||||||
const elem = $(t);
|
|
||||||
const i = elem.attr('x');
|
|
||||||
if (typeof mcopy.state.sequence.light[i] === 'undefined') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (mcopy.state.sequence.light[i] === '0,0,0') {
|
|
||||||
gui.grid.setLight(i, light.color);
|
|
||||||
} else {
|
|
||||||
gui.grid.setLight(i, [0, 0, 0]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change all lights at all camera commands to a specific
|
|
||||||
* RGB value
|
|
||||||
*
|
|
||||||
* @param {array} rgb RGB value [255. 255, 255]
|
|
||||||
*/
|
|
||||||
gui.grid.changeAll = function (rgb) {
|
|
||||||
'use strict';
|
|
||||||
for (let [i, c] of mcopy.state.sequence.arr.entries()) {
|
|
||||||
if (c === 'CF' || c === 'CB') {
|
|
||||||
gui.grid.setLight(i, rgb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Display color swatch modal for selection of light
|
|
||||||
* color value at specific step
|
|
||||||
*
|
|
||||||
* @param {integer} x Position in sequence to change value
|
|
||||||
**/
|
|
||||||
gui.grid.swatches = function (x) {
|
|
||||||
'use strict';
|
|
||||||
const current = mcopy.state.sequence.light[x];
|
|
||||||
gui.grid.swatchesElem = w2popup.open({
|
|
||||||
title : 'Select Color',
|
|
||||||
body : $('#light-swatches').html(),
|
|
||||||
buttons : '<button id="sequencer-ok" class="btn btn-default">Ok</button> <button id="sequencer-changeall" class="btn btn-warning">Change All</button> <button id="sequencer-cancel" class="btn btn-default">Cancel</button>',
|
|
||||||
onClose : () => {}
|
|
||||||
});
|
|
||||||
$('.w2ui-msg-body .swatch').removeClass('default set');
|
|
||||||
$(`.w2ui-msg-body .swatch[color="${current}"`).eq(0).addClass('default set');
|
|
||||||
|
|
||||||
$('#sequencer-cancel').on('click', gui.grid.swatchesElem.close);
|
|
||||||
$('#sequencer-changeall').on('click', function () {
|
|
||||||
const doit = confirm('You sure you want to change all light settings?');
|
|
||||||
const elem = $('.w2ui-msg-body .default');
|
|
||||||
let rgb;
|
|
||||||
if (doit && elem.length > 0) {
|
|
||||||
rgb = elem.attr('color').split(',');
|
|
||||||
gui.grid.changeAll(rgb);
|
|
||||||
gui.grid.swatchesElem.close();
|
|
||||||
} else if (doit && elem.length === 0) {
|
|
||||||
gui.warn('Select Color', 'Please select a color to proceed.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('#sequencer-ok').on('click', function () {
|
|
||||||
var elem = $('.w2ui-msg-body .default'),
|
|
||||||
rgb;
|
|
||||||
if (elem.length > 0) {
|
|
||||||
rgb = elem.attr('color').split(',');
|
|
||||||
gui.grid.setLight(x, rgb);
|
|
||||||
light.color = rgb;
|
|
||||||
gui.grid.swatchesElem.close();
|
|
||||||
} else {
|
|
||||||
gui.warn('Select Color', 'Please select a color to proceed.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scroll the grid to a specific step
|
|
||||||
*
|
|
||||||
* @param {integer} i Step to scroll to
|
|
||||||
**/
|
|
||||||
gui.grid.scrollTo = function (i) {
|
|
||||||
'use strict';
|
|
||||||
var w = 35 + 3; //width of pad + margin
|
|
||||||
$('#seq_scroll').scrollLeft(i * w);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bind all events to sequence. Re-evaluate this in search
|
|
||||||
* of memory leak issues with long sequences.
|
|
||||||
**/
|
|
||||||
gui.grid.events = function () {
|
|
||||||
'use strict';
|
|
||||||
$(document.body).on('click', '#sequencer input[type=checkbox]', function () {
|
|
||||||
gui.grid.click(this);
|
|
||||||
});
|
|
||||||
//$(document.body).on('click', '.L', function () {
|
|
||||||
//alert('click');
|
|
||||||
//console.log('please dont happen');
|
|
||||||
//});
|
|
||||||
$(document.body).on('dblclick', '.L', function () {
|
|
||||||
gui.grid.blackout(this);
|
|
||||||
});
|
|
||||||
$(document.body).on('contextmenu', '.L', function (e) {
|
|
||||||
var x = e.target.attributes.x.value;
|
|
||||||
setTimeout(function () {
|
|
||||||
gui.grid.swatches(x);
|
|
||||||
}, 300);
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$('#seq_scroll').on('scroll', function () {
|
|
||||||
var i = Math.ceil($('#seq_scroll').scrollLeft() / (35 + 3));
|
|
||||||
$('#seq_scroll_state').val(gui.fmtZero(i, 6));
|
|
||||||
});
|
|
||||||
$('#seq_scroll_state').on('change', function () {
|
|
||||||
var i = parseInt($(this).val());
|
|
||||||
$(this).val(gui.fmtZero(i, 6));
|
|
||||||
gui.grid.scrollTo(i);
|
|
||||||
});
|
|
||||||
$(document.body).on('click', '.w2ui-msg-body .swatch', function () {
|
|
||||||
var color = $(this).attr('color'),
|
|
||||||
title = $(this).attr('title');
|
|
||||||
if (typeof color !== 'undefined') {
|
|
||||||
color = color.split(',');
|
|
||||||
$('.w2ui-msg-body .swatch').removeClass('default set');
|
|
||||||
$('#light-swatches .swatch').removeClass('default set');
|
|
||||||
$(this).addClass('default set');
|
|
||||||
$('#light-swatches .swatch[title="' + title + '"]').eq(0).addClass('default set');
|
|
||||||
light.color = color;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = gui;
|
module.exports = gui;
|
|
@ -82,7 +82,7 @@ mse.mscript.toGUI = function () {
|
||||||
} else {
|
} else {
|
||||||
mcopy.state.sequence.light[i] = '';
|
mcopy.state.sequence.light[i] = '';
|
||||||
}
|
}
|
||||||
gui.grid.state(i);
|
grid.state(i);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mse.mscript.toSequence = function () {
|
mse.mscript.toSequence = function () {
|
||||||
|
@ -96,7 +96,7 @@ mse.mscript.toSequence = function () {
|
||||||
mse.console.print(`Sending compiled script to GUI sequencer...`);
|
mse.console.print(`Sending compiled script to GUI sequencer...`);
|
||||||
seq.clear();
|
seq.clear();
|
||||||
mse.mscript.toGUI();
|
mse.mscript.toGUI();
|
||||||
gui.grid.refresh();
|
grid.refresh();
|
||||||
seq.stats();
|
seq.stats();
|
||||||
return nav.change('sequencer');
|
return nav.change('sequencer');
|
||||||
})
|
})
|
||||||
|
@ -105,7 +105,7 @@ mse.mscript.toSequence = function () {
|
||||||
mse.console.print(`Sending compiled script to GUI sequencer...`);
|
mse.console.print(`Sending compiled script to GUI sequencer...`);
|
||||||
seq.clear();
|
seq.clear();
|
||||||
mse.mscript.toGUI();
|
mse.mscript.toGUI();
|
||||||
gui.grid.refresh();
|
grid.refresh();
|
||||||
seq.stats();
|
seq.stats();
|
||||||
return nav.change('sequencer');
|
return nav.change('sequencer');
|
||||||
}
|
}
|
||||||
|
@ -196,9 +196,9 @@ mse.console.exec = function () {
|
||||||
mse.console.newLine();
|
mse.console.newLine();
|
||||||
if (mscript.cmd.indexOf(command) !== -1) {
|
if (mscript.cmd.indexOf(command) !== -1) {
|
||||||
if (command === 'CF') {
|
if (command === 'CF') {
|
||||||
cmd.cam_forward(light.color);
|
cmd.camera_forward(light.color);
|
||||||
} else if (cmd === 'CB') {
|
} else if (cmd === 'CB') {
|
||||||
cmd.cam_backward(light.color);
|
cmd.camera_backward(light.color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ proj.queue = {};
|
||||||
proj.lock = false;
|
proj.lock = false;
|
||||||
proj.lock2 = false;
|
proj.lock2 = false;
|
||||||
proj.id = 'projector';
|
proj.id = 'projector';
|
||||||
|
|
||||||
proj.init = function () {
|
proj.init = function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
proj.listen();
|
proj.listen();
|
||||||
|
@ -44,69 +45,11 @@ proj.move = function (callback) {
|
||||||
proj.queue[obj.id] = obj;
|
proj.queue[obj.id] = obj;
|
||||||
proj.lock = true;
|
proj.lock = true;
|
||||||
};
|
};
|
||||||
proj.set2 = function (dir, callback) {
|
|
||||||
'use strict';
|
|
||||||
var obj;
|
|
||||||
if (proj.lock2) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj = {
|
|
||||||
dir : dir,
|
|
||||||
second : true,
|
|
||||||
id : uuid.v4()
|
|
||||||
};
|
|
||||||
ipcRenderer.sendSync(proj.id, obj);
|
|
||||||
|
|
||||||
if (typeof callback !== 'undefined') {
|
|
||||||
obj.callback = callback;
|
|
||||||
}
|
|
||||||
proj.queue[obj.id] = obj;
|
|
||||||
proj.lock2 = true;
|
|
||||||
};
|
|
||||||
proj.move2 = function (callback) {
|
|
||||||
'use strict';
|
|
||||||
var obj;
|
|
||||||
if (proj2.lock) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj = {
|
|
||||||
frame : true,
|
|
||||||
second : true,
|
|
||||||
id : uuid.v4()
|
|
||||||
};
|
|
||||||
ipcRenderer.sendSync(proj.id, obj);
|
|
||||||
|
|
||||||
if (typeof callback !== 'undefined') {
|
|
||||||
obj.callback = callback;
|
|
||||||
}
|
|
||||||
proj.queue[obj.id] = obj;
|
|
||||||
proj.lock2 = true;
|
|
||||||
};
|
|
||||||
proj.both = function (callback) {
|
|
||||||
'use strict';
|
|
||||||
var obj;
|
|
||||||
if (proj.lock || proj2.lock) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
obj = {
|
|
||||||
frame : true,
|
|
||||||
both : true,
|
|
||||||
id : uuid.v4()
|
|
||||||
};
|
|
||||||
ipcRenderer.sendSync(proj.id, obj);
|
|
||||||
|
|
||||||
if (typeof callback !== 'undefined') {
|
|
||||||
obj.callback = callback;
|
|
||||||
}
|
|
||||||
proj.queue[obj.id] = obj;
|
|
||||||
proj.lock = true;
|
|
||||||
proj.lock2 = true;
|
|
||||||
}
|
|
||||||
proj.end = function (c, id, ms) {
|
proj.end = function (c, id, ms) {
|
||||||
'use strict';
|
'use strict';
|
||||||
if (c === mcopy.cfg.arduino.cmd.proj_forward) {
|
if (c === mcopy.cfg.arduino.cmd.projector_forward) {
|
||||||
mcopy.state.projector.direction = true;
|
mcopy.state.projector.direction = true;
|
||||||
} else if (c === mcopy.cfg.arduino.cmd.proj_backward) {
|
} else if (c === mcopy.cfg.arduino.cmd.projector_backward) {
|
||||||
mcopy.state.projector.direction = false;
|
mcopy.state.projector.direction = false;
|
||||||
} else if (c === mcopy.cfg.arduino.cmd.projector) {
|
} else if (c === mcopy.cfg.arduino.cmd.projector) {
|
||||||
if (mcopy.state.projector.direction) {
|
if (mcopy.state.projector.direction) {
|
||||||
|
|
|
@ -11,11 +11,11 @@ mcopy.loop = 1;
|
||||||
mcopy.loopCount = 0;
|
mcopy.loopCount = 0;
|
||||||
|
|
||||||
seq.cmd = {
|
seq.cmd = {
|
||||||
cam_forward : 'CF',
|
camera_forward : 'CF',
|
||||||
cam_backward : 'CB',
|
camera_backward : 'CB',
|
||||||
|
|
||||||
proj_forward : 'PF',
|
projector_forward : 'PF',
|
||||||
proj_backward : 'PB',
|
projector_backward : 'PB',
|
||||||
|
|
||||||
black_forward : 'BF',
|
black_forward : 'BF',
|
||||||
black_backward : 'BB',
|
black_backward : 'BB',
|
||||||
|
@ -24,20 +24,20 @@ seq.cmd = {
|
||||||
cam2_forward : 'C2F',
|
cam2_forward : 'C2F',
|
||||||
cam2_backward : 'C2B',
|
cam2_backward : 'C2B',
|
||||||
|
|
||||||
cams_forward : 'CCF',
|
cameras_forward : 'CCF',
|
||||||
cams_forward : 'CCB',
|
cameras_forward : 'CCB',
|
||||||
|
|
||||||
cam_forward_cam2_backward : 'CFCB',
|
camera_forward_cam2_backward : 'CFCB',
|
||||||
cam_backward_cam2_forward : 'CBCF',
|
camera_backward_cam2_forward : 'CBCF',
|
||||||
|
|
||||||
proj2_forward : 'P2F',
|
proj2_forward : 'P2F',
|
||||||
proj2_backward : 'P2B',
|
proj2_backward : 'P2B',
|
||||||
|
|
||||||
projs_forward : 'PPF',
|
projectors_forward : 'PPF',
|
||||||
projs_backward : 'PPB',
|
projectors_backward : 'PPB',
|
||||||
|
|
||||||
proj_forward_proj2_backward : 'PFPB',
|
projector_forward_proj2_backward : 'PFPB',
|
||||||
proj_backward_proj2_forward : 'PBPF'
|
projector_backward_proj2_forward : 'PBPF'
|
||||||
}
|
}
|
||||||
|
|
||||||
seq.run = function () {
|
seq.run = function () {
|
||||||
|
@ -69,16 +69,16 @@ 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 === seq.cmd.cam_forward){
|
if (c === seq.cmd.camera_forward){
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
||||||
cmd.cam_forward(rgb, action);
|
cmd.camera_forward(rgb, action);
|
||||||
} else if (c === seq.cmd.cam_backward) {
|
} else if (c === seq.cmd.camera_backward) {
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
||||||
cmd.cam_backward(rgb, action);
|
cmd.camera_backward(rgb, action);
|
||||||
} else if (c === seq.cmd.proj_forward) {
|
} else if (c === seq.cmd.projector_forward) {
|
||||||
cmd.proj_forward(action);
|
cmd.projector_forward(action);
|
||||||
} else if (c === seq.cmd.proj_backward) {
|
} else if (c === seq.cmd.projector_backward) {
|
||||||
cmd.proj_backward(action);
|
cmd.projector_backward(action);
|
||||||
} else if (c === seq.cmd.black_forward) {
|
} else if (c === seq.cmd.black_forward) {
|
||||||
cmd.black_forward(action);
|
cmd.black_forward(action);
|
||||||
} else if (c === seq.cmd.black_backward) {
|
} else if (c === seq.cmd.black_backward) {
|
||||||
|
@ -158,12 +158,12 @@ 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 === seq.cmd.cam_forward || c === seq.cmd.cam_backward){
|
if (c === seq.cmd.camera_forward || c === seq.cmd.camera_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 === seq.cmd.proj_forward || c === seq.cmd.proj_backward){
|
if (c === seq.cmd.projector_forward || c === seq.cmd.projector_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;
|
||||||
|
@ -177,16 +177,16 @@ seq.stats = function () {
|
||||||
}
|
}
|
||||||
ms += mcopy.cfg.arduino.sequenceDelay;
|
ms += mcopy.cfg.arduino.sequenceDelay;
|
||||||
|
|
||||||
if (c === seq.cmd.cam_forward || c === seq.cmd.black_forward) {
|
if (c === seq.cmd.camera_forward || c === seq.cmd.black_forward) {
|
||||||
cam_total++;
|
cam_total++;
|
||||||
}
|
}
|
||||||
if (c === seq.cmd.cam_backward || c === seq.cmd.black_backward) {
|
if (c === seq.cmd.camera_backward || c === seq.cmd.black_backward) {
|
||||||
cam_total--;
|
cam_total--;
|
||||||
}
|
}
|
||||||
if (c === seq.cmd.proj_forward) {
|
if (c === seq.cmd.projector_forward) {
|
||||||
proj_total++;
|
proj_total++;
|
||||||
}
|
}
|
||||||
if (c === seq.cmd.proj_backward) {
|
if (c === seq.cmd.projector_backward) {
|
||||||
proj_total--;
|
proj_total--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,14 +280,14 @@ 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 === seq.cmd.cam_forward){
|
if (c === seq.cmd.camera_forward){
|
||||||
cmd.cam_forward(rgb, seq.step);
|
cmd.camera_forward(rgb, seq.step);
|
||||||
} else if (c === seq.cmd.cam_backward) {
|
} else if (c === seq.cmd.camera_backward) {
|
||||||
cmd.cam_backward(rgb, seq.step);
|
cmd.camera_backward(rgb, seq.step);
|
||||||
} else if (c === seq.cmd.proj_forward) {
|
} else if (c === seq.cmd.projector_forward) {
|
||||||
cmd.proj_forward(seq.step);
|
cmd.projector_forward(seq.step);
|
||||||
} else if (c === seq.cmd.proj_backward) {
|
} else if (c === seq.cmd.projector_backward) {
|
||||||
cmd.proj_backward(seq.step);
|
cmd.projector_backward(seq.step);
|
||||||
} else if (c === seq.cmd.black_forward) {
|
} else if (c === seq.cmd.black_forward) {
|
||||||
cmd.black_forward(seq.step);
|
cmd.black_forward(seq.step);
|
||||||
} else if (c === seq.cmd.black_backward) {
|
} else if (c === seq.cmd.black_backward) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ const moment = require('moment');
|
||||||
const humanizeDuration = require('humanize-duration');
|
const humanizeDuration = require('humanize-duration');
|
||||||
const cfg = require('./data/cfg.json');
|
const cfg = require('./data/cfg.json');
|
||||||
const gui = require('./lib/ui');
|
const gui = require('./lib/ui');
|
||||||
|
const grid = require('./lib/ui/grid.js');
|
||||||
const light = require('./lib/ui/light.js');
|
const light = require('./lib/ui/light.js');
|
||||||
const proj = require('./lib/ui/proj.js');
|
const proj = require('./lib/ui/proj.js');
|
||||||
const cam = require('./lib/ui/cam.js');
|
const cam = require('./lib/ui/cam.js');
|
||||||
|
@ -89,7 +90,7 @@ async function init () {
|
||||||
log = await require('log')({})
|
log = await require('log')({})
|
||||||
|
|
||||||
nav.init();
|
nav.init();
|
||||||
gui.grid.init();
|
grid.init();
|
||||||
mse.mscript.init();
|
mse.mscript.init();
|
||||||
mse.console.init();
|
mse.console.init();
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,11 @@ class Arduino {
|
||||||
this.lock = false;
|
this.lock = false;
|
||||||
this.locks = {};
|
this.locks = {};
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Enumerate all connected devices that might be Arduinos
|
||||||
|
*
|
||||||
|
* @returns {Promise} Resolves after enumerating
|
||||||
|
**/
|
||||||
async enumerate() {
|
async enumerate() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
return SerialPort.list((err, ports) => {
|
return SerialPort.list((err, ports) => {
|
||||||
|
@ -200,22 +205,22 @@ class Arduino {
|
||||||
confirmEnd(data) {
|
confirmEnd(data) {
|
||||||
//console.dir(data)
|
//console.dir(data)
|
||||||
if (data === cfg.arduino.cmd.connect
|
if (data === cfg.arduino.cmd.connect
|
||||||
|| data === cfg.arduino.cmd.proj_identifier
|
|| data === cfg.arduino.cmd.projector_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_identifier
|
|| data === cfg.arduino.cmd.camera_identifier
|
||||||
|| data === cfg.arduino.cmd.light_identifier
|
|| data === cfg.arduino.cmd.light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_light_identifier
|
|| data === cfg.arduino.cmd.projector_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_light_identifier
|
|| data === cfg.arduino.cmd.projector_camera_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_identifier
|
|| data === cfg.arduino.cmd.projector_camera_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_second_identifier
|
|| data === cfg.arduino.cmd.projector_second_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_dual_identifier
|
|| data === cfg.arduino.cmd.projectors_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_second_forward
|
|| data === cfg.arduino.cmd.projector_second_forward
|
||||||
|| data === cfg.arduino.cmd.proj_second_backward
|
|| data === cfg.arduino.cmd.projector_second_backward
|
||||||
|| data === cfg.arduino.cmd.projector_second
|
|| data === cfg.arduino.cmd.projector_second
|
||||||
|| data === cfg.arduino.cmd.projectors
|
|| data === cfg.arduino.cmd.projectors
|
||||||
|| data === cfg.arduino.cmd.cam_second_identifier
|
|| data === cfg.arduino.cmd.camera_second_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_dual_identifier
|
|| data === cfg.arduino.cmd.cameras_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_second_forward
|
|| data === cfg.arduino.cmd.camera_second_forward
|
||||||
|| data === cfg.arduino.cmd.cam_second_backward
|
|| data === cfg.arduino.cmd.camera_second_backward
|
||||||
|| data === cfg.arduino.cmd.camera_second
|
|| data === cfg.arduino.cmd.camera_second
|
||||||
|| data === cfg.arduino.cmd.cameras) {
|
|| data === cfg.arduino.cmd.cameras) {
|
||||||
this.confirmExec(null, data);
|
this.confirmExec(null, data);
|
||||||
|
@ -250,34 +255,34 @@ class Arduino {
|
||||||
let writeSuccess;
|
let writeSuccess;
|
||||||
let type;
|
let type;
|
||||||
this.confirmExec = function (err, data) {
|
this.confirmExec = function (err, data) {
|
||||||
if (data === cfg.arduino.cmd.proj_identifier) {
|
if (data === cfg.arduino.cmd.projector_identifier) {
|
||||||
type = 'projector';
|
type = 'projector';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.cam_identifier) {
|
else if (data === cfg.arduino.cmd.camera_identifier) {
|
||||||
type = 'camera';
|
type = 'camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.light_identifier) {
|
else if (data === cfg.arduino.cmd.light_identifier) {
|
||||||
type = 'light';
|
type = 'light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_light_identifier) {
|
else if (data === cfg.arduino.cmd.projector_light_identifier) {
|
||||||
type = 'projector,light';
|
type = 'projector,light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_cam_light_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_light_identifier) {
|
||||||
type = 'projector,camera,light';
|
type = 'projector,camera,light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_cam_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera';
|
type = 'projector,camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.proj_second_identifier) {
|
else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second';
|
type = 'projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.proj_dual_identifier) {
|
else if (data === cfg.ardino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second';
|
type = 'projector,projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cam_second_identifier) {
|
else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second';
|
type = 'camera_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cam_dual_identifier) {
|
else if (data === cfg.ardino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second';
|
type = 'camera,camera_second';
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
//camera,projector,projector_second
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@ class Camera {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor(arduino, cfg, ui, dig) {
|
constructor(arduino, cfg, ui, dig, second = false) {
|
||||||
this.state = {
|
this.state = {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
dir: true,
|
dir: true,
|
||||||
|
@ -20,6 +20,8 @@ class Camera {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second)
|
||||||
|
this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -44,10 +46,10 @@ class Camera {
|
||||||
let cmd;
|
let cmd;
|
||||||
let ms;
|
let ms;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.cam_forward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd = this.cfg.arduino.cmd.cam_backward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
}
|
}
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
if (this.intval) {
|
if (this.intval) {
|
||||||
|
@ -164,12 +166,18 @@ class Camera {
|
||||||
**/
|
**/
|
||||||
async end(cmd, id, ms) {
|
async end(cmd, id, ms) {
|
||||||
let message = '';
|
let message = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.cam_forward) {
|
if (cmd === this.cfg.arduino.cmd.camera_forward) {
|
||||||
message = 'Camera set to FORWARD';
|
message = 'Camera set to FORWARD';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.cam_backward) {
|
else if (cmd === this.cfg.arduino.cmd.camera_backward) {
|
||||||
message = 'Camera set to BACKWARD';
|
message = 'Camera set to BACKWARD';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camera_second_forward) {
|
||||||
|
message = 'Camera second set to FORWARD';
|
||||||
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camera_second_backward) {
|
||||||
|
message = 'Camera second set to BACKWARD';
|
||||||
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.camera) {
|
else if (cmd === this.cfg.arduino.cmd.camera) {
|
||||||
message = 'Camera ';
|
message = 'Camera ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -180,7 +188,17 @@ class Camera {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
this.log.info(message, 'CAMERA', true, true);
|
else if (cmd === this.cfg.arduino.cmd.camera_second) {
|
||||||
|
message = 'Camera second ';
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message += 'REWOUND';
|
||||||
|
}
|
||||||
|
message += ' 1 frame';
|
||||||
|
}
|
||||||
|
this.log.info(message);
|
||||||
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame forward
|
* Move the projector one frame forward
|
||||||
**/
|
**/
|
||||||
async proj_forward() {
|
async projector_forward() {
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
if (!this.proj.state.dir) {
|
if (!this.proj.state.dir) {
|
||||||
|
@ -30,7 +30,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame backward
|
* Move the projector one frame backward
|
||||||
**/
|
**/
|
||||||
async proj_backward() {
|
async projector_backward() {
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
if (this.proj.state.dir) {
|
if (this.proj.state.dir) {
|
||||||
|
@ -50,7 +50,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
async cam_forward(rgb = [255, 255, 255]) {
|
async camera_forward(rgb = [255, 255, 255]) {
|
||||||
const off = [0, 0, 0];
|
const off = [0, 0, 0];
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
|
@ -98,7 +98,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
async cam_backward(rgb = [255, 255, 255]) {
|
async camera_backward(rgb = [255, 255, 255]) {
|
||||||
const off = [0, 0, 0];
|
const off = [0, 0, 0];
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
|
@ -143,21 +143,21 @@ class Commands {
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
cam2_forward : 'C2F',
|
camera_second_forward : 'C2F',
|
||||||
cam2_backward : 'C2B',
|
camera_second_backward : 'C2B',
|
||||||
|
|
||||||
cams_forward : 'CCF',
|
cameras_forward : 'CCF',
|
||||||
cams_forward : 'CCB',
|
cameras_forward : 'CCB',
|
||||||
|
|
||||||
cam_forward_cam2_backward : 'CFCB',
|
camera_forward_camera_second_backward : 'CFCB',
|
||||||
cam_backward_cam2_forward : 'CBCF',
|
camera_backward_camera_second_forward : 'CBCF',
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Move the secondary projector forward one frame
|
* Move the secondary projector forward one frame
|
||||||
*
|
*
|
||||||
* @param {function} callback Function to call after action
|
* @param {function} callback Function to call after action
|
||||||
**/
|
**/
|
||||||
/*cmd.proj2_forward = function (callback) {
|
/*cmd.projector_second_forward = function (callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
$('#cmd_proj2_forward').removeClass('active');
|
$('#cmd_proj2_forward').removeClass('active');
|
||||||
|
@ -177,20 +177,20 @@ class Commands {
|
||||||
}, mcopy.cfg.arduino.serialDelay);
|
}, mcopy.cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cmd.proj2_backward = function (callback) {};
|
cmd.projector_second_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.projs_forward = function (callback) {};
|
cmd.projectors_forward = function (callback) {};
|
||||||
cmd.projs_backward = function (callback) {};
|
cmd.projectors_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.proj_forward_proj2_backward = function (callback) {};
|
cmd.projector_forward_projector_second_backward = function (callback) {};
|
||||||
cmd.proj_backward_proj2_forward = function (callback) {};
|
cmd.projector_backward_projector_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"
|
||||||
* value. Moves as black frames to prevent multiple exposure.
|
* value. Moves as black frames to prevent multiple exposure.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
async cam_to() {
|
async camera_to() {
|
||||||
/*const raw = $('#move_cam_to').val();
|
/*const raw = $('#move_cam_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
@ -223,7 +223,7 @@ class Commands {
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
async proj_to() {
|
async projector_to() {
|
||||||
/*const raw = $('#move_proj_to').val();
|
/*const raw = $('#move_proj_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cmd/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,QAAQ;IAQb,YAAa,GAAS,E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K,CAAC,CAAC;AAC5C,CAAC,CAAA"}
|
|
@ -296,6 +296,9 @@ class Devices {
|
||||||
return false
|
return false
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
//camera,projector,projector_second
|
||||||
|
//camera,camera_second,projector
|
||||||
|
//camera,camera_second,projector,projector_second
|
||||||
return connectSuccess;
|
return connectSuccess;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -384,7 +387,7 @@ class Devices {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.profile
|
profile: this.settings.state.profile
|
||||||
};
|
};
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second && projector_second.arduino) {
|
||||||
args.projector_second = projector_second;
|
args.projector_second = projector_second;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@ class Projector {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor(arduino, cfg, ui, dig) {
|
constructor(arduino, cfg, ui, dig, second = false) {
|
||||||
this.state = {
|
this.state = {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
dir: true,
|
dir: true,
|
||||||
|
@ -18,6 +18,8 @@ class Projector {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second)
|
||||||
|
this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -41,10 +43,10 @@ class Projector {
|
||||||
let cmd;
|
let cmd;
|
||||||
let ms;
|
let ms;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.proj_forward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd = this.cfg.arduino.cmd.proj_backward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
}
|
}
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
if (this.dig.state.enabled) {
|
if (this.dig.state.enabled) {
|
||||||
|
@ -55,7 +57,7 @@ class Projector {
|
||||||
ms = await this.arduino.send(this.id, cmd);
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.log.error('Error setting projector direction', err);
|
this.log.error(`Error setting ${this.id} direction`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await this.end(cmd, id, ms);
|
return await this.end(cmd, id, ms);
|
||||||
|
@ -79,7 +81,7 @@ class Projector {
|
||||||
ms = await this.arduino.send(this.id, cmd);
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.log.error('Error moving projector', err);
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
this.log.info('Projector move time', { ms });
|
||||||
|
@ -116,12 +118,18 @@ class Projector {
|
||||||
**/
|
**/
|
||||||
async end(cmd, id, ms) {
|
async end(cmd, id, ms) {
|
||||||
let message = '';
|
let message = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.proj_forward) {
|
if (cmd === this.cfg.arduino.cmd.projector_forward) {
|
||||||
message = 'Projector set to FORWARD';
|
message = 'Projector set to FORWARD';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.proj_backward) {
|
else if (cmd === this.cfg.arduino.cmd.projector_backward) {
|
||||||
message = 'Projector set to BACKWARD';
|
message = 'Projector set to BACKWARD';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second_forward) {
|
||||||
|
message = 'Projector second set to FORWARD';
|
||||||
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second_backward) {
|
||||||
|
message = 'Projector second set to BACKWARD';
|
||||||
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.projector) {
|
else if (cmd === this.cfg.arduino.cmd.projector) {
|
||||||
message = 'Projector ';
|
message = 'Projector ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -132,6 +140,16 @@ class Projector {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
|
message = 'Projector second';
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message += 'REWOUND';
|
||||||
|
}
|
||||||
|
message += ' 1 frame';
|
||||||
|
}
|
||||||
this.log.info(message, 'PROJECTOR');
|
this.log.info(message, 'PROJECTOR');
|
||||||
return await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
return await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/proj/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;;AAEjD,2BAA4B;AAE5B,MAAM,SAAS;IAed;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,GAAS;QAjBtD,UAAK,GAAS;YACrB,GAAG,EAAG,CAAC;YACP,GAAG,EAAG,IAAI;YACV,OAAO,EAAG,KAAK;SACf,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAOzB,OAAE,GAAY,WAAW,CAAC;QAMjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAED;;QAEI;IACI,KAAK,C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AO,GAAG,kBAAkB,CAAA;YAC5B,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnB,OAAO,IAAI,UAAU,CAAA;aACrB;iBAAM;gBACN,OAAO,IAAI,SAAS,CAAA;aACpB;YACD,OAAO,IAAI,UAAU,CAAA;SACrB;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QACnC,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC,CAAA;IAChE,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,GAAS;IAC3E,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAA"}
|
|
@ -1,581 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
let log;
|
let log;
|
||||||
let seq;
|
let seq;
|
||||||
//var seq = {};
|
|
||||||
/******
|
|
||||||
Sequence Object
|
|
||||||
|
|
||||||
seq.i = 0;
|
|
||||||
seq.time = 0;
|
|
||||||
seq.stopState = false;
|
|
||||||
|
|
||||||
mcopy.loop = 1; //
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
|
|
||||||
seq.queue = [];
|
|
||||||
seq.running = false;
|
|
||||||
seq.state = {};
|
|
||||||
|
|
||||||
*******/
|
|
||||||
/**
|
|
||||||
* Run the sequence
|
|
||||||
|
|
||||||
seq.run = function () {
|
|
||||||
'use strict';
|
|
||||||
var c = mcopy.state.sequence.arr[seq.i],
|
|
||||||
timeEnd = 0,
|
|
||||||
rgb,
|
|
||||||
action = function () {
|
|
||||||
setTimeout(function () {
|
|
||||||
seq.i++;
|
|
||||||
seq.run();
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
}
|
|
||||||
if (seq.i == 0) {
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
ipcRenderer.send('seq', { action : 'loop' });
|
|
||||||
}
|
|
||||||
if (seq.stop()) {
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
log.info('Sequence stopped', 'SERIAL', true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (seq.i <= mcopy.state.sequence.arr.length && c !== undefined) {
|
|
||||||
log.info('Step ' + seq.i + ' command ' + c, 'SEQUENCE', true);
|
|
||||||
//gui action
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('.row input[x=' + seq.i + ']').addClass('h');
|
|
||||||
$('#numbers div[x=' + seq.i + ']').addClass('h');
|
|
||||||
if (c === 'CF'){
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_forward(rgb, action);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_backward(rgb, action);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(action);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(action);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(action);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(action);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mcopy.loopCount++;
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
if (mcopy.loopCount < mcopy.loop) {
|
|
||||||
log.info('Loop ' + mcopy.loopCount + ' completed', 'SEQUENCE', true);
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
seq.i = 0;
|
|
||||||
seq.run();
|
|
||||||
} else {
|
|
||||||
timeEnd = +new Date();
|
|
||||||
timeEnd = timeEnd - seq.time;
|
|
||||||
if (timeEnd < 2000) {
|
|
||||||
log.info('Sequence completed in ' + timeEnd + 'ms', 'SEQUENCE', true);
|
|
||||||
} else {
|
|
||||||
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true);
|
|
||||||
}
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd));
|
|
||||||
//clear gui
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('#loop_current').text('');
|
|
||||||
seq.stats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
seq.stop = function (state) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof state === 'undefined') {
|
|
||||||
if (seq.stopState === true) {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return seq.stopState;
|
|
||||||
} else {
|
|
||||||
seq.stopState = state;
|
|
||||||
}
|
|
||||||
if (state === false) {
|
|
||||||
mcopy.loopCount = 0
|
|
||||||
$('#loop_current').text('');
|
|
||||||
} else {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return state
|
|
||||||
};
|
|
||||||
seq.init = function (start) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof start === 'undefined') {
|
|
||||||
start = 0;
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
seq.time = +new Date();
|
|
||||||
}
|
|
||||||
seq.stop(false);
|
|
||||||
seq.i = start;
|
|
||||||
|
|
||||||
ipcRenderer.send('seq', { action : 'start' });
|
|
||||||
seq.run();
|
|
||||||
};
|
|
||||||
//!!! redo
|
|
||||||
seq.stats = function () {
|
|
||||||
'use strict';
|
|
||||||
var ms = 0,
|
|
||||||
c = '',
|
|
||||||
cam_total = 0,
|
|
||||||
proj_total = 0,
|
|
||||||
real_total = mcopy.state.sequence.arr.filter(function (elem) {
|
|
||||||
if (elem === undefined) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//timing
|
|
||||||
for (var i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
|
||||||
c = mcopy.state.sequence.arr[i];
|
|
||||||
if (c === 'CF' || c === 'CB'){
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'PF' || c === 'PB'){
|
|
||||||
ms += mcopy.cfg.arduino.proj.time;
|
|
||||||
ms += mcopy.cfg.arduino.proj.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'BF' || c === 'BB'){
|
|
||||||
ms += mcopy.cfg.arduino.black.before;
|
|
||||||
ms += mcopy.cfg.arduino.black.after;
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
ms += mcopy.cfg.arduino.sequenceDelay;
|
|
||||||
|
|
||||||
if (c === 'CF' || c === 'BF') {
|
|
||||||
cam_total++;
|
|
||||||
}
|
|
||||||
if (c === 'CB' || c === 'BB') {
|
|
||||||
cam_total--;
|
|
||||||
}
|
|
||||||
if (c === 'PF') {
|
|
||||||
proj_total++;
|
|
||||||
}
|
|
||||||
if (c === 'PB') {
|
|
||||||
proj_total--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//timing
|
|
||||||
ms = ms * mcopy.loop;
|
|
||||||
if (ms < 2000) {
|
|
||||||
$('#seq_stats .timing span').text(ms + 'ms');
|
|
||||||
} else {
|
|
||||||
$('#seq_stats .timing span').text(humanizeDuration(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
//ending frames
|
|
||||||
cam_total = cam_total * mcopy.loop;
|
|
||||||
proj_total = proj_total * mcopy.loop;
|
|
||||||
|
|
||||||
$('#seq_stats .cam_end span').text(gui.fmtZero(mcopy.state.camera.pos + cam_total, 6));
|
|
||||||
$('#seq_stats .proj_end span').text(gui.fmtZero(mcopy.state.projector.pos + proj_total, 6));
|
|
||||||
|
|
||||||
//count
|
|
||||||
$('#seq_stats .seq_count span').text(real_total.length * mcopy.loop);
|
|
||||||
return ms;
|
|
||||||
};
|
|
||||||
seq.clear = function () {
|
|
||||||
'use strict';
|
|
||||||
mcopy.state.sequence.size = 24;
|
|
||||||
mcopy.state.sequence.arr = [];
|
|
||||||
};
|
|
||||||
seq.exec = function (arr) {
|
|
||||||
'use strict';
|
|
||||||
seq.running = true;
|
|
||||||
seq.state.len = arr.length;
|
|
||||||
//setup queue
|
|
||||||
seq.queue = arr;
|
|
||||||
//console.dir(arr);
|
|
||||||
gui.overlay(true);
|
|
||||||
gui.spinner(true, `Running sequence of ${arr.length} frame${(arr.length === 1 ? '' : 's')}`, 0);
|
|
||||||
log.info(`Sequence started`, 'SEQUENCE', true);
|
|
||||||
seq.step();
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.execStop = function (msg) {
|
|
||||||
'use strict';
|
|
||||||
gui.overlay(false);
|
|
||||||
gui.spinner(false);
|
|
||||||
log.info(`Sequence ${msg}`, 'SEQUENCE', true);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.step = function () {
|
|
||||||
'use strict';
|
|
||||||
let elem;
|
|
||||||
let c;
|
|
||||||
let rgb;
|
|
||||||
let current;
|
|
||||||
let max;
|
|
||||||
|
|
||||||
if (!seq.running) {
|
|
||||||
return seq.execStop('stopped');
|
|
||||||
}
|
|
||||||
|
|
||||||
return setTimeout(() => {
|
|
||||||
elem = seq.queue.shift();
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
c = elem.cmd;
|
|
||||||
if (typeof elem.light !== 'undefined') {
|
|
||||||
rgb = elem.light.split(',');
|
|
||||||
} else {
|
|
||||||
rgb = light.color;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return seq.execStop('completed');
|
|
||||||
}
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
current = seq.state.len - seq.queue.length;
|
|
||||||
max = seq.state.len;
|
|
||||||
gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100);
|
|
||||||
log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true);
|
|
||||||
if (c === 'CF'){
|
|
||||||
cmd.cam_forward(rgb, seq.step);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
cmd.cam_backward(rgb, seq.step);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(seq.step);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(seq.step);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(seq.step);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(seq.step);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
};
|
|
||||||
|
|
||||||
// FROM SERVER SIDE
|
|
||||||
proj.state = {
|
|
||||||
dir : true, //default dir
|
|
||||||
digital : false
|
|
||||||
}
|
|
||||||
proj.init = function () {
|
|
||||||
proj.listen()
|
|
||||||
}
|
|
||||||
proj.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_backward
|
|
||||||
}
|
|
||||||
proj.state.dir = dir
|
|
||||||
if (proj.state.digital) {
|
|
||||||
dig.set(dir)
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
proj.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.projector
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
try {
|
|
||||||
ms = await dig.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(mcopy.cfg.arduino.cmd.projector, id, ms)
|
|
||||||
}
|
|
||||||
proj.listen = function () {
|
|
||||||
ipcMain.on('proj', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.val !== 'undefined') {
|
|
||||||
dig.state.frame = arg.val
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('digital', proj.connectDigital)
|
|
||||||
}
|
|
||||||
proj.end = async function (cmd, id, ms) {
|
|
||||||
let message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.proj_forward) {
|
|
||||||
message = 'Projector set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.proj_backward) {
|
|
||||||
message = 'Projector set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.projector) {
|
|
||||||
message = 'Projector '
|
|
||||||
if (proj.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'PROJECTOR', true, true)
|
|
||||||
return await mainWindow.webContents.send('proj', {cmd: cmd, id : id, ms: ms})
|
|
||||||
}
|
|
||||||
proj.connectDigital = async function (evt, arg) {
|
|
||||||
let info;
|
|
||||||
let frames = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
info = await ffprobe.info(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
frames = await ffprobe.frames(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.state.frame = 0;
|
|
||||||
dig.state.path = arg.path;
|
|
||||||
dig.state.fileName = arg.fileName;
|
|
||||||
dig.state.frames = frames;
|
|
||||||
dig.state.info = info;
|
|
||||||
|
|
||||||
//console.dir(dig.state);
|
|
||||||
|
|
||||||
log.info(`Opened ${dig.state.fileName}`, 'DIGITAL', true, true);
|
|
||||||
log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
|
||||||
proj.digital = true;
|
|
||||||
return await mainWindow.webContents.send('digital', { valid : true, state : JSON.stringify(dig.state) });
|
|
||||||
}
|
|
||||||
|
|
||||||
const dig = {};
|
|
||||||
dig.state = {
|
|
||||||
frame : 0,
|
|
||||||
frames : 0,
|
|
||||||
path : null,
|
|
||||||
fileName : null,
|
|
||||||
info : {},
|
|
||||||
dir : true
|
|
||||||
};
|
|
||||||
|
|
||||||
dig.set = function (dir) {
|
|
||||||
dig.state.dir = dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.move = async function () {
|
|
||||||
let start = +new Date()
|
|
||||||
let last = dig.state.dir + 0;
|
|
||||||
if (dig.state.dir) {
|
|
||||||
dig.state.frame++
|
|
||||||
} else {
|
|
||||||
dig.state.frame--
|
|
||||||
}
|
|
||||||
if (dig.state.frame < 1) {
|
|
||||||
dig.state.frame = 1
|
|
||||||
}
|
|
||||||
return (+new Date()) - start
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.start = async function () {
|
|
||||||
try {
|
|
||||||
await ffmpeg.clearAll()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ffmpeg.frame(dig.state, light.state)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
display.start(dig.state.frame)
|
|
||||||
await delay(20)
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.end = async function () {
|
|
||||||
await delay(20)
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.intval = null
|
|
||||||
cam.state = {
|
|
||||||
dir : true //default dir
|
|
||||||
}
|
|
||||||
cam.init = function () {
|
|
||||||
cam.listen()
|
|
||||||
}
|
|
||||||
cam.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_backward
|
|
||||||
}
|
|
||||||
cam.state.dir = dir
|
|
||||||
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.setDir(dir)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.camera
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.start()
|
|
||||||
}
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.end()
|
|
||||||
}
|
|
||||||
log.info('Camera move time', { ms })
|
|
||||||
return cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.exposure = function (exposure, id) {
|
|
||||||
let cmd = 'E'
|
|
||||||
cam.intval.setExposure('camera', exposure, ms => {
|
|
||||||
cam.end(cmd, id, ms)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.connectIntval = async function (event, arg) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (arg.connect) {
|
|
||||||
cam.intval = new Intval(arg.url)
|
|
||||||
cam.intval.connect((err, ms, state) => {
|
|
||||||
if (err) {
|
|
||||||
mainWindow.webContents.send('intval', { connected : false })
|
|
||||||
log.info(`Cannot connect to ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
cam.intval = null
|
|
||||||
delete cam.intval
|
|
||||||
} else {
|
|
||||||
mainWindow.webContents.send('intval', { connected : true, url : arg.url, state : state })
|
|
||||||
log.info(`Connected to INTVAL3 @ ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
settings.update('camera', { intval : arg.url })
|
|
||||||
settings.save()
|
|
||||||
dev.remember('intval', arg.url, 'camera')
|
|
||||||
}
|
|
||||||
return resolve(true)
|
|
||||||
})
|
|
||||||
} else if (arg.disconnect) {
|
|
||||||
cam.intval = null
|
|
||||||
return resolve(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.listen = function () {
|
|
||||||
ipcMain.on('cam', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('intval', cam.connectIntval)
|
|
||||||
}
|
|
||||||
cam.end = async function (cmd, id, ms) {
|
|
||||||
var message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.cam_forward) {
|
|
||||||
message = 'Camera set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.cam_backward) {
|
|
||||||
message = 'Camera set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.camera) {
|
|
||||||
message = 'Camera '
|
|
||||||
if (cam.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'CAMERA', true, true)
|
|
||||||
mainWindow.webContents.send('cam', {cmd: cmd, id : id, ms: ms})
|
|
||||||
};
|
|
||||||
|
|
||||||
const seq = {};
|
|
||||||
seq.init = function () {
|
|
||||||
seq.listen();
|
|
||||||
}
|
|
||||||
|
|
||||||
seq.listen = function () {
|
|
||||||
ipcMain.on('seq', async (evt, arg) => {
|
|
||||||
if (arg.action === 'stop' && proj.digital) {
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
class Sequence {
|
class Sequence {
|
||||||
constructor(cfg, cmd) {
|
constructor(cfg, cmd) {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
|
@ -594,6 +19,7 @@ class Sequence {
|
||||||
* Stop the sequence
|
* Stop the sequence
|
||||||
**/
|
**/
|
||||||
stop() {
|
stop() {
|
||||||
|
this.running = false;
|
||||||
}
|
}
|
||||||
exec() {
|
exec() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sequence/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,GAAS,CAAC;AACd,IAAI,GAAc,CAAC;AAEnB,eAAe;AAEf;;;;;;;;;;;;;;QAcQ;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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G,GAAG,CAAC,CAAC;IACR,GAAG,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAA"}
|
|
@ -36,6 +36,11 @@ class Arduino {
|
||||||
this.lock = false;
|
this.lock = false;
|
||||||
this.locks = {};
|
this.locks = {};
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Enumerate all connected devices that might be Arduinos
|
||||||
|
*
|
||||||
|
* @returns {Promise} Resolves after enumerating
|
||||||
|
**/
|
||||||
async enumerate() {
|
async enumerate() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
return SerialPort.list((err, ports) => {
|
return SerialPort.list((err, ports) => {
|
||||||
|
@ -200,22 +205,22 @@ class Arduino {
|
||||||
confirmEnd(data) {
|
confirmEnd(data) {
|
||||||
//console.dir(data)
|
//console.dir(data)
|
||||||
if (data === cfg.arduino.cmd.connect
|
if (data === cfg.arduino.cmd.connect
|
||||||
|| data === cfg.arduino.cmd.proj_identifier
|
|| data === cfg.arduino.cmd.projector_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_identifier
|
|| data === cfg.arduino.cmd.camera_identifier
|
||||||
|| data === cfg.arduino.cmd.light_identifier
|
|| data === cfg.arduino.cmd.light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_light_identifier
|
|| data === cfg.arduino.cmd.projector_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_light_identifier
|
|| data === cfg.arduino.cmd.projector_camera_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_identifier
|
|| data === cfg.arduino.cmd.projector_camera_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_second_identifier
|
|| data === cfg.arduino.cmd.projector_second_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_dual_identifier
|
|| data === cfg.arduino.cmd.projectors_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_second_forward
|
|| data === cfg.arduino.cmd.projector_second_forward
|
||||||
|| data === cfg.arduino.cmd.proj_second_backward
|
|| data === cfg.arduino.cmd.projector_second_backward
|
||||||
|| data === cfg.arduino.cmd.projector_second
|
|| data === cfg.arduino.cmd.projector_second
|
||||||
|| data === cfg.arduino.cmd.projectors
|
|| data === cfg.arduino.cmd.projectors
|
||||||
|| data === cfg.arduino.cmd.cam_second_identifier
|
|| data === cfg.arduino.cmd.camera_second_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_dual_identifier
|
|| data === cfg.arduino.cmd.cameras_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_second_forward
|
|| data === cfg.arduino.cmd.camera_second_forward
|
||||||
|| data === cfg.arduino.cmd.cam_second_backward
|
|| data === cfg.arduino.cmd.camera_second_backward
|
||||||
|| data === cfg.arduino.cmd.camera_second
|
|| data === cfg.arduino.cmd.camera_second
|
||||||
|| data === cfg.arduino.cmd.cameras) {
|
|| data === cfg.arduino.cmd.cameras) {
|
||||||
this.confirmExec(null, data);
|
this.confirmExec(null, data);
|
||||||
|
@ -250,34 +255,34 @@ class Arduino {
|
||||||
let writeSuccess;
|
let writeSuccess;
|
||||||
let type;
|
let type;
|
||||||
this.confirmExec = function (err, data) {
|
this.confirmExec = function (err, data) {
|
||||||
if (data === cfg.arduino.cmd.proj_identifier) {
|
if (data === cfg.arduino.cmd.projector_identifier) {
|
||||||
type = 'projector';
|
type = 'projector';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.cam_identifier) {
|
else if (data === cfg.arduino.cmd.camera_identifier) {
|
||||||
type = 'camera';
|
type = 'camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.light_identifier) {
|
else if (data === cfg.arduino.cmd.light_identifier) {
|
||||||
type = 'light';
|
type = 'light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_light_identifier) {
|
else if (data === cfg.arduino.cmd.projector_light_identifier) {
|
||||||
type = 'projector,light';
|
type = 'projector,light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_cam_light_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_light_identifier) {
|
||||||
type = 'projector,camera,light';
|
type = 'projector,camera,light';
|
||||||
}
|
}
|
||||||
else if (data === cfg.arduino.cmd.proj_cam_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera';
|
type = 'projector,camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.proj_second_identifier) {
|
else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second';
|
type = 'projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.proj_dual_identifier) {
|
else if (data === cfg.ardino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second';
|
type = 'projector,projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cam_second_identifier) {
|
else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second';
|
type = 'camera_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cam_dual_identifier) {
|
else if (data === cfg.ardino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second';
|
type = 'camera,camera_second';
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
//camera,projector,projector_second
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@ class Camera {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor(arduino, cfg, ui, dig) {
|
constructor(arduino, cfg, ui, dig, second = false) {
|
||||||
this.state = {
|
this.state = {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
dir: true,
|
dir: true,
|
||||||
|
@ -20,6 +20,8 @@ class Camera {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second)
|
||||||
|
this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -44,10 +46,10 @@ class Camera {
|
||||||
let cmd;
|
let cmd;
|
||||||
let ms;
|
let ms;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.cam_forward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd = this.cfg.arduino.cmd.cam_backward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
}
|
}
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
if (this.intval) {
|
if (this.intval) {
|
||||||
|
@ -164,12 +166,18 @@ class Camera {
|
||||||
**/
|
**/
|
||||||
async end(cmd, id, ms) {
|
async end(cmd, id, ms) {
|
||||||
let message = '';
|
let message = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.cam_forward) {
|
if (cmd === this.cfg.arduino.cmd.camera_forward) {
|
||||||
message = 'Camera set to FORWARD';
|
message = 'Camera set to FORWARD';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.cam_backward) {
|
else if (cmd === this.cfg.arduino.cmd.camera_backward) {
|
||||||
message = 'Camera set to BACKWARD';
|
message = 'Camera set to BACKWARD';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camera_second_forward) {
|
||||||
|
message = 'Camera second set to FORWARD';
|
||||||
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camera_second_backward) {
|
||||||
|
message = 'Camera second set to BACKWARD';
|
||||||
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.camera) {
|
else if (cmd === this.cfg.arduino.cmd.camera) {
|
||||||
message = 'Camera ';
|
message = 'Camera ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -180,7 +188,17 @@ class Camera {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
this.log.info(message, 'CAMERA', true, true);
|
else if (cmd === this.cfg.arduino.cmd.camera_second) {
|
||||||
|
message = 'Camera second ';
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message += 'REWOUND';
|
||||||
|
}
|
||||||
|
message += ' 1 frame';
|
||||||
|
}
|
||||||
|
this.log.info(message);
|
||||||
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame forward
|
* Move the projector one frame forward
|
||||||
**/
|
**/
|
||||||
async proj_forward() {
|
async projector_forward() {
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
if (!this.proj.state.dir) {
|
if (!this.proj.state.dir) {
|
||||||
|
@ -30,7 +30,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame backward
|
* Move the projector one frame backward
|
||||||
**/
|
**/
|
||||||
async proj_backward() {
|
async projector_backward() {
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
if (this.proj.state.dir) {
|
if (this.proj.state.dir) {
|
||||||
|
@ -50,7 +50,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
async cam_forward(rgb = [255, 255, 255]) {
|
async camera_forward(rgb = [255, 255, 255]) {
|
||||||
const off = [0, 0, 0];
|
const off = [0, 0, 0];
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
|
@ -98,7 +98,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
async cam_backward(rgb = [255, 255, 255]) {
|
async camera_backward(rgb = [255, 255, 255]) {
|
||||||
const off = [0, 0, 0];
|
const off = [0, 0, 0];
|
||||||
let ms;
|
let ms;
|
||||||
try {
|
try {
|
||||||
|
@ -143,21 +143,21 @@ class Commands {
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
cam2_forward : 'C2F',
|
camera_second_forward : 'C2F',
|
||||||
cam2_backward : 'C2B',
|
camera_second_backward : 'C2B',
|
||||||
|
|
||||||
cams_forward : 'CCF',
|
cameras_forward : 'CCF',
|
||||||
cams_forward : 'CCB',
|
cameras_forward : 'CCB',
|
||||||
|
|
||||||
cam_forward_cam2_backward : 'CFCB',
|
camera_forward_camera_second_backward : 'CFCB',
|
||||||
cam_backward_cam2_forward : 'CBCF',
|
camera_backward_camera_second_forward : 'CBCF',
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Move the secondary projector forward one frame
|
* Move the secondary projector forward one frame
|
||||||
*
|
*
|
||||||
* @param {function} callback Function to call after action
|
* @param {function} callback Function to call after action
|
||||||
**/
|
**/
|
||||||
/*cmd.proj2_forward = function (callback) {
|
/*cmd.projector_second_forward = function (callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
$('#cmd_proj2_forward').removeClass('active');
|
$('#cmd_proj2_forward').removeClass('active');
|
||||||
|
@ -177,20 +177,20 @@ class Commands {
|
||||||
}, mcopy.cfg.arduino.serialDelay);
|
}, mcopy.cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cmd.proj2_backward = function (callback) {};
|
cmd.projector_second_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.projs_forward = function (callback) {};
|
cmd.projectors_forward = function (callback) {};
|
||||||
cmd.projs_backward = function (callback) {};
|
cmd.projectors_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.proj_forward_proj2_backward = function (callback) {};
|
cmd.projector_forward_projector_second_backward = function (callback) {};
|
||||||
cmd.proj_backward_proj2_forward = function (callback) {};
|
cmd.projector_backward_projector_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"
|
||||||
* value. Moves as black frames to prevent multiple exposure.
|
* value. Moves as black frames to prevent multiple exposure.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
async cam_to() {
|
async camera_to() {
|
||||||
/*const raw = $('#move_cam_to').val();
|
/*const raw = $('#move_cam_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
@ -223,7 +223,7 @@ class Commands {
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
async proj_to() {
|
async projector_to() {
|
||||||
/*const raw = $('#move_proj_to').val();
|
/*const raw = $('#move_proj_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cmd/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,QAAQ;IAQb,YAAa,GAAS,EAAE,IAAU,EAAE,GAAS,EAAE,KAAW;QACzD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;IACxC,CAAC;IAED;;QAEI;IACG,KAAK,CAAC,YAAY;QACxB,IAAI,EAAW,CAAC;QAChB,IAAI;YACH,IAAI,CAA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,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,sBAAsB;YACjD,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAC3B,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACb,MAAM,GAAG,CAAC;SACV;QACD,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;;;;;MASE;IACF;;;;QAII;IACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BE;IAGF;;;;QAII;IACG,KAAK,CAAC,SAAS;QACrB;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;IACJ,CAAC;IAED;;;;QAII;IACG,KAAK,CAAC,YAAY;QACxB;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;IACJ,CAAC;CAED;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,GAAS,EAAE,IAAU,EAAE,GAAS,EAAE,KAAW;IACvE,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA"}
|
|
@ -296,6 +296,9 @@ class Devices {
|
||||||
return false
|
return false
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
//camera,projector,projector_second
|
||||||
|
//camera,camera_second,projector
|
||||||
|
//camera,camera_second,projector,projector_second
|
||||||
return connectSuccess;
|
return connectSuccess;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -384,7 +387,7 @@ class Devices {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.profile
|
profile: this.settings.state.profile
|
||||||
};
|
};
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second && projector_second.arduino) {
|
||||||
args.projector_second = projector_second;
|
args.projector_second = projector_second;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@ class Projector {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor(arduino, cfg, ui, dig) {
|
constructor(arduino, cfg, ui, dig, second = false) {
|
||||||
this.state = {
|
this.state = {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
dir: true,
|
dir: true,
|
||||||
|
@ -18,6 +18,8 @@ class Projector {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second)
|
||||||
|
this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -41,10 +43,10 @@ class Projector {
|
||||||
let cmd;
|
let cmd;
|
||||||
let ms;
|
let ms;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.proj_forward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd = this.cfg.arduino.cmd.proj_backward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
}
|
}
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
if (this.dig.state.enabled) {
|
if (this.dig.state.enabled) {
|
||||||
|
@ -55,7 +57,7 @@ class Projector {
|
||||||
ms = await this.arduino.send(this.id, cmd);
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.log.error('Error setting projector direction', err);
|
this.log.error(`Error setting ${this.id} direction`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await this.end(cmd, id, ms);
|
return await this.end(cmd, id, ms);
|
||||||
|
@ -79,7 +81,7 @@ class Projector {
|
||||||
ms = await this.arduino.send(this.id, cmd);
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.log.error('Error moving projector', err);
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
this.log.info('Projector move time', { ms });
|
||||||
|
@ -116,12 +118,18 @@ class Projector {
|
||||||
**/
|
**/
|
||||||
async end(cmd, id, ms) {
|
async end(cmd, id, ms) {
|
||||||
let message = '';
|
let message = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.proj_forward) {
|
if (cmd === this.cfg.arduino.cmd.projector_forward) {
|
||||||
message = 'Projector set to FORWARD';
|
message = 'Projector set to FORWARD';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.proj_backward) {
|
else if (cmd === this.cfg.arduino.cmd.projector_backward) {
|
||||||
message = 'Projector set to BACKWARD';
|
message = 'Projector set to BACKWARD';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second_forward) {
|
||||||
|
message = 'Projector second set to FORWARD';
|
||||||
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second_backward) {
|
||||||
|
message = 'Projector second set to BACKWARD';
|
||||||
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.projector) {
|
else if (cmd === this.cfg.arduino.cmd.projector) {
|
||||||
message = 'Projector ';
|
message = 'Projector ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -132,6 +140,16 @@ class Projector {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
|
message = 'Projector second';
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message += 'REWOUND';
|
||||||
|
}
|
||||||
|
message += ' 1 frame';
|
||||||
|
}
|
||||||
this.log.info(message, 'PROJECTOR');
|
this.log.info(message, 'PROJECTOR');
|
||||||
return await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
return await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/proj/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;;AAEjD,2BAA4B;AAE5B,MAAM,SAAS;IAed;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,GAAS;QAjBtD,UAAK,GAAS;YACrB,GAAG,EAAG,CAAC;YACP,GAAG,EAAG,IAAI;YACV,OAAO,EAAG,KAAK;SACf,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAOzB,OAAE,GAAY,WAAW,CAAC;QAMjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,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,CAAA;QACzC,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,CA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E,EAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC,CAAA;IAChE,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,GAAS;IAC3E,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAA"}
|
|
@ -1,581 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
let log;
|
let log;
|
||||||
let seq;
|
let seq;
|
||||||
//var seq = {};
|
|
||||||
/******
|
|
||||||
Sequence Object
|
|
||||||
|
|
||||||
seq.i = 0;
|
|
||||||
seq.time = 0;
|
|
||||||
seq.stopState = false;
|
|
||||||
|
|
||||||
mcopy.loop = 1; //
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
|
|
||||||
seq.queue = [];
|
|
||||||
seq.running = false;
|
|
||||||
seq.state = {};
|
|
||||||
|
|
||||||
*******/
|
|
||||||
/**
|
|
||||||
* Run the sequence
|
|
||||||
|
|
||||||
seq.run = function () {
|
|
||||||
'use strict';
|
|
||||||
var c = mcopy.state.sequence.arr[seq.i],
|
|
||||||
timeEnd = 0,
|
|
||||||
rgb,
|
|
||||||
action = function () {
|
|
||||||
setTimeout(function () {
|
|
||||||
seq.i++;
|
|
||||||
seq.run();
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
}
|
|
||||||
if (seq.i == 0) {
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
ipcRenderer.send('seq', { action : 'loop' });
|
|
||||||
}
|
|
||||||
if (seq.stop()) {
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
log.info('Sequence stopped', 'SERIAL', true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (seq.i <= mcopy.state.sequence.arr.length && c !== undefined) {
|
|
||||||
log.info('Step ' + seq.i + ' command ' + c, 'SEQUENCE', true);
|
|
||||||
//gui action
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('.row input[x=' + seq.i + ']').addClass('h');
|
|
||||||
$('#numbers div[x=' + seq.i + ']').addClass('h');
|
|
||||||
if (c === 'CF'){
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_forward(rgb, action);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_backward(rgb, action);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(action);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(action);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(action);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(action);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mcopy.loopCount++;
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
if (mcopy.loopCount < mcopy.loop) {
|
|
||||||
log.info('Loop ' + mcopy.loopCount + ' completed', 'SEQUENCE', true);
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
seq.i = 0;
|
|
||||||
seq.run();
|
|
||||||
} else {
|
|
||||||
timeEnd = +new Date();
|
|
||||||
timeEnd = timeEnd - seq.time;
|
|
||||||
if (timeEnd < 2000) {
|
|
||||||
log.info('Sequence completed in ' + timeEnd + 'ms', 'SEQUENCE', true);
|
|
||||||
} else {
|
|
||||||
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true);
|
|
||||||
}
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd));
|
|
||||||
//clear gui
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('#loop_current').text('');
|
|
||||||
seq.stats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
seq.stop = function (state) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof state === 'undefined') {
|
|
||||||
if (seq.stopState === true) {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return seq.stopState;
|
|
||||||
} else {
|
|
||||||
seq.stopState = state;
|
|
||||||
}
|
|
||||||
if (state === false) {
|
|
||||||
mcopy.loopCount = 0
|
|
||||||
$('#loop_current').text('');
|
|
||||||
} else {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return state
|
|
||||||
};
|
|
||||||
seq.init = function (start) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof start === 'undefined') {
|
|
||||||
start = 0;
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
seq.time = +new Date();
|
|
||||||
}
|
|
||||||
seq.stop(false);
|
|
||||||
seq.i = start;
|
|
||||||
|
|
||||||
ipcRenderer.send('seq', { action : 'start' });
|
|
||||||
seq.run();
|
|
||||||
};
|
|
||||||
//!!! redo
|
|
||||||
seq.stats = function () {
|
|
||||||
'use strict';
|
|
||||||
var ms = 0,
|
|
||||||
c = '',
|
|
||||||
cam_total = 0,
|
|
||||||
proj_total = 0,
|
|
||||||
real_total = mcopy.state.sequence.arr.filter(function (elem) {
|
|
||||||
if (elem === undefined) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//timing
|
|
||||||
for (var i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
|
||||||
c = mcopy.state.sequence.arr[i];
|
|
||||||
if (c === 'CF' || c === 'CB'){
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'PF' || c === 'PB'){
|
|
||||||
ms += mcopy.cfg.arduino.proj.time;
|
|
||||||
ms += mcopy.cfg.arduino.proj.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'BF' || c === 'BB'){
|
|
||||||
ms += mcopy.cfg.arduino.black.before;
|
|
||||||
ms += mcopy.cfg.arduino.black.after;
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
ms += mcopy.cfg.arduino.sequenceDelay;
|
|
||||||
|
|
||||||
if (c === 'CF' || c === 'BF') {
|
|
||||||
cam_total++;
|
|
||||||
}
|
|
||||||
if (c === 'CB' || c === 'BB') {
|
|
||||||
cam_total--;
|
|
||||||
}
|
|
||||||
if (c === 'PF') {
|
|
||||||
proj_total++;
|
|
||||||
}
|
|
||||||
if (c === 'PB') {
|
|
||||||
proj_total--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//timing
|
|
||||||
ms = ms * mcopy.loop;
|
|
||||||
if (ms < 2000) {
|
|
||||||
$('#seq_stats .timing span').text(ms + 'ms');
|
|
||||||
} else {
|
|
||||||
$('#seq_stats .timing span').text(humanizeDuration(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
//ending frames
|
|
||||||
cam_total = cam_total * mcopy.loop;
|
|
||||||
proj_total = proj_total * mcopy.loop;
|
|
||||||
|
|
||||||
$('#seq_stats .cam_end span').text(gui.fmtZero(mcopy.state.camera.pos + cam_total, 6));
|
|
||||||
$('#seq_stats .proj_end span').text(gui.fmtZero(mcopy.state.projector.pos + proj_total, 6));
|
|
||||||
|
|
||||||
//count
|
|
||||||
$('#seq_stats .seq_count span').text(real_total.length * mcopy.loop);
|
|
||||||
return ms;
|
|
||||||
};
|
|
||||||
seq.clear = function () {
|
|
||||||
'use strict';
|
|
||||||
mcopy.state.sequence.size = 24;
|
|
||||||
mcopy.state.sequence.arr = [];
|
|
||||||
};
|
|
||||||
seq.exec = function (arr) {
|
|
||||||
'use strict';
|
|
||||||
seq.running = true;
|
|
||||||
seq.state.len = arr.length;
|
|
||||||
//setup queue
|
|
||||||
seq.queue = arr;
|
|
||||||
//console.dir(arr);
|
|
||||||
gui.overlay(true);
|
|
||||||
gui.spinner(true, `Running sequence of ${arr.length} frame${(arr.length === 1 ? '' : 's')}`, 0);
|
|
||||||
log.info(`Sequence started`, 'SEQUENCE', true);
|
|
||||||
seq.step();
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.execStop = function (msg) {
|
|
||||||
'use strict';
|
|
||||||
gui.overlay(false);
|
|
||||||
gui.spinner(false);
|
|
||||||
log.info(`Sequence ${msg}`, 'SEQUENCE', true);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.step = function () {
|
|
||||||
'use strict';
|
|
||||||
let elem;
|
|
||||||
let c;
|
|
||||||
let rgb;
|
|
||||||
let current;
|
|
||||||
let max;
|
|
||||||
|
|
||||||
if (!seq.running) {
|
|
||||||
return seq.execStop('stopped');
|
|
||||||
}
|
|
||||||
|
|
||||||
return setTimeout(() => {
|
|
||||||
elem = seq.queue.shift();
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
c = elem.cmd;
|
|
||||||
if (typeof elem.light !== 'undefined') {
|
|
||||||
rgb = elem.light.split(',');
|
|
||||||
} else {
|
|
||||||
rgb = light.color;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return seq.execStop('completed');
|
|
||||||
}
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
current = seq.state.len - seq.queue.length;
|
|
||||||
max = seq.state.len;
|
|
||||||
gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100);
|
|
||||||
log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true);
|
|
||||||
if (c === 'CF'){
|
|
||||||
cmd.cam_forward(rgb, seq.step);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
cmd.cam_backward(rgb, seq.step);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(seq.step);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(seq.step);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(seq.step);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(seq.step);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
};
|
|
||||||
|
|
||||||
// FROM SERVER SIDE
|
|
||||||
proj.state = {
|
|
||||||
dir : true, //default dir
|
|
||||||
digital : false
|
|
||||||
}
|
|
||||||
proj.init = function () {
|
|
||||||
proj.listen()
|
|
||||||
}
|
|
||||||
proj.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_backward
|
|
||||||
}
|
|
||||||
proj.state.dir = dir
|
|
||||||
if (proj.state.digital) {
|
|
||||||
dig.set(dir)
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
proj.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.projector
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
try {
|
|
||||||
ms = await dig.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(mcopy.cfg.arduino.cmd.projector, id, ms)
|
|
||||||
}
|
|
||||||
proj.listen = function () {
|
|
||||||
ipcMain.on('proj', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.val !== 'undefined') {
|
|
||||||
dig.state.frame = arg.val
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('digital', proj.connectDigital)
|
|
||||||
}
|
|
||||||
proj.end = async function (cmd, id, ms) {
|
|
||||||
let message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.proj_forward) {
|
|
||||||
message = 'Projector set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.proj_backward) {
|
|
||||||
message = 'Projector set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.projector) {
|
|
||||||
message = 'Projector '
|
|
||||||
if (proj.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'PROJECTOR', true, true)
|
|
||||||
return await mainWindow.webContents.send('proj', {cmd: cmd, id : id, ms: ms})
|
|
||||||
}
|
|
||||||
proj.connectDigital = async function (evt, arg) {
|
|
||||||
let info;
|
|
||||||
let frames = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
info = await ffprobe.info(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
frames = await ffprobe.frames(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.state.frame = 0;
|
|
||||||
dig.state.path = arg.path;
|
|
||||||
dig.state.fileName = arg.fileName;
|
|
||||||
dig.state.frames = frames;
|
|
||||||
dig.state.info = info;
|
|
||||||
|
|
||||||
//console.dir(dig.state);
|
|
||||||
|
|
||||||
log.info(`Opened ${dig.state.fileName}`, 'DIGITAL', true, true);
|
|
||||||
log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
|
||||||
proj.digital = true;
|
|
||||||
return await mainWindow.webContents.send('digital', { valid : true, state : JSON.stringify(dig.state) });
|
|
||||||
}
|
|
||||||
|
|
||||||
const dig = {};
|
|
||||||
dig.state = {
|
|
||||||
frame : 0,
|
|
||||||
frames : 0,
|
|
||||||
path : null,
|
|
||||||
fileName : null,
|
|
||||||
info : {},
|
|
||||||
dir : true
|
|
||||||
};
|
|
||||||
|
|
||||||
dig.set = function (dir) {
|
|
||||||
dig.state.dir = dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.move = async function () {
|
|
||||||
let start = +new Date()
|
|
||||||
let last = dig.state.dir + 0;
|
|
||||||
if (dig.state.dir) {
|
|
||||||
dig.state.frame++
|
|
||||||
} else {
|
|
||||||
dig.state.frame--
|
|
||||||
}
|
|
||||||
if (dig.state.frame < 1) {
|
|
||||||
dig.state.frame = 1
|
|
||||||
}
|
|
||||||
return (+new Date()) - start
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.start = async function () {
|
|
||||||
try {
|
|
||||||
await ffmpeg.clearAll()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ffmpeg.frame(dig.state, light.state)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
display.start(dig.state.frame)
|
|
||||||
await delay(20)
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.end = async function () {
|
|
||||||
await delay(20)
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.intval = null
|
|
||||||
cam.state = {
|
|
||||||
dir : true //default dir
|
|
||||||
}
|
|
||||||
cam.init = function () {
|
|
||||||
cam.listen()
|
|
||||||
}
|
|
||||||
cam.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_backward
|
|
||||||
}
|
|
||||||
cam.state.dir = dir
|
|
||||||
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.setDir(dir)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.camera
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.start()
|
|
||||||
}
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.end()
|
|
||||||
}
|
|
||||||
log.info('Camera move time', { ms })
|
|
||||||
return cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.exposure = function (exposure, id) {
|
|
||||||
let cmd = 'E'
|
|
||||||
cam.intval.setExposure('camera', exposure, ms => {
|
|
||||||
cam.end(cmd, id, ms)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.connectIntval = async function (event, arg) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (arg.connect) {
|
|
||||||
cam.intval = new Intval(arg.url)
|
|
||||||
cam.intval.connect((err, ms, state) => {
|
|
||||||
if (err) {
|
|
||||||
mainWindow.webContents.send('intval', { connected : false })
|
|
||||||
log.info(`Cannot connect to ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
cam.intval = null
|
|
||||||
delete cam.intval
|
|
||||||
} else {
|
|
||||||
mainWindow.webContents.send('intval', { connected : true, url : arg.url, state : state })
|
|
||||||
log.info(`Connected to INTVAL3 @ ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
settings.update('camera', { intval : arg.url })
|
|
||||||
settings.save()
|
|
||||||
dev.remember('intval', arg.url, 'camera')
|
|
||||||
}
|
|
||||||
return resolve(true)
|
|
||||||
})
|
|
||||||
} else if (arg.disconnect) {
|
|
||||||
cam.intval = null
|
|
||||||
return resolve(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.listen = function () {
|
|
||||||
ipcMain.on('cam', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('intval', cam.connectIntval)
|
|
||||||
}
|
|
||||||
cam.end = async function (cmd, id, ms) {
|
|
||||||
var message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.cam_forward) {
|
|
||||||
message = 'Camera set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.cam_backward) {
|
|
||||||
message = 'Camera set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.camera) {
|
|
||||||
message = 'Camera '
|
|
||||||
if (cam.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'CAMERA', true, true)
|
|
||||||
mainWindow.webContents.send('cam', {cmd: cmd, id : id, ms: ms})
|
|
||||||
};
|
|
||||||
|
|
||||||
const seq = {};
|
|
||||||
seq.init = function () {
|
|
||||||
seq.listen();
|
|
||||||
}
|
|
||||||
|
|
||||||
seq.listen = function () {
|
|
||||||
ipcMain.on('seq', async (evt, arg) => {
|
|
||||||
if (arg.action === 'stop' && proj.digital) {
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
class Sequence {
|
class Sequence {
|
||||||
constructor(cfg, cmd) {
|
constructor(cfg, cmd) {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
|
@ -594,6 +19,7 @@ class Sequence {
|
||||||
* Stop the sequence
|
* Stop the sequence
|
||||||
**/
|
**/
|
||||||
stop() {
|
stop() {
|
||||||
|
this.running = false;
|
||||||
}
|
}
|
||||||
exec() {
|
exec() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 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AC;IACO,IAAI;IAEZ,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,GAAS,EAAE,GAAS,EAAE,CAAO;IACvD,GAAG,GAAG,CAAC,CAAC;IACR,GAAG,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAA"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sequence/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,GAAS,CAAC;AACd,IAAI,GAAc,CAAC;AAEnB,MAAM,QAAQ;IAOb,YAAa,GAAS,EAAE,GAAS;QAChC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IACD,wBAAwB;IACjB,IAAI;IAEX,CAAC;IACD,KAAK;IACE,KAAK;IAEZ,CAAC;IACD,KAAK;IACE,KAAK;IAEZ,CAAC;IACD;;QAEI;IACG,IAAI;QACV,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC;IAEM,IAAI;IAEX,CAAC;IAEM,QAAQ;IAEf,CAAC;IAED,SAAS;IACD,GAAG;IAEX,CAAC;IACO,IAAI;IAEZ,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,GAAS,EAAE,GAAS,EAAE,CAAO;IACvD,GAAG,GAAG,CAAC,CAAC;IACR,GAAG,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAA"}
|
|
@ -46,6 +46,11 @@ class Arduino {
|
||||||
constructor () {
|
constructor () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Enumerate all connected devices that might be Arduinos
|
||||||
|
*
|
||||||
|
* @returns {Promise} Resolves after enumerating
|
||||||
|
**/
|
||||||
async enumerate () {
|
async enumerate () {
|
||||||
return new Promise( (resolve, reject) => {
|
return new Promise( (resolve, reject) => {
|
||||||
return SerialPort.list((err : any, ports : any[]) => {
|
return SerialPort.list((err : any, ports : any[]) => {
|
||||||
|
@ -208,24 +213,24 @@ class Arduino {
|
||||||
confirmEnd (data : string) {
|
confirmEnd (data : string) {
|
||||||
//console.dir(data)
|
//console.dir(data)
|
||||||
if ( data === cfg.arduino.cmd.connect
|
if ( data === cfg.arduino.cmd.connect
|
||||||
|| data === cfg.arduino.cmd.proj_identifier
|
|| data === cfg.arduino.cmd.projector_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_identifier
|
|| data === cfg.arduino.cmd.camera_identifier
|
||||||
|| data === cfg.arduino.cmd.light_identifier
|
|| data === cfg.arduino.cmd.light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_light_identifier
|
|| data === cfg.arduino.cmd.projector_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_light_identifier
|
|| data === cfg.arduino.cmd.projector_camera_light_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_cam_identifier
|
|| data === cfg.arduino.cmd.projector_camera_identifier
|
||||||
|
|
||||||
|| data === cfg.arduino.cmd.proj_second_identifier
|
|| data === cfg.arduino.cmd.projector_second_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_dual_identifier
|
|| data === cfg.arduino.cmd.projectors_identifier
|
||||||
|| data === cfg.arduino.cmd.proj_second_forward
|
|| data === cfg.arduino.cmd.projector_second_forward
|
||||||
|| data === cfg.arduino.cmd.proj_second_backward
|
|| data === cfg.arduino.cmd.projector_second_backward
|
||||||
|| data === cfg.arduino.cmd.projector_second
|
|| data === cfg.arduino.cmd.projector_second
|
||||||
|| data === cfg.arduino.cmd.projectors
|
|| data === cfg.arduino.cmd.projectors
|
||||||
|
|
||||||
|| data === cfg.arduino.cmd.cam_second_identifier
|
|| data === cfg.arduino.cmd.camera_second_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_dual_identifier
|
|| data === cfg.arduino.cmd.cameras_identifier
|
||||||
|| data === cfg.arduino.cmd.cam_second_forward
|
|| data === cfg.arduino.cmd.camera_second_forward
|
||||||
|| data === cfg.arduino.cmd.cam_second_backward
|
|| data === cfg.arduino.cmd.camera_second_backward
|
||||||
|| data === cfg.arduino.cmd.camera_second
|
|| data === cfg.arduino.cmd.camera_second
|
||||||
|| data === cfg.arduino.cmd.cameras) {
|
|| data === cfg.arduino.cmd.cameras) {
|
||||||
|
|
||||||
|
@ -263,25 +268,25 @@ class Arduino {
|
||||||
let writeSuccess : any
|
let writeSuccess : any
|
||||||
let type : string
|
let type : string
|
||||||
this.confirmExec = function (err : any, data : string) {
|
this.confirmExec = function (err : any, data : string) {
|
||||||
if (data === cfg.arduino.cmd.proj_identifier) {
|
if (data === cfg.arduino.cmd.projector_identifier) {
|
||||||
type = 'projector'
|
type = 'projector'
|
||||||
} else if (data === cfg.arduino.cmd.cam_identifier) {
|
} else if (data === cfg.arduino.cmd.camera_identifier) {
|
||||||
type = 'camera'
|
type = 'camera'
|
||||||
} else if (data === cfg.arduino.cmd.light_identifier) {
|
} else if (data === cfg.arduino.cmd.light_identifier) {
|
||||||
type = 'light'
|
type = 'light'
|
||||||
} else if (data === cfg.arduino.cmd.proj_light_identifier) {
|
} else if (data === cfg.arduino.cmd.projector_light_identifier) {
|
||||||
type = 'projector,light'
|
type = 'projector,light'
|
||||||
} else if (data === cfg.arduino.cmd.proj_cam_light_identifier) {
|
} else if (data === cfg.arduino.cmd.projector_camera_light_identifier) {
|
||||||
type = 'projector,camera,light'
|
type = 'projector,camera,light'
|
||||||
} else if (data === cfg.arduino.cmd.proj_cam_identifier) {
|
} else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera'
|
type = 'projector,camera'
|
||||||
} else if (data === cfg.ardino.cmd.proj_second_identifier) {
|
} else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second'
|
type = 'projector_second'
|
||||||
} else if (data === cfg.ardino.cmd.proj_dual_identifier) {
|
} else if (data === cfg.ardino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second'
|
type = 'projector,projector_second'
|
||||||
} else if (data === cfg.ardino.cmd.cam_second_identifier) {
|
} else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second'
|
type = 'camera_second'
|
||||||
} else if (data === cfg.ardino.cmd.cam_dual_identifier) {
|
} else if (data === cfg.ardino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second'
|
type = 'camera,camera_second'
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
//camera,projector,projector_second
|
||||||
|
|
|
@ -23,11 +23,12 @@ class Camera {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor (arduino : Arduino, cfg : any, ui : any, dig : any) {
|
constructor (arduino : Arduino, cfg : any, ui : any, dig : any, second : boolean = false) {
|
||||||
this.arduino = arduino;
|
this.arduino = arduino;
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second) this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +57,9 @@ class Camera {
|
||||||
let ms : number;
|
let ms : number;
|
||||||
|
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.cam_forward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
} else {
|
} else {
|
||||||
cmd = this.cfg.arduino.cmd.cam_backward;
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
}
|
}
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
|
|
||||||
|
@ -169,10 +170,14 @@ class Camera {
|
||||||
**/
|
**/
|
||||||
private async end (cmd : string, id : string, ms : number) {
|
private async end (cmd : string, id : string, ms : number) {
|
||||||
let message = '';
|
let message = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.cam_forward) {
|
if (cmd === this.cfg.arduino.cmd.camera_forward) {
|
||||||
message = 'Camera set to FORWARD';
|
message = 'Camera set to FORWARD';
|
||||||
} else if (cmd === this.cfg.arduino.cmd.cam_backward) {
|
} else if (cmd === this.cfg.arduino.cmd.camera_backward) {
|
||||||
message = 'Camera set to BACKWARD';
|
message = 'Camera set to BACKWARD';
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.camera_second_forward) {
|
||||||
|
message = 'Camera second set to FORWARD';
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.camera_second_backward) {
|
||||||
|
message = 'Camera second set to BACKWARD';
|
||||||
} else if (cmd === this.cfg.arduino.cmd.camera) {
|
} else if (cmd === this.cfg.arduino.cmd.camera) {
|
||||||
message = 'Camera ';
|
message = 'Camera ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -181,9 +186,17 @@ class Camera {
|
||||||
message += 'REWOUND';
|
message += 'REWOUND';
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.camera_second) {
|
||||||
|
message = 'Camera second ';
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED';
|
||||||
|
} else {
|
||||||
|
message += 'REWOUND';
|
||||||
|
}
|
||||||
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
this.log.info(message, 'CAMERA', true, true)
|
this.log.info(message);
|
||||||
this.ui.send(this.id, {cmd: cmd, id : id, ms: ms})
|
this.ui.send(this.id, {cmd: cmd, id : id, ms: ms});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame forward
|
* Move the projector one frame forward
|
||||||
**/
|
**/
|
||||||
public async proj_forward () {
|
public async projector_forward () {
|
||||||
let ms : number;
|
let ms : number;
|
||||||
try {
|
try {
|
||||||
if (!this.proj.state.dir) {
|
if (!this.proj.state.dir) {
|
||||||
|
@ -39,7 +39,7 @@ class Commands {
|
||||||
/**
|
/**
|
||||||
* Move the projector one frame backward
|
* Move the projector one frame backward
|
||||||
**/
|
**/
|
||||||
public async proj_backward () {
|
public async projector_backward () {
|
||||||
let ms : number;
|
let ms : number;
|
||||||
try {
|
try {
|
||||||
if (this.proj.state.dir) {
|
if (this.proj.state.dir) {
|
||||||
|
@ -58,7 +58,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
public async cam_forward (rgb : number[] = [255, 255, 255]) {
|
public async camera_forward (rgb : number[] = [255, 255, 255]) {
|
||||||
const off : number[] = [0, 0, 0];
|
const off : number[] = [0, 0, 0];
|
||||||
let ms : number;
|
let ms : number;
|
||||||
try {
|
try {
|
||||||
|
@ -104,7 +104,7 @@ class Commands {
|
||||||
*
|
*
|
||||||
* @param {array} rgb Color to set light for frame
|
* @param {array} rgb Color to set light for frame
|
||||||
**/
|
**/
|
||||||
public async cam_backward (rgb : number[] = [255, 255, 255]) {
|
public async camera_backward (rgb : number[] = [255, 255, 255]) {
|
||||||
const off : number[] = [0, 0, 0];
|
const off : number[] = [0, 0, 0];
|
||||||
let ms : number;
|
let ms : number;
|
||||||
try {
|
try {
|
||||||
|
@ -148,21 +148,21 @@ class Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cam2_forward : 'C2F',
|
camera_second_forward : 'C2F',
|
||||||
cam2_backward : 'C2B',
|
camera_second_backward : 'C2B',
|
||||||
|
|
||||||
cams_forward : 'CCF',
|
cameras_forward : 'CCF',
|
||||||
cams_forward : 'CCB',
|
cameras_forward : 'CCB',
|
||||||
|
|
||||||
cam_forward_cam2_backward : 'CFCB',
|
camera_forward_camera_second_backward : 'CFCB',
|
||||||
cam_backward_cam2_forward : 'CBCF',
|
camera_backward_camera_second_forward : 'CBCF',
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Move the secondary projector forward one frame
|
* Move the secondary projector forward one frame
|
||||||
*
|
*
|
||||||
* @param {function} callback Function to call after action
|
* @param {function} callback Function to call after action
|
||||||
**/
|
**/
|
||||||
/*cmd.proj2_forward = function (callback) {
|
/*cmd.projector_second_forward = function (callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
$('#cmd_proj2_forward').removeClass('active');
|
$('#cmd_proj2_forward').removeClass('active');
|
||||||
|
@ -182,13 +182,13 @@ class Commands {
|
||||||
}, mcopy.cfg.arduino.serialDelay);
|
}, mcopy.cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cmd.proj2_backward = function (callback) {};
|
cmd.projector_second_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.projs_forward = function (callback) {};
|
cmd.projectors_forward = function (callback) {};
|
||||||
cmd.projs_backward = function (callback) {};
|
cmd.projectors_backward = function (callback) {};
|
||||||
|
|
||||||
cmd.proj_forward_proj2_backward = function (callback) {};
|
cmd.projector_forward_projector_second_backward = function (callback) {};
|
||||||
cmd.proj_backward_proj2_forward = function (callback) {};
|
cmd.projector_backward_projector_second_forward = function (callback) {};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class Commands {
|
||||||
* value. Moves as black frames to prevent multiple exposure.
|
* value. Moves as black frames to prevent multiple exposure.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
public async cam_to () {
|
public async camera_to () {
|
||||||
/*const raw = $('#move_cam_to').val();
|
/*const raw = $('#move_cam_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
@ -231,7 +231,7 @@ class Commands {
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
public async proj_to () {
|
public async projector_to () {
|
||||||
/*const raw = $('#move_proj_to').val();
|
/*const raw = $('#move_proj_to').val();
|
||||||
const val = parseInt(raw);
|
const val = parseInt(raw);
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
|
|
@ -293,6 +293,10 @@ class Devices {
|
||||||
return false
|
return false
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//camera,projector,projector_second
|
||||||
|
//camera,camera_second,projector
|
||||||
|
//camera,camera_second,projector,projector_second
|
||||||
return connectSuccess
|
return connectSuccess
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -388,7 +392,7 @@ class Devices {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.profile
|
profile: this.settings.state.profile
|
||||||
}
|
}
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second && projector_second.arduino) {
|
||||||
args.projector_second = projector_second
|
args.projector_second = projector_second
|
||||||
|
|
|
@ -20,11 +20,12 @@ class Projector {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
constructor (arduino : Arduino, cfg : any, ui : any, dig : any) {
|
constructor (arduino : Arduino, cfg : any, ui : any, dig : any, second : boolean = false) {
|
||||||
this.arduino = arduino;
|
this.arduino = arduino;
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.dig = dig;
|
this.dig = dig;
|
||||||
|
if (second) this.id += '_second';
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,9 +52,9 @@ class Projector {
|
||||||
let cmd : string;
|
let cmd : string;
|
||||||
let ms : number;
|
let ms : number;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
cmd = this.cfg.arduino.cmd.proj_forward
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`]
|
||||||
} else {
|
} else {
|
||||||
cmd = this.cfg.arduino.cmd.proj_backward
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`]
|
||||||
}
|
}
|
||||||
this.state.dir = dir
|
this.state.dir = dir
|
||||||
if (this.dig.state.enabled) {
|
if (this.dig.state.enabled) {
|
||||||
|
@ -62,7 +63,7 @@ class Projector {
|
||||||
try {
|
try {
|
||||||
ms = await this.arduino.send(this.id, cmd)
|
ms = await this.arduino.send(this.id, cmd)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.log.error('Error setting projector direction', err)
|
this.log.error(`Error setting ${this.id} direction`, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await this.end(cmd, id, ms)
|
return await this.end(cmd, id, ms)
|
||||||
|
@ -84,7 +85,7 @@ class Projector {
|
||||||
try {
|
try {
|
||||||
ms = await this.arduino.send(this.id, cmd)
|
ms = await this.arduino.send(this.id, cmd)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.log.error('Error moving projector', err)
|
this.log.error(`Error moving ${this.id}`, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
this.log.info('Projector move time', { ms });
|
||||||
|
@ -119,10 +120,14 @@ class Projector {
|
||||||
**/
|
**/
|
||||||
async end (cmd : string, id : string, ms : number) {
|
async end (cmd : string, id : string, ms : number) {
|
||||||
let message : string = '';
|
let message : string = '';
|
||||||
if (cmd === this.cfg.arduino.cmd.proj_forward) {
|
if (cmd === this.cfg.arduino.cmd.projector_forward) {
|
||||||
message = 'Projector set to FORWARD'
|
message = 'Projector set to FORWARD'
|
||||||
} else if (cmd === this.cfg.arduino.cmd.proj_backward) {
|
} else if (cmd === this.cfg.arduino.cmd.projector_backward) {
|
||||||
message = 'Projector set to BACKWARD'
|
message = 'Projector set to BACKWARD'
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.projector_second_forward) {
|
||||||
|
message = 'Projector second set to FORWARD'
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.projector_second_backward) {
|
||||||
|
message = 'Projector second set to BACKWARD'
|
||||||
} else if (cmd === this.cfg.arduino.cmd.projector) {
|
} else if (cmd === this.cfg.arduino.cmd.projector) {
|
||||||
message = 'Projector '
|
message = 'Projector '
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
|
@ -131,6 +136,14 @@ class Projector {
|
||||||
message += 'REWOUND'
|
message += 'REWOUND'
|
||||||
}
|
}
|
||||||
message += ' 1 frame'
|
message += ' 1 frame'
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
|
message = 'Projector second'
|
||||||
|
if (this.state.dir) {
|
||||||
|
message += 'ADVANCED'
|
||||||
|
} else {
|
||||||
|
message += 'REWOUND'
|
||||||
|
}
|
||||||
|
message += ' 1 frame'
|
||||||
}
|
}
|
||||||
this.log.info(message, 'PROJECTOR')
|
this.log.info(message, 'PROJECTOR')
|
||||||
return await this.ui.send(this.id, {cmd: cmd, id : id, ms: ms})
|
return await this.ui.send(this.id, {cmd: cmd, id : id, ms: ms})
|
||||||
|
|
|
@ -3,583 +3,6 @@
|
||||||
let log : any;
|
let log : any;
|
||||||
let seq : Sequence;
|
let seq : Sequence;
|
||||||
|
|
||||||
//var seq = {};
|
|
||||||
|
|
||||||
/******
|
|
||||||
Sequence Object
|
|
||||||
|
|
||||||
seq.i = 0;
|
|
||||||
seq.time = 0;
|
|
||||||
seq.stopState = false;
|
|
||||||
|
|
||||||
mcopy.loop = 1; //
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
|
|
||||||
seq.queue = [];
|
|
||||||
seq.running = false;
|
|
||||||
seq.state = {};
|
|
||||||
|
|
||||||
*******/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the sequence
|
|
||||||
|
|
||||||
seq.run = function () {
|
|
||||||
'use strict';
|
|
||||||
var c = mcopy.state.sequence.arr[seq.i],
|
|
||||||
timeEnd = 0,
|
|
||||||
rgb,
|
|
||||||
action = function () {
|
|
||||||
setTimeout(function () {
|
|
||||||
seq.i++;
|
|
||||||
seq.run();
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
}
|
|
||||||
if (seq.i == 0) {
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
ipcRenderer.send('seq', { action : 'loop' });
|
|
||||||
}
|
|
||||||
if (seq.stop()) {
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
log.info('Sequence stopped', 'SERIAL', true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (seq.i <= mcopy.state.sequence.arr.length && c !== undefined) {
|
|
||||||
log.info('Step ' + seq.i + ' command ' + c, 'SEQUENCE', true);
|
|
||||||
//gui action
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('.row input[x=' + seq.i + ']').addClass('h');
|
|
||||||
$('#numbers div[x=' + seq.i + ']').addClass('h');
|
|
||||||
if (c === 'CF'){
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_forward(rgb, action);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
rgb = mcopy.state.sequence.light[seq.i].split(',');
|
|
||||||
cmd.cam_backward(rgb, action);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(action);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(action);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(action);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(action);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mcopy.loopCount++;
|
|
||||||
$('#loop_current').text(gui.fmtZero(mcopy.loopCount + 1, 6));
|
|
||||||
if (mcopy.loopCount < mcopy.loop) {
|
|
||||||
log.info('Loop ' + mcopy.loopCount + ' completed', 'SEQUENCE', true);
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
seq.i = 0;
|
|
||||||
seq.run();
|
|
||||||
} else {
|
|
||||||
timeEnd = +new Date();
|
|
||||||
timeEnd = timeEnd - seq.time;
|
|
||||||
if (timeEnd < 2000) {
|
|
||||||
log.info('Sequence completed in ' + timeEnd + 'ms', 'SEQUENCE', true);
|
|
||||||
} else {
|
|
||||||
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true);
|
|
||||||
}
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd));
|
|
||||||
//clear gui
|
|
||||||
$('.row input').removeClass('h');
|
|
||||||
$('#numbers div').removeClass('h');
|
|
||||||
$('#loop_current').text('');
|
|
||||||
seq.stats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
seq.stop = function (state) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof state === 'undefined') {
|
|
||||||
if (seq.stopState === true) {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return seq.stopState;
|
|
||||||
} else {
|
|
||||||
seq.stopState = state;
|
|
||||||
}
|
|
||||||
if (state === false) {
|
|
||||||
mcopy.loopCount = 0
|
|
||||||
$('#loop_current').text('');
|
|
||||||
} else {
|
|
||||||
ipcRenderer.send('seq', { action : 'stop' });
|
|
||||||
}
|
|
||||||
return state
|
|
||||||
};
|
|
||||||
seq.init = function (start) {
|
|
||||||
'use strict';
|
|
||||||
if (typeof start === 'undefined') {
|
|
||||||
start = 0;
|
|
||||||
mcopy.loopCount = 0;
|
|
||||||
seq.time = +new Date();
|
|
||||||
}
|
|
||||||
seq.stop(false);
|
|
||||||
seq.i = start;
|
|
||||||
|
|
||||||
ipcRenderer.send('seq', { action : 'start' });
|
|
||||||
seq.run();
|
|
||||||
};
|
|
||||||
//!!! redo
|
|
||||||
seq.stats = function () {
|
|
||||||
'use strict';
|
|
||||||
var ms = 0,
|
|
||||||
c = '',
|
|
||||||
cam_total = 0,
|
|
||||||
proj_total = 0,
|
|
||||||
real_total = mcopy.state.sequence.arr.filter(function (elem) {
|
|
||||||
if (elem === undefined) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//timing
|
|
||||||
for (var i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
|
||||||
c = mcopy.state.sequence.arr[i];
|
|
||||||
if (c === 'CF' || c === 'CB'){
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'PF' || c === 'PB'){
|
|
||||||
ms += mcopy.cfg.arduino.proj.time;
|
|
||||||
ms += mcopy.cfg.arduino.proj.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
if (c === 'BF' || c === 'BB'){
|
|
||||||
ms += mcopy.cfg.arduino.black.before;
|
|
||||||
ms += mcopy.cfg.arduino.black.after;
|
|
||||||
ms += mcopy.cfg.arduino.cam.time;
|
|
||||||
ms += mcopy.cfg.arduino.cam.delay;
|
|
||||||
ms += mcopy.cfg.arduino.serialDelay;
|
|
||||||
}
|
|
||||||
ms += mcopy.cfg.arduino.sequenceDelay;
|
|
||||||
|
|
||||||
if (c === 'CF' || c === 'BF') {
|
|
||||||
cam_total++;
|
|
||||||
}
|
|
||||||
if (c === 'CB' || c === 'BB') {
|
|
||||||
cam_total--;
|
|
||||||
}
|
|
||||||
if (c === 'PF') {
|
|
||||||
proj_total++;
|
|
||||||
}
|
|
||||||
if (c === 'PB') {
|
|
||||||
proj_total--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//timing
|
|
||||||
ms = ms * mcopy.loop;
|
|
||||||
if (ms < 2000) {
|
|
||||||
$('#seq_stats .timing span').text(ms + 'ms');
|
|
||||||
} else {
|
|
||||||
$('#seq_stats .timing span').text(humanizeDuration(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
//ending frames
|
|
||||||
cam_total = cam_total * mcopy.loop;
|
|
||||||
proj_total = proj_total * mcopy.loop;
|
|
||||||
|
|
||||||
$('#seq_stats .cam_end span').text(gui.fmtZero(mcopy.state.camera.pos + cam_total, 6));
|
|
||||||
$('#seq_stats .proj_end span').text(gui.fmtZero(mcopy.state.projector.pos + proj_total, 6));
|
|
||||||
|
|
||||||
//count
|
|
||||||
$('#seq_stats .seq_count span').text(real_total.length * mcopy.loop);
|
|
||||||
return ms;
|
|
||||||
};
|
|
||||||
seq.clear = function () {
|
|
||||||
'use strict';
|
|
||||||
mcopy.state.sequence.size = 24;
|
|
||||||
mcopy.state.sequence.arr = [];
|
|
||||||
};
|
|
||||||
seq.exec = function (arr) {
|
|
||||||
'use strict';
|
|
||||||
seq.running = true;
|
|
||||||
seq.state.len = arr.length;
|
|
||||||
//setup queue
|
|
||||||
seq.queue = arr;
|
|
||||||
//console.dir(arr);
|
|
||||||
gui.overlay(true);
|
|
||||||
gui.spinner(true, `Running sequence of ${arr.length} frame${(arr.length === 1 ? '' : 's')}`, 0);
|
|
||||||
log.info(`Sequence started`, 'SEQUENCE', true);
|
|
||||||
seq.step();
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.execStop = function (msg) {
|
|
||||||
'use strict';
|
|
||||||
gui.overlay(false);
|
|
||||||
gui.spinner(false);
|
|
||||||
log.info(`Sequence ${msg}`, 'SEQUENCE', true);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
seq.step = function () {
|
|
||||||
'use strict';
|
|
||||||
let elem;
|
|
||||||
let c;
|
|
||||||
let rgb;
|
|
||||||
let current;
|
|
||||||
let max;
|
|
||||||
|
|
||||||
if (!seq.running) {
|
|
||||||
return seq.execStop('stopped');
|
|
||||||
}
|
|
||||||
|
|
||||||
return setTimeout(() => {
|
|
||||||
elem = seq.queue.shift();
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
c = elem.cmd;
|
|
||||||
if (typeof elem.light !== 'undefined') {
|
|
||||||
rgb = elem.light.split(',');
|
|
||||||
} else {
|
|
||||||
rgb = light.color;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return seq.execStop('completed');
|
|
||||||
}
|
|
||||||
if (typeof elem !== 'undefined') {
|
|
||||||
current = seq.state.len - seq.queue.length;
|
|
||||||
max = seq.state.len;
|
|
||||||
gui.spinner(true, `Sequence: step ${c} ${current}/${max}`, (current / max) * 100);
|
|
||||||
log.info(`Sequence: step ${c} ${current}/${max}`, 'SEQUENCE', true);
|
|
||||||
if (c === 'CF'){
|
|
||||||
cmd.cam_forward(rgb, seq.step);
|
|
||||||
} else if (c === 'CB') {
|
|
||||||
cmd.cam_backward(rgb, seq.step);
|
|
||||||
} else if (c === 'PF') {
|
|
||||||
cmd.proj_forward(seq.step);
|
|
||||||
} else if (c === 'PB') {
|
|
||||||
cmd.proj_backward(seq.step);
|
|
||||||
} else if (c === 'BF') {
|
|
||||||
cmd.black_forward(seq.step);
|
|
||||||
} else if (c === 'BB') {
|
|
||||||
cmd.black_backward(seq.step);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, mcopy.cfg.arduino.sequenceDelay);
|
|
||||||
};
|
|
||||||
|
|
||||||
// FROM SERVER SIDE
|
|
||||||
proj.state = {
|
|
||||||
dir : true, //default dir
|
|
||||||
digital : false
|
|
||||||
}
|
|
||||||
proj.init = function () {
|
|
||||||
proj.listen()
|
|
||||||
}
|
|
||||||
proj.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.proj_backward
|
|
||||||
}
|
|
||||||
proj.state.dir = dir
|
|
||||||
if (proj.state.digital) {
|
|
||||||
dig.set(dir)
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
proj.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.projector
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
try {
|
|
||||||
ms = await dig.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('projector', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await proj.end(mcopy.cfg.arduino.cmd.projector, id, ms)
|
|
||||||
}
|
|
||||||
proj.listen = function () {
|
|
||||||
ipcMain.on('proj', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await proj.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.val !== 'undefined') {
|
|
||||||
dig.state.frame = arg.val
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('digital', proj.connectDigital)
|
|
||||||
}
|
|
||||||
proj.end = async function (cmd, id, ms) {
|
|
||||||
let message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.proj_forward) {
|
|
||||||
message = 'Projector set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.proj_backward) {
|
|
||||||
message = 'Projector set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.projector) {
|
|
||||||
message = 'Projector '
|
|
||||||
if (proj.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'PROJECTOR', true, true)
|
|
||||||
return await mainWindow.webContents.send('proj', {cmd: cmd, id : id, ms: ms})
|
|
||||||
}
|
|
||||||
proj.connectDigital = async function (evt, arg) {
|
|
||||||
let info;
|
|
||||||
let frames = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
info = await ffprobe.info(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
frames = await ffprobe.frames(arg.path);
|
|
||||||
} catch (err) {
|
|
||||||
log.error(err, 'DIGITAL', true, true);
|
|
||||||
proj.digital = false;
|
|
||||||
await mainWindow.webContents.send('digital', { valid : false });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.state.frame = 0;
|
|
||||||
dig.state.path = arg.path;
|
|
||||||
dig.state.fileName = arg.fileName;
|
|
||||||
dig.state.frames = frames;
|
|
||||||
dig.state.info = info;
|
|
||||||
|
|
||||||
//console.dir(dig.state);
|
|
||||||
|
|
||||||
log.info(`Opened ${dig.state.fileName}`, 'DIGITAL', true, true);
|
|
||||||
log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
|
||||||
proj.digital = true;
|
|
||||||
return await mainWindow.webContents.send('digital', { valid : true, state : JSON.stringify(dig.state) });
|
|
||||||
}
|
|
||||||
|
|
||||||
const dig = {};
|
|
||||||
dig.state = {
|
|
||||||
frame : 0,
|
|
||||||
frames : 0,
|
|
||||||
path : null,
|
|
||||||
fileName : null,
|
|
||||||
info : {},
|
|
||||||
dir : true
|
|
||||||
};
|
|
||||||
|
|
||||||
dig.set = function (dir) {
|
|
||||||
dig.state.dir = dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.move = async function () {
|
|
||||||
let start = +new Date()
|
|
||||||
let last = dig.state.dir + 0;
|
|
||||||
if (dig.state.dir) {
|
|
||||||
dig.state.frame++
|
|
||||||
} else {
|
|
||||||
dig.state.frame--
|
|
||||||
}
|
|
||||||
if (dig.state.frame < 1) {
|
|
||||||
dig.state.frame = 1
|
|
||||||
}
|
|
||||||
return (+new Date()) - start
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.start = async function () {
|
|
||||||
try {
|
|
||||||
await ffmpeg.clearAll()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ffmpeg.frame(dig.state, light.state)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
display.start(dig.state.frame)
|
|
||||||
await delay(20)
|
|
||||||
}
|
|
||||||
|
|
||||||
dig.end = async function () {
|
|
||||||
await delay(20)
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.intval = null
|
|
||||||
cam.state = {
|
|
||||||
dir : true //default dir
|
|
||||||
}
|
|
||||||
cam.init = function () {
|
|
||||||
cam.listen()
|
|
||||||
}
|
|
||||||
cam.set = async function (dir, id) {
|
|
||||||
let cmd
|
|
||||||
let ms
|
|
||||||
if (dir) {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_forward
|
|
||||||
} else {
|
|
||||||
cmd = mcopy.cfg.arduino.cmd.cam_backward
|
|
||||||
}
|
|
||||||
cam.state.dir = dir
|
|
||||||
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.setDir(dir)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.move = async function (frame, id) {
|
|
||||||
const cmd = mcopy.cfg.arduino.cmd.camera
|
|
||||||
let ms
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.start()
|
|
||||||
}
|
|
||||||
if (cam.intval) {
|
|
||||||
try {
|
|
||||||
ms = await cam.intval.move()
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
ms = await arduino.send('camera', cmd)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (proj.digital) {
|
|
||||||
await dig.end()
|
|
||||||
}
|
|
||||||
log.info('Camera move time', { ms })
|
|
||||||
return cam.end(cmd, id, ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.exposure = function (exposure, id) {
|
|
||||||
let cmd = 'E'
|
|
||||||
cam.intval.setExposure('camera', exposure, ms => {
|
|
||||||
cam.end(cmd, id, ms)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.connectIntval = async function (event, arg) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (arg.connect) {
|
|
||||||
cam.intval = new Intval(arg.url)
|
|
||||||
cam.intval.connect((err, ms, state) => {
|
|
||||||
if (err) {
|
|
||||||
mainWindow.webContents.send('intval', { connected : false })
|
|
||||||
log.info(`Cannot connect to ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
cam.intval = null
|
|
||||||
delete cam.intval
|
|
||||||
} else {
|
|
||||||
mainWindow.webContents.send('intval', { connected : true, url : arg.url, state : state })
|
|
||||||
log.info(`Connected to INTVAL3 @ ${arg.url}`, 'INTVAL', true, true)
|
|
||||||
settings.update('camera', { intval : arg.url })
|
|
||||||
settings.save()
|
|
||||||
dev.remember('intval', arg.url, 'camera')
|
|
||||||
}
|
|
||||||
return resolve(true)
|
|
||||||
})
|
|
||||||
} else if (arg.disconnect) {
|
|
||||||
cam.intval = null
|
|
||||||
return resolve(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cam.listen = function () {
|
|
||||||
ipcMain.on('cam', async (event, arg) => {
|
|
||||||
if (typeof arg.dir !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.set(arg.dir, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
|
||||||
try {
|
|
||||||
await cam.move(arg.frame, arg.id)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.returnValue = true
|
|
||||||
})
|
|
||||||
ipcMain.on('intval', cam.connectIntval)
|
|
||||||
}
|
|
||||||
cam.end = async function (cmd, id, ms) {
|
|
||||||
var message = ''
|
|
||||||
if (cmd === mcopy.cfg.arduino.cmd.cam_forward) {
|
|
||||||
message = 'Camera set to FORWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.cam_backward) {
|
|
||||||
message = 'Camera set to BACKWARD'
|
|
||||||
} else if (cmd === mcopy.cfg.arduino.cmd.camera) {
|
|
||||||
message = 'Camera '
|
|
||||||
if (cam.state.dir) {
|
|
||||||
message += 'ADVANCED'
|
|
||||||
} else {
|
|
||||||
message += 'REWOUND'
|
|
||||||
}
|
|
||||||
message += ' 1 frame'
|
|
||||||
}
|
|
||||||
log.info(message, 'CAMERA', true, true)
|
|
||||||
mainWindow.webContents.send('cam', {cmd: cmd, id : id, ms: ms})
|
|
||||||
};
|
|
||||||
|
|
||||||
const seq = {};
|
|
||||||
seq.init = function () {
|
|
||||||
seq.listen();
|
|
||||||
}
|
|
||||||
|
|
||||||
seq.listen = function () {
|
|
||||||
ipcMain.on('seq', async (evt, arg) => {
|
|
||||||
if (arg.action === 'stop' && proj.digital) {
|
|
||||||
display.end()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
class Sequence {
|
class Sequence {
|
||||||
private i : number;
|
private i : number;
|
||||||
private time : number;
|
private time : number;
|
||||||
|
@ -607,7 +30,7 @@ class Sequence {
|
||||||
* Stop the sequence
|
* Stop the sequence
|
||||||
**/
|
**/
|
||||||
public stop () {
|
public stop () {
|
||||||
|
this.running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public exec () {
|
public exec () {
|
||||||
|
|
Loading…
Reference in New Issue