Secondary projector and secondary camera behaviors have been added to the main process. This is not represented in the UI... yet. All renderer code is still in flux.
This commit is contained in:
parent
18c515402e
commit
7a52bc7c6e
|
@ -404,46 +404,94 @@ button:focus {
|
||||||
padding-bottom: 21px;
|
padding-bottom: 21px;
|
||||||
padding-left: 70px;
|
padding-left: 70px;
|
||||||
}
|
}
|
||||||
#sequence #cam_forward,
|
#sequence #camera_forward,
|
||||||
#sequence #proj_forward,
|
#sequence #camera_second_forward,
|
||||||
|
#sequence #projector_forward,
|
||||||
|
#sequence #projector_second_forward,
|
||||||
#sequence #black_forward {
|
#sequence #black_forward {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
#sequence #cam_forward input[type=checkbox],
|
#sequence #camera_forward input[type=checkbox],
|
||||||
#sequence #proj_forward input[type=checkbox],
|
#sequence #camera_second_forward input[type=checkbox],
|
||||||
|
#sequence #projector_forward input[type=checkbox],
|
||||||
|
#sequence #projector_second_forward input[type=checkbox],
|
||||||
#sequence #black_forward input[type=checkbox] {
|
#sequence #black_forward input[type=checkbox] {
|
||||||
border: 2px solid #00C4A0;
|
border: 2px solid #00C4A0;
|
||||||
}
|
}
|
||||||
#sequence #cam_forward input[type=checkbox]:checked,
|
#sequence #camera_forward input[type=checkbox]:checked,
|
||||||
#sequence #proj_forward input[type=checkbox]:checked,
|
#sequence #camera_second_forward input[type=checkbox]:checked,
|
||||||
|
#sequence #projector_forward input[type=checkbox]:checked,
|
||||||
|
#sequence #projector_second_forward input[type=checkbox]:checked,
|
||||||
#sequence #black_forward input[type=checkbox]:checked {
|
#sequence #black_forward input[type=checkbox]:checked {
|
||||||
background: #00C4A0;
|
background: #00C4A0;
|
||||||
}
|
}
|
||||||
#sequence #cam_forward > div,
|
#sequence #camera_forward > div,
|
||||||
#sequence #proj_forward > div,
|
#sequence #camera_second_forward > div,
|
||||||
|
#sequence #projector_forward > div,
|
||||||
|
#sequence #projector_second_forward > div,
|
||||||
#sequence #black_forward > div {
|
#sequence #black_forward > div {
|
||||||
color: #00C4A0;
|
color: #00C4A0;
|
||||||
}
|
}
|
||||||
#sequence #cam_backward,
|
#sequence #camera_backward,
|
||||||
#sequence #proj_backward,
|
#sequence #camera_second_backward,
|
||||||
|
#sequence #projector_backward,
|
||||||
|
#sequence #projector_second_backward,
|
||||||
#sequence #black_backward {
|
#sequence #black_backward {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
#sequence #cam_backward input[type=checkbox],
|
#sequence #camera_backward input[type=checkbox],
|
||||||
#sequence #proj_backward input[type=checkbox],
|
#sequence #camera_second_backward input[type=checkbox],
|
||||||
|
#sequence #projector_backward input[type=checkbox],
|
||||||
|
#sequence #projector_second_backward input[type=checkbox],
|
||||||
#sequence #black_backward input[type=checkbox] {
|
#sequence #black_backward input[type=checkbox] {
|
||||||
border: 2px solid #AB1A25;
|
border: 2px solid #AB1A25;
|
||||||
}
|
}
|
||||||
#sequence #cam_backward input[type=checkbox]:checked,
|
#sequence #camera_backward input[type=checkbox]:checked,
|
||||||
#sequence #proj_backward input[type=checkbox]:checked,
|
#sequence #camera_second_backward input[type=checkbox]:checked,
|
||||||
|
#sequence #projector_backward input[type=checkbox]:checked,
|
||||||
|
#sequence #projector_second_backward input[type=checkbox]:checked,
|
||||||
#sequence #black_backward input[type=checkbox]:checked {
|
#sequence #black_backward input[type=checkbox]:checked {
|
||||||
background: #AB1A25;
|
background: #AB1A25;
|
||||||
}
|
}
|
||||||
#sequence #cam_backward > div,
|
#sequence #camera_backward > div,
|
||||||
#sequence #proj_backward > div,
|
#sequence #camera_second_backward > div,
|
||||||
|
#sequence #projector_backward > div,
|
||||||
|
#sequence #projector_second_backward > div,
|
||||||
#sequence #black_backward > div {
|
#sequence #black_backward > div {
|
||||||
color: #AB1A25;
|
color: #AB1A25;
|
||||||
}
|
}
|
||||||
|
#sequence #camera_second_forward,
|
||||||
|
#sequence #projector_second_forward {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#sequence #camera_second_forward input[type=checkbox],
|
||||||
|
#sequence #projector_second_forward input[type=checkbox] {
|
||||||
|
border: 2px solid #14d8b4;
|
||||||
|
}
|
||||||
|
#sequence #camera_second_forward input[type=checkbox]:checked,
|
||||||
|
#sequence #projector_second_forward input[type=checkbox]:checked {
|
||||||
|
background: #14d8b4;
|
||||||
|
}
|
||||||
|
#sequence #camera_second_forward > div,
|
||||||
|
#sequence #projector_second_forward > div {
|
||||||
|
color: #14d8b4;
|
||||||
|
}
|
||||||
|
#sequence #camera_second_backward,
|
||||||
|
#sequence #projector_second_backward {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#sequence #camera_second_backward input[type=checkbox],
|
||||||
|
#sequence #projector_second_backward input[type=checkbox] {
|
||||||
|
border: 2px solid #bf2e39;
|
||||||
|
}
|
||||||
|
#sequence #camera_second_backward input[type=checkbox]:checked,
|
||||||
|
#sequence #projector_second_backward input[type=checkbox]:checked {
|
||||||
|
background: #bf2e39;
|
||||||
|
}
|
||||||
|
#sequence #camera_second_backward > div,
|
||||||
|
#sequence #projector_second_backward > div {
|
||||||
|
color: #bf2e39;
|
||||||
|
}
|
||||||
#sequence input[type=checkbox] {
|
#sequence input[type=checkbox] {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
|
|
@ -146,7 +146,10 @@
|
||||||
"camera_second_forward": "1",
|
"camera_second_forward": "1",
|
||||||
"camera_second_backward": "2",
|
"camera_second_backward": "2",
|
||||||
"camera_second": "3",
|
"camera_second": "3",
|
||||||
"cameras": "4"
|
"cameras": "4",
|
||||||
|
"camera_projectors_identifier" : "5",
|
||||||
|
"cameras_projector_identifier" : "6",
|
||||||
|
"cameras_projectors_identifier" : "7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,16 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="seq_scroll">
|
<div id="seq_scroll">
|
||||||
<div id="sequence">
|
<div id="sequence">
|
||||||
<div id="cam_forward" class="row" y="0"></div>
|
<div id="camera_forward" class="row" y="0"></div>
|
||||||
<div id="proj_forward" class="row" y="1"></div>
|
<div id="camera_second_forward" class="row" y="2"></div>
|
||||||
<div id="cam_backward" class="row spacer" y="0"></div>
|
<div id="projector_forward" class="row" y="1"></div>
|
||||||
<div id="proj_backward" class="row" y="1"></div>
|
<div id="projector_second_forward" class="row" y="3"></div>
|
||||||
|
|
||||||
|
<div id="camera_backward" class="row spacer" y="0"></div>
|
||||||
|
<div id="camera_second_backward" class="row" y="2"></div>
|
||||||
|
<div id="projector_backward" class="row" y="1"></div>
|
||||||
|
<div id="projector_second_backward" class="row" y="3"></div>
|
||||||
|
|
||||||
<div id="light_set" class="row spacer"></div>
|
<div id="light_set" class="row spacer"></div>
|
||||||
<div id="numbers" class="row"></div>
|
<div id="numbers" class="row"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -68,36 +68,66 @@
|
||||||
width: 970px;
|
width: 970px;
|
||||||
padding-bottom: 21px;
|
padding-bottom: 21px;
|
||||||
padding-left: 70px;
|
padding-left: 70px;
|
||||||
#cam_forward,
|
#camera_forward,
|
||||||
#proj_forward,
|
#camera_second_forward,
|
||||||
|
#projector_forward,
|
||||||
|
#projector_second_forward,
|
||||||
#black_forward{
|
#black_forward{
|
||||||
clear: both;
|
clear: both;
|
||||||
input[type=checkbox]{
|
input[type=checkbox]{
|
||||||
border: 2px solid @FORWARD;
|
border: 2px solid @FORWARD;
|
||||||
&:checked{
|
&:checked{
|
||||||
background: @FORWARD;
|
background: @FORWARD;
|
||||||
//background: radial-gradient(circle at 25px 25px, #00C4A0, #343434);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>div{
|
>div{
|
||||||
color: @FORWARD;
|
color: @FORWARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#cam_backward,
|
#camera_backward,
|
||||||
#proj_backward,
|
#camera_second_backward,
|
||||||
|
#projector_backward,
|
||||||
|
#projector_second_backward,
|
||||||
#black_backward{
|
#black_backward{
|
||||||
clear: both;
|
clear: both;
|
||||||
input[type=checkbox]{
|
input[type=checkbox]{
|
||||||
border: 2px solid @BACKWARD;
|
border: 2px solid @BACKWARD;
|
||||||
&:checked{
|
&:checked{
|
||||||
background: @BACKWARD;
|
background: @BACKWARD;
|
||||||
//background: radial-gradient(circle at 25px 25px, #AB1A25, #343434);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>div{
|
>div{
|
||||||
color: @BACKWARD;
|
color: @BACKWARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#camera_second_forward,
|
||||||
|
#projector_second_forward {
|
||||||
|
display: none;
|
||||||
|
input[type=checkbox]{
|
||||||
|
border: 2px solid @FORWARD + @SECOND;
|
||||||
|
&:checked{
|
||||||
|
background: @FORWARD + @SECOND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>div{
|
||||||
|
color: @FORWARD + @SECOND;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#camera_second_backward,
|
||||||
|
#projector_second_backward{
|
||||||
|
display: none;
|
||||||
|
input[type=checkbox]{
|
||||||
|
border: 2px solid @BACKWARD + @SECOND;
|
||||||
|
&:checked{
|
||||||
|
background: @BACKWARD + @SECOND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>div{
|
||||||
|
color: @BACKWARD + @SECOND;
|
||||||
|
}
|
||||||
|
}
|
||||||
input[type=checkbox]{
|
input[type=checkbox]{
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
@FORWARD: #00C4A0;
|
@FORWARD: #00C4A0;
|
||||||
@BACKWARD: #AB1A25;
|
@BACKWARD: #AB1A25;
|
||||||
@SELECTED: #DAE035;
|
@SELECTED: #DAE035;
|
||||||
|
@SECOND : rgb(20, 20, 20);
|
||||||
|
|
||||||
@SEQ: #3C3636;
|
@SEQ: #3C3636;
|
||||||
@SCRIPT: rgb(39, 40, 34);
|
@SCRIPT: rgb(39, 40, 34);
|
||||||
|
|
|
@ -99,6 +99,7 @@ class Arduino {
|
||||||
if (this.locks[serial]) {
|
if (this.locks[serial]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.timer = new Date().getTime();
|
||||||
this.locks[serial] = true;
|
this.locks[serial] = true;
|
||||||
await delay(cfg.arduino.serialDelay);
|
await delay(cfg.arduino.serialDelay);
|
||||||
try {
|
try {
|
||||||
|
@ -108,8 +109,8 @@ class Arduino {
|
||||||
return console.error(e);
|
return console.error(e);
|
||||||
}
|
}
|
||||||
this.locks[serial] = false;
|
this.locks[serial] = false;
|
||||||
this.timer = new Date().getTime();
|
await eventEmitter.emit('arduino_send', cmd);
|
||||||
return await eventEmitter.emit('arduino_send', cmd);
|
return results;
|
||||||
}
|
}
|
||||||
async string(serial, str) {
|
async string(serial, str) {
|
||||||
const device = this.alias[serial];
|
const device = this.alias[serial];
|
||||||
|
@ -160,10 +161,10 @@ class Arduino {
|
||||||
else {
|
else {
|
||||||
//console.log('Received stray "' + data + '"'); //silent to user
|
//console.log('Received stray "' + data + '"'); //silent to user
|
||||||
}
|
}
|
||||||
return complete;
|
return ms;
|
||||||
}
|
}
|
||||||
aliasSerial(serial, device) {
|
aliasSerial(serial, device) {
|
||||||
//console.log(`Making "${serial}" an alias of ${device}`)
|
//this.log.info(`Making "${serial}" an alias of ${device}`);
|
||||||
this.alias[serial] = device;
|
this.alias[serial] = device;
|
||||||
}
|
}
|
||||||
async connect(serial, device, confirm) {
|
async connect(serial, device, confirm) {
|
||||||
|
@ -273,21 +274,27 @@ class Arduino {
|
||||||
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera';
|
type = 'projector,camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
else if (data === cfg.arduino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second';
|
type = 'projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.projectors_identifier) {
|
else if (data === cfg.arduino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second';
|
type = 'projector,projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
else if (data === cfg.arduino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second';
|
type = 'camera_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cameras_identifier) {
|
else if (data === cfg.arduino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second';
|
type = 'camera,camera_second';
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
else if (data === cfg.arduino.cmd.camera_projectors_identifier) {
|
||||||
//camera,camera_second,projector
|
type = 'camera,projector,projector_second';
|
||||||
//camera,camera_second,projector,projector_second
|
}
|
||||||
|
else if (data === cfg.arduino.cmd.cameras_projector_identifier) {
|
||||||
|
type = 'camera,camera_second,projector';
|
||||||
|
}
|
||||||
|
else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
|
||||||
|
type = 'camera,camera_second,projector,projector_second';
|
||||||
|
}
|
||||||
return resolve(type);
|
return resolve(type);
|
||||||
};
|
};
|
||||||
await delay(cfg.arduino.serialDelay);
|
await delay(cfg.arduino.serialDelay);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -99,9 +99,22 @@ class Camera {
|
||||||
//await delay(100 * 1000);
|
//await delay(100 * 1000);
|
||||||
await this.dig.end();
|
await this.dig.end();
|
||||||
}
|
}
|
||||||
this.log.info('Camera move time', { ms });
|
//this.log.info('Camera move time', { ms });
|
||||||
return this.end(cmd, id, ms);
|
return this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
|
async both(frame, id) {
|
||||||
|
id = 'cameras';
|
||||||
|
const cmd = this.cfg.arduino.cmd[id];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
|
}
|
||||||
|
//this.log.info('Cameras move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
@ -199,11 +212,15 @@ class Camera {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camerass) {
|
||||||
|
message += 'Cameras both MOVED 1 frame each';
|
||||||
|
}
|
||||||
|
message += ` ${ms}ms`;
|
||||||
this.log.info(message);
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (arduino, cfg, ui, dig) {
|
module.exports = function (arduino, cfg, ui, dig, second) {
|
||||||
return new Camera(arduino, cfg, ui, dig);
|
return new Camera(arduino, cfg, ui, dig, second);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -2,11 +2,15 @@
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const delay = require("delay");
|
const delay = require("delay");
|
||||||
class Commands {
|
class Commands {
|
||||||
constructor(cfg, proj, cam, light) {
|
constructor(cfg, proj, cam, light, cam2 = null, proj2 = null) {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.proj = proj;
|
this.proj = proj;
|
||||||
this.cam = cam;
|
this.cam = cam;
|
||||||
this.light = light;
|
this.light = light;
|
||||||
|
if (cam2)
|
||||||
|
this.cam2 = cam2;
|
||||||
|
if (proj2)
|
||||||
|
this.proj2 = proj2;
|
||||||
this.ipc = require('electron').ipcMain;
|
this.ipc = require('electron').ipcMain;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -142,8 +146,349 @@ class Commands {
|
||||||
}
|
}
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Move the second camera one frame forward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async camera_second_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the second camera one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async camera_second_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame forward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async cameras_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async cameras_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async camera_forward_camera_second_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async camera_backward_camera_second_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the secondary projector forward one frame
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
async projector_second_forward() {
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.proj2.move();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_second_backward() {
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.proj2.move();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projectors_forward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projectors_backward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_forward_projector_second_backward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_backward_projector_second_forward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (cfg, proj, cam, light) {
|
module.exports = function (cfg, proj, cam, light, cam2, proj2) {
|
||||||
return new Commands(cfg, proj, cam, light);
|
return new Commands(cfg, proj, cam, light, cam2, proj2);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -256,7 +256,6 @@ class Devices {
|
||||||
}
|
}
|
||||||
else if (type === 'projector_second') {
|
else if (type === 'projector_second') {
|
||||||
this.connected.projector_second = device;
|
this.connected.projector_second = device;
|
||||||
this.arduino.aliasSerial('projector_second', device);
|
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false);
|
connectSuccess = await this.arduino.connect('projector_second', device, false);
|
||||||
}
|
}
|
||||||
|
@ -267,38 +266,83 @@ class Devices {
|
||||||
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true);
|
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true);
|
||||||
}
|
}
|
||||||
else if (type === 'projector,projector_second') {
|
else if (type === 'projector,projector_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.projector = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('projector', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
this.log.error('Error connecting to projector and secondary projector', err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type === 'camera_second') {
|
else if (type === 'camera_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.camera_second = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('camera_second', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
console.error(err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type === 'camera,camera_second') {
|
else if (type === 'camera,camera_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.camera = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
this.connected.camera_second = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
this.log.error('Error connecting to camera, camera_secondary and projector', err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,projector,projector_second') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, projector and projector_second', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,camera_second,projector') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.camera_second = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second and projector', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,camera_second,projector,projector_second') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.camera_second = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second, projector and projector_second', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
|
||||||
//camera,camera_second,projector
|
|
||||||
//camera,camera_second,projector,projector_second
|
|
||||||
return connectSuccess;
|
return connectSuccess;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -311,7 +355,8 @@ class Devices {
|
||||||
let l = {};
|
let l = {};
|
||||||
let type;
|
let type;
|
||||||
let d;
|
let d;
|
||||||
let s = {};
|
let cs = {};
|
||||||
|
let ps = {};
|
||||||
let checklist = [];
|
let checklist = [];
|
||||||
this.connected = {
|
this.connected = {
|
||||||
projector: false,
|
projector: false,
|
||||||
|
@ -353,10 +398,13 @@ class Devices {
|
||||||
await this.fakeLight();
|
await this.fakeLight();
|
||||||
}
|
}
|
||||||
l.arduino = this.connected.light;
|
l.arduino = this.connected.light;
|
||||||
if (this.connected.projector_second) {
|
if (this.connected.camera_second) {
|
||||||
s = this.connected.projector_second;
|
cs = { arduino: this.connected.camera_second };
|
||||||
}
|
}
|
||||||
return this.ready(p, c, l, s);
|
if (this.connected.projector_second) {
|
||||||
|
ps = { arduino: this.connected.projector_second };
|
||||||
|
}
|
||||||
|
return this.ready(p, c, l, cs, ps);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -382,25 +430,33 @@ class Devices {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
ready(projector, camera, light, projector_second) {
|
ready(projector, camera, light, camera_second, projector_second) {
|
||||||
let args = {
|
let args = {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.state.profile
|
profile: this.settings.state.profile
|
||||||
};
|
};
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second) {
|
||||||
args.projector_second = projector_second;
|
args.projector_second = projector_second;
|
||||||
}
|
|
||||||
this.ui.send('ready', args);
|
|
||||||
this.settings.update('camera', camera);
|
|
||||||
this.settings.update('projector', projector);
|
|
||||||
this.settings.update('light', light);
|
|
||||||
if (projector_second && projector_second.arduino) {
|
|
||||||
this.settings.update('projector_second', projector_second);
|
this.settings.update('projector_second', projector_second);
|
||||||
this.mainWindow.setSize(800, 800);
|
this.mainWindow.setSize(800, 800);
|
||||||
}
|
}
|
||||||
|
if (camera_second) {
|
||||||
|
args.camera_second = camera_second;
|
||||||
|
this.settings.update('camera_second', camera_second);
|
||||||
|
if (projector_second) {
|
||||||
|
this.mainWindow.setSize(900, 800);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.mainWindow.setSize(800, 800);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.settings.update('camera', camera);
|
||||||
|
this.settings.update('projector', projector);
|
||||||
|
this.settings.update('light', light);
|
||||||
this.settings.save();
|
this.settings.save();
|
||||||
|
this.ui.send('ready', args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -84,7 +84,20 @@ class Projector {
|
||||||
this.log.error(`Error moving ${this.id}`, err);
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
//this.log.info('Projector move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms);
|
||||||
|
}
|
||||||
|
async both(frame, id) {
|
||||||
|
id = 'projectors';
|
||||||
|
const cmd = this.cfg.arduino.cmd[id];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
|
}
|
||||||
|
//this.log.info('Projectors move time', { ms });
|
||||||
return await this.end(cmd, id, ms);
|
return await this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +154,7 @@ class Projector {
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
message = 'Projector second';
|
message = 'Projector second ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
message += 'ADVANCED';
|
message += 'ADVANCED';
|
||||||
}
|
}
|
||||||
|
@ -150,11 +163,15 @@ class Projector {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projectors) {
|
||||||
|
message += 'Projectors both MOVED 1 frame each';
|
||||||
|
}
|
||||||
|
message += ` ${ms}ms`;
|
||||||
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (arduino, cfg, ui, dig) {
|
module.exports = function (arduino, cfg, ui, dig, second) {
|
||||||
return new Projector(arduino, cfg, ui, dig);
|
return new Projector(arduino, cfg, ui, dig, second);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -99,6 +99,9 @@ class Sequencer {
|
||||||
while (this.paused) {
|
while (this.paused) {
|
||||||
await delay(42);
|
await delay(42);
|
||||||
}
|
}
|
||||||
|
if (typeof this.arr[y] === 'undefined') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`);
|
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`);
|
||||||
this.ui.send(this.id, { step: y, loop: x, start: true });
|
this.ui.send(this.id, { step: y, loop: x, start: true });
|
||||||
await this.step(y);
|
await this.step(y);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -85,4 +85,11 @@ cam.listen = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cam.second = {};
|
||||||
|
cam.second.queue = {};
|
||||||
|
cam.second.lock = false;
|
||||||
|
cam.second.id = 'camera_second';
|
||||||
|
cam.second.pos = 0;
|
||||||
|
cam.second.dir = true;
|
||||||
|
|
||||||
module.exports = cam;
|
module.exports = cam;
|
|
@ -48,31 +48,35 @@ grid.state = function (x) {
|
||||||
grid.refresh = function () {
|
grid.refresh = function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
const cmds = [
|
const cmds = [
|
||||||
'cam_forward',
|
'camera_forward',
|
||||||
'proj_forward',
|
'camera_second_forward',
|
||||||
'cam_backward',
|
'projector_forward',
|
||||||
'proj_backward',
|
'projector_second_forward',
|
||||||
|
'camera_backward',
|
||||||
|
'camera_second_backward',
|
||||||
|
'projector_backward',
|
||||||
|
'projector_second_backward',
|
||||||
'light_set',
|
'light_set',
|
||||||
'numbers'
|
'numbers'
|
||||||
];
|
];
|
||||||
const check = '<input type="checkbox" x="xxxx" />';
|
|
||||||
const div = '<div x="xxxx"></div>';
|
|
||||||
const width = 970 - 34 + ((940 / 24) * Math.abs(24 - seq.size));
|
const width = 970 - 34 + ((940 / 24) * Math.abs(24 - seq.size));
|
||||||
let elem;
|
let elem;
|
||||||
|
let cmd;
|
||||||
|
|
||||||
$('#sequence').width(`${width}px`);
|
$('#sequence').width(`${width}px`);
|
||||||
for (let i = 0; i < cmds.length; i++) {
|
for (let i = 0; i < cmds.length; i++) {
|
||||||
$('#' + cmds[i]).empty();
|
cmd = `#${cmds[i]}`;
|
||||||
|
$(cmd).empty();
|
||||||
for (let x = 0; x < seq.size; x++) {
|
for (let x = 0; x < seq.size; x++) {
|
||||||
if (i === cmds.length - 1) {
|
if (cmds[i] === 'numbers') {
|
||||||
elem = div.replace('xxxx', x);
|
elem = `<div x="${x}">${x}</div>`
|
||||||
$('#' + cmds[i]).append($(elem).text(x));
|
$(cmd).append($(elem));
|
||||||
} else if (i === cmds.length - 2) {
|
} else if (cmds[i] === 'light_set') {
|
||||||
elem = div.replace('xxxx', x);
|
elem = `<div x="${x}" class="L"></div>`
|
||||||
$('#' + cmds[i]).append($(elem).addClass(cfg.cmd[cmds[i]]));
|
$(cmd).append($(elem));
|
||||||
} else {
|
} else {
|
||||||
elem = check.replace('xxxx', x);
|
elem = `<input type="checkbox" x="${x}" />`;
|
||||||
$('#' + cmds[i]).append($(elem).addClass(cfg.cmd[cmds[i]]));
|
$(cmd).append($(elem).addClass(cfg.cmd[cmds[i]]));
|
||||||
}
|
}
|
||||||
grid.state(x);
|
grid.state(x);
|
||||||
}
|
}
|
||||||
|
@ -87,13 +91,14 @@ grid.click = function (t) {
|
||||||
'use strict';
|
'use strict';
|
||||||
const x = parseInt($(t).attr('x'));
|
const x = parseInt($(t).attr('x'));
|
||||||
let c;
|
let c;
|
||||||
if ($(t).prop('checked')) {
|
|
||||||
|
|
||||||
|
if ($(t).prop('checked')) {
|
||||||
c = $(t).attr('class').replace('.', '');
|
c = $(t).attr('class').replace('.', '');
|
||||||
seq.set(x, c);
|
seq.set(x, c);
|
||||||
} else {
|
} else {
|
||||||
//seq.grid[i] = undefined;
|
seq.grid[i] = undefined;
|
||||||
//delete seq.grid[i];
|
delete seq.grid[i];
|
||||||
|
seq.unset(x);
|
||||||
}
|
}
|
||||||
grid.state(x);
|
grid.state(x);
|
||||||
seq.stats();
|
seq.stats();
|
||||||
|
|
|
@ -2,7 +2,6 @@ const proj = {};
|
||||||
|
|
||||||
proj.queue = {};
|
proj.queue = {};
|
||||||
proj.lock = false;
|
proj.lock = false;
|
||||||
proj.lock2 = false;
|
|
||||||
proj.id = 'projector';
|
proj.id = 'projector';
|
||||||
proj.dir = true;
|
proj.dir = true;
|
||||||
proj.pos = 0;
|
proj.pos = 0;
|
||||||
|
@ -86,14 +85,11 @@ proj.setValue = function (val) {
|
||||||
ipcRenderer.sendSync(proj.id, obj);
|
ipcRenderer.sendSync(proj.id, obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
proj.setValue2 = function (val) {
|
proj.second = {};
|
||||||
'use strict';
|
proj.second.queue = {};
|
||||||
var obj = {
|
proj.second.lock = false;
|
||||||
val: val,
|
proj.second.id = 'projector_second';
|
||||||
second : true,
|
proj.second.dir = true;
|
||||||
id : uuid.v4()
|
proj.second.pos = 0;
|
||||||
};
|
|
||||||
ipcRenderer.sendSync(proj.id, obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = proj;
|
module.exports = proj;
|
|
@ -25,24 +25,22 @@ seq.listener = function (event, arg) {
|
||||||
if (arg.start) {
|
if (arg.start) {
|
||||||
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
||||||
seq.activeStep(arg.step);
|
seq.activeStep(arg.step);
|
||||||
log.info(`Step ${arg.step + 1} running of ${seq.arr.length}`, 'SERIAL', true);
|
log.info(`Step ${arg.step + 1}/${seq.arr.length}, Loop ${arg.loop + 1}/${seq.loops}`, 'SERIAL', true);
|
||||||
log.info(`Loop ${arg.loop + 1} of ${seq.loops}`, 'SERIAL', true);
|
|
||||||
} else if (typeof arg.loop !== 'undefined') {
|
} else if (typeof arg.loop !== 'undefined') {
|
||||||
$('#loop_current').text(gui.fmtZero(arg.loop + 1, 6));
|
$('#loop_current').text(gui.fmtZero(arg.loop + 1, 6));
|
||||||
} else {
|
} else {
|
||||||
//
|
seq.progress(0, 0);
|
||||||
}
|
}
|
||||||
} else if (arg.stop) {
|
} else if (arg.stop) {
|
||||||
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
||||||
//console.log(JSON.stringify(arg))
|
//console.log(JSON.stringify(arg))
|
||||||
seq.progress(arg.step, arg.loop);
|
seq.progress(arg.step + 1, arg.loop);
|
||||||
seq.inactiveAll();
|
seq.inactiveAll();
|
||||||
} else if (typeof arg.loop !== 'undefined') {
|
} else if (typeof arg.loop !== 'undefined') {
|
||||||
$('#loop_current').text('');
|
$('#loop_current').text('');
|
||||||
} else {
|
} else {
|
||||||
gui.overlay(false);
|
gui.overlay(false);
|
||||||
gui.spinner(false);
|
gui.spinner(false);
|
||||||
//seq.progress(0, 0);
|
|
||||||
log.info('Sequence stopped', 'SERIAL', true);
|
log.info('Sequence stopped', 'SERIAL', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,13 +52,14 @@ seq.progress = function (step, loop) {
|
||||||
const len = seq.arr.length;
|
const len = seq.arr.length;
|
||||||
const total = len * seq.loops;
|
const total = len * seq.loops;
|
||||||
let pos = (loop * len) + step;
|
let pos = (loop * len) + step;
|
||||||
let progress;
|
let progress = 0;
|
||||||
|
|
||||||
if (pos === 0) {
|
if (pos > 0 && total > 0) {
|
||||||
progress = 0;
|
|
||||||
} else {
|
|
||||||
progress = (pos / total) * 100;
|
progress = (pos / total) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//console.log(`${progress}%`)
|
||||||
|
|
||||||
elem.attr('aria-valuenow', progress);
|
elem.attr('aria-valuenow', progress);
|
||||||
elem.css('width', `${progress}%`);
|
elem.css('width', `${progress}%`);
|
||||||
}
|
}
|
||||||
|
@ -124,6 +123,18 @@ seq.set = function (x, cmd) {
|
||||||
//update grid?
|
//update grid?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seq.unsetAll = function () {
|
||||||
|
const len = seq.grid.length;
|
||||||
|
const steps = [];
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
if (typeof seq.grid[i] !== 'undefined') {
|
||||||
|
steps.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ipcRenderer.send(seq.id, { unset : steps });
|
||||||
|
seq.grid = [];
|
||||||
|
}
|
||||||
|
|
||||||
seq.unset = function (x) {
|
seq.unset = function (x) {
|
||||||
'use strict';
|
'use strict';
|
||||||
seq.grid[x] = undefined
|
seq.grid[x] = undefined
|
||||||
|
@ -229,7 +240,8 @@ seq.stats = function () {
|
||||||
seq.clear = function () {
|
seq.clear = function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
seq.size = 24;
|
seq.size = 24;
|
||||||
seq.grid = [];
|
seq.unsetAll();
|
||||||
|
seq.progress(0, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
seq.cancel = function () {
|
seq.cancel = function () {
|
||||||
|
|
13
app/main.js
13
app/main.js
|
@ -122,8 +122,19 @@ var init = async function () {
|
||||||
cam = require('cam')(arduino, cfg, mainWindow.webContents, dig)
|
cam = require('cam')(arduino, cfg, mainWindow.webContents, dig)
|
||||||
proj = require('proj')(arduino, cfg, mainWindow.webContents, dig)
|
proj = require('proj')(arduino, cfg, mainWindow.webContents, dig)
|
||||||
|
|
||||||
cmd = require('cmd')(cfg, proj, cam, light)
|
if (dev && dev.connected && dev.connected.camera_second) {
|
||||||
|
cam2 = require('cam')(arduino, cfg, mainWindow.webContents, dig, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dev && dev.connected && dev.connected.projector_second) {
|
||||||
|
proj2 = require('proj')(arduino, cfg, mainWindow.webContents, dig, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd = require('cmd')(cfg, proj, cam, light, cam2, proj2)
|
||||||
seq = require('sequencer')(cfg, cmd, mainWindow.webContents)
|
seq = require('sequencer')(cfg, cmd, mainWindow.webContents)
|
||||||
|
|
||||||
|
await delay(5000)
|
||||||
|
await cmd.projectors_forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('ready', init)
|
app.on('ready', init)
|
||||||
|
|
|
@ -146,7 +146,10 @@
|
||||||
"camera_second_forward": "1",
|
"camera_second_forward": "1",
|
||||||
"camera_second_backward": "2",
|
"camera_second_backward": "2",
|
||||||
"camera_second": "3",
|
"camera_second": "3",
|
||||||
"cameras": "4"
|
"cameras": "4",
|
||||||
|
"camera_projectors_identifier" : "5",
|
||||||
|
"cameras_projector_identifier" : "6",
|
||||||
|
"cameras_projectors_identifier" : "7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ class Arduino {
|
||||||
if (this.locks[serial]) {
|
if (this.locks[serial]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.timer = new Date().getTime();
|
||||||
this.locks[serial] = true;
|
this.locks[serial] = true;
|
||||||
await delay(cfg.arduino.serialDelay);
|
await delay(cfg.arduino.serialDelay);
|
||||||
try {
|
try {
|
||||||
|
@ -108,8 +109,8 @@ class Arduino {
|
||||||
return console.error(e);
|
return console.error(e);
|
||||||
}
|
}
|
||||||
this.locks[serial] = false;
|
this.locks[serial] = false;
|
||||||
this.timer = new Date().getTime();
|
await eventEmitter.emit('arduino_send', cmd);
|
||||||
return await eventEmitter.emit('arduino_send', cmd);
|
return results;
|
||||||
}
|
}
|
||||||
async string(serial, str) {
|
async string(serial, str) {
|
||||||
const device = this.alias[serial];
|
const device = this.alias[serial];
|
||||||
|
@ -160,10 +161,10 @@ class Arduino {
|
||||||
else {
|
else {
|
||||||
//console.log('Received stray "' + data + '"'); //silent to user
|
//console.log('Received stray "' + data + '"'); //silent to user
|
||||||
}
|
}
|
||||||
return complete;
|
return ms;
|
||||||
}
|
}
|
||||||
aliasSerial(serial, device) {
|
aliasSerial(serial, device) {
|
||||||
//console.log(`Making "${serial}" an alias of ${device}`)
|
//this.log.info(`Making "${serial}" an alias of ${device}`);
|
||||||
this.alias[serial] = device;
|
this.alias[serial] = device;
|
||||||
}
|
}
|
||||||
async connect(serial, device, confirm) {
|
async connect(serial, device, confirm) {
|
||||||
|
@ -273,21 +274,27 @@ class Arduino {
|
||||||
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera';
|
type = 'projector,camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
else if (data === cfg.arduino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second';
|
type = 'projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.projectors_identifier) {
|
else if (data === cfg.arduino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second';
|
type = 'projector,projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
else if (data === cfg.arduino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second';
|
type = 'camera_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cameras_identifier) {
|
else if (data === cfg.arduino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second';
|
type = 'camera,camera_second';
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
else if (data === cfg.arduino.cmd.camera_projectors_identifier) {
|
||||||
//camera,camera_second,projector
|
type = 'camera,projector,projector_second';
|
||||||
//camera,camera_second,projector,projector_second
|
}
|
||||||
|
else if (data === cfg.arduino.cmd.cameras_projector_identifier) {
|
||||||
|
type = 'camera,camera_second,projector';
|
||||||
|
}
|
||||||
|
else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
|
||||||
|
type = 'camera,camera_second,projector,projector_second';
|
||||||
|
}
|
||||||
return resolve(type);
|
return resolve(type);
|
||||||
};
|
};
|
||||||
await delay(cfg.arduino.serialDelay);
|
await delay(cfg.arduino.serialDelay);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -99,9 +99,22 @@ class Camera {
|
||||||
//await delay(100 * 1000);
|
//await delay(100 * 1000);
|
||||||
await this.dig.end();
|
await this.dig.end();
|
||||||
}
|
}
|
||||||
this.log.info('Camera move time', { ms });
|
//this.log.info('Camera move time', { ms });
|
||||||
return this.end(cmd, id, ms);
|
return this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
|
async both(frame, id) {
|
||||||
|
id = 'cameras';
|
||||||
|
const cmd = this.cfg.arduino.cmd[id];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
|
}
|
||||||
|
//this.log.info('Cameras move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
@ -199,11 +212,15 @@ class Camera {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camerass) {
|
||||||
|
message += 'Cameras both MOVED 1 frame each';
|
||||||
|
}
|
||||||
|
message += ` ${ms}ms`;
|
||||||
this.log.info(message);
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (arduino, cfg, ui, dig) {
|
module.exports = function (arduino, cfg, ui, dig, second) {
|
||||||
return new Camera(arduino, cfg, ui, dig);
|
return new Camera(arduino, cfg, ui, dig, second);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -2,11 +2,15 @@
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const delay = require("delay");
|
const delay = require("delay");
|
||||||
class Commands {
|
class Commands {
|
||||||
constructor(cfg, proj, cam, light) {
|
constructor(cfg, proj, cam, light, cam2 = null, proj2 = null) {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.proj = proj;
|
this.proj = proj;
|
||||||
this.cam = cam;
|
this.cam = cam;
|
||||||
this.light = light;
|
this.light = light;
|
||||||
|
if (cam2)
|
||||||
|
this.cam2 = cam2;
|
||||||
|
if (proj2)
|
||||||
|
this.proj2 = proj2;
|
||||||
this.ipc = require('electron').ipcMain;
|
this.ipc = require('electron').ipcMain;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -142,8 +146,349 @@ class Commands {
|
||||||
}
|
}
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Move the second camera one frame forward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async camera_second_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the second camera one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async camera_second_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame forward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async cameras_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async cameras_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async camera_forward_camera_second_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async camera_backward_camera_second_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the secondary projector forward one frame
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
async projector_second_forward() {
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.proj2.move();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_second_backward() {
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.proj2.move();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projectors_forward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projectors_backward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_forward_projector_second_backward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_backward_projector_second_forward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (cfg, proj, cam, light) {
|
module.exports = function (cfg, proj, cam, light, cam2, proj2) {
|
||||||
return new Commands(cfg, proj, cam, light);
|
return new Commands(cfg, proj, cam, light, cam2, proj2);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -256,7 +256,6 @@ class Devices {
|
||||||
}
|
}
|
||||||
else if (type === 'projector_second') {
|
else if (type === 'projector_second') {
|
||||||
this.connected.projector_second = device;
|
this.connected.projector_second = device;
|
||||||
this.arduino.aliasSerial('projector_second', device);
|
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false);
|
connectSuccess = await this.arduino.connect('projector_second', device, false);
|
||||||
}
|
}
|
||||||
|
@ -267,38 +266,83 @@ class Devices {
|
||||||
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true);
|
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true);
|
||||||
}
|
}
|
||||||
else if (type === 'projector,projector_second') {
|
else if (type === 'projector,projector_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.projector = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('projector', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
this.log.error('Error connecting to projector and secondary projector', err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type === 'camera_second') {
|
else if (type === 'camera_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.camera_second = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('camera_second', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
console.error(err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type === 'camera,camera_second') {
|
else if (type === 'camera,camera_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.camera = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
this.connected.camera_second = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
this.log.error('Error connecting to camera, camera_secondary and projector', err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,projector,projector_second') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, projector and projector_second', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,camera_second,projector') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.camera_second = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second and projector', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,camera_second,projector,projector_second') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.camera_second = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second, projector and projector_second', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
|
||||||
//camera,camera_second,projector
|
|
||||||
//camera,camera_second,projector,projector_second
|
|
||||||
return connectSuccess;
|
return connectSuccess;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -311,7 +355,8 @@ class Devices {
|
||||||
let l = {};
|
let l = {};
|
||||||
let type;
|
let type;
|
||||||
let d;
|
let d;
|
||||||
let s = {};
|
let cs = {};
|
||||||
|
let ps = {};
|
||||||
let checklist = [];
|
let checklist = [];
|
||||||
this.connected = {
|
this.connected = {
|
||||||
projector: false,
|
projector: false,
|
||||||
|
@ -353,10 +398,13 @@ class Devices {
|
||||||
await this.fakeLight();
|
await this.fakeLight();
|
||||||
}
|
}
|
||||||
l.arduino = this.connected.light;
|
l.arduino = this.connected.light;
|
||||||
if (this.connected.projector_second) {
|
if (this.connected.camera_second) {
|
||||||
s = this.connected.projector_second;
|
cs = { arduino: this.connected.camera_second };
|
||||||
}
|
}
|
||||||
return this.ready(p, c, l, s);
|
if (this.connected.projector_second) {
|
||||||
|
ps = { arduino: this.connected.projector_second };
|
||||||
|
}
|
||||||
|
return this.ready(p, c, l, cs, ps);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -382,25 +430,33 @@ class Devices {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
ready(projector, camera, light, projector_second) {
|
ready(projector, camera, light, camera_second, projector_second) {
|
||||||
let args = {
|
let args = {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.state.profile
|
profile: this.settings.state.profile
|
||||||
};
|
};
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second) {
|
||||||
args.projector_second = projector_second;
|
args.projector_second = projector_second;
|
||||||
}
|
|
||||||
this.ui.send('ready', args);
|
|
||||||
this.settings.update('camera', camera);
|
|
||||||
this.settings.update('projector', projector);
|
|
||||||
this.settings.update('light', light);
|
|
||||||
if (projector_second && projector_second.arduino) {
|
|
||||||
this.settings.update('projector_second', projector_second);
|
this.settings.update('projector_second', projector_second);
|
||||||
this.mainWindow.setSize(800, 800);
|
this.mainWindow.setSize(800, 800);
|
||||||
}
|
}
|
||||||
|
if (camera_second) {
|
||||||
|
args.camera_second = camera_second;
|
||||||
|
this.settings.update('camera_second', camera_second);
|
||||||
|
if (projector_second) {
|
||||||
|
this.mainWindow.setSize(900, 800);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.mainWindow.setSize(800, 800);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.settings.update('camera', camera);
|
||||||
|
this.settings.update('projector', projector);
|
||||||
|
this.settings.update('light', light);
|
||||||
this.settings.save();
|
this.settings.save();
|
||||||
|
this.ui.send('ready', args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -84,7 +84,20 @@ class Projector {
|
||||||
this.log.error(`Error moving ${this.id}`, err);
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
//this.log.info('Projector move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms);
|
||||||
|
}
|
||||||
|
async both(frame, id) {
|
||||||
|
id = 'projectors';
|
||||||
|
const cmd = this.cfg.arduino.cmd[id];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
|
}
|
||||||
|
//this.log.info('Projectors move time', { ms });
|
||||||
return await this.end(cmd, id, ms);
|
return await this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +154,7 @@ class Projector {
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
message = 'Projector second';
|
message = 'Projector second ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
message += 'ADVANCED';
|
message += 'ADVANCED';
|
||||||
}
|
}
|
||||||
|
@ -150,11 +163,15 @@ class Projector {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projectors) {
|
||||||
|
message += 'Projectors both MOVED 1 frame each';
|
||||||
|
}
|
||||||
|
message += ` ${ms}ms`;
|
||||||
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (arduino, cfg, ui, dig) {
|
module.exports = function (arduino, cfg, ui, dig, second) {
|
||||||
return new Projector(arduino, cfg, ui, dig);
|
return new Projector(arduino, cfg, ui, dig, second);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -99,6 +99,9 @@ class Sequencer {
|
||||||
while (this.paused) {
|
while (this.paused) {
|
||||||
await delay(42);
|
await delay(42);
|
||||||
}
|
}
|
||||||
|
if (typeof this.arr[y] === 'undefined') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`);
|
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`);
|
||||||
this.ui.send(this.id, { step: y, loop: x, start: true });
|
this.ui.send(this.id, { step: y, loop: x, start: true });
|
||||||
await this.step(y);
|
await this.step(y);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -146,7 +146,10 @@
|
||||||
"camera_second_forward": "1",
|
"camera_second_forward": "1",
|
||||||
"camera_second_backward": "2",
|
"camera_second_backward": "2",
|
||||||
"camera_second": "3",
|
"camera_second": "3",
|
||||||
"cameras": "4"
|
"cameras": "4",
|
||||||
|
"camera_projectors_identifier" : "5",
|
||||||
|
"cameras_projector_identifier" : "6",
|
||||||
|
"cameras_projectors_identifier" : "7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ const char cmd_debug = 'd';
|
||||||
const char cmd_connect = 'i';
|
const char cmd_connect = 'i';
|
||||||
volatile char cmd_char = 'z';
|
volatile char cmd_char = 'z';
|
||||||
const char cmd_mcopy_identifier = 'm';
|
const char cmd_mcopy_identifier = 'm';
|
||||||
const char cmd_proj_identifier = 'j'; //'d'; //dual projector identifier
|
const char cmd_proj_identifier = 'd'; //dual projector identifier
|
||||||
|
|
||||||
const int serialDelay = 5;
|
const int serialDelay = 5;
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,15 @@ const int proj_delay = 42;
|
||||||
boolean proj_dir = true;
|
boolean proj_dir = true;
|
||||||
boolean proj_running = false;
|
boolean proj_running = false;
|
||||||
|
|
||||||
const char cmd_projector = 'p';
|
const char cmd_projector = 'w'; //_second
|
||||||
const char cmd_proj_forward = 'g';
|
const char cmd_proj_forward = 'u';
|
||||||
const char cmd_proj_backward = 'h';
|
const char cmd_proj_backward = 'v';
|
||||||
|
|
||||||
const char cmd_debug = 'd';
|
const char cmd_debug = 'd';
|
||||||
const char cmd_connect = 'i';
|
const char cmd_connect = 'i';
|
||||||
volatile char cmd_char = 'z';
|
volatile char cmd_char = 'z';
|
||||||
const char cmd_mcopy_identifier = 'm';
|
const char cmd_mcopy_identifier = 'm';
|
||||||
const char cmd_proj_identifier = 'j';
|
const char cmd_proj_identifier = 't'; //_second
|
||||||
|
|
||||||
const int serialDelay = 5;
|
const int serialDelay = 5;
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ class Arduino {
|
||||||
if (this.locks[serial]) {
|
if (this.locks[serial]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.timer = new Date().getTime();
|
||||||
this.locks[serial] = true;
|
this.locks[serial] = true;
|
||||||
await delay(cfg.arduino.serialDelay);
|
await delay(cfg.arduino.serialDelay);
|
||||||
try {
|
try {
|
||||||
|
@ -108,8 +109,8 @@ class Arduino {
|
||||||
return console.error(e);
|
return console.error(e);
|
||||||
}
|
}
|
||||||
this.locks[serial] = false;
|
this.locks[serial] = false;
|
||||||
this.timer = new Date().getTime();
|
await eventEmitter.emit('arduino_send', cmd);
|
||||||
return await eventEmitter.emit('arduino_send', cmd);
|
return results;
|
||||||
}
|
}
|
||||||
async string(serial, str) {
|
async string(serial, str) {
|
||||||
const device = this.alias[serial];
|
const device = this.alias[serial];
|
||||||
|
@ -160,10 +161,10 @@ class Arduino {
|
||||||
else {
|
else {
|
||||||
//console.log('Received stray "' + data + '"'); //silent to user
|
//console.log('Received stray "' + data + '"'); //silent to user
|
||||||
}
|
}
|
||||||
return complete;
|
return ms;
|
||||||
}
|
}
|
||||||
aliasSerial(serial, device) {
|
aliasSerial(serial, device) {
|
||||||
//console.log(`Making "${serial}" an alias of ${device}`)
|
//this.log.info(`Making "${serial}" an alias of ${device}`);
|
||||||
this.alias[serial] = device;
|
this.alias[serial] = device;
|
||||||
}
|
}
|
||||||
async connect(serial, device, confirm) {
|
async connect(serial, device, confirm) {
|
||||||
|
@ -273,21 +274,27 @@ class Arduino {
|
||||||
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera';
|
type = 'projector,camera';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
else if (data === cfg.arduino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second';
|
type = 'projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.projectors_identifier) {
|
else if (data === cfg.arduino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second';
|
type = 'projector,projector_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
else if (data === cfg.arduino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second';
|
type = 'camera_second';
|
||||||
}
|
}
|
||||||
else if (data === cfg.ardino.cmd.cameras_identifier) {
|
else if (data === cfg.arduino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second';
|
type = 'camera,camera_second';
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
else if (data === cfg.arduino.cmd.camera_projectors_identifier) {
|
||||||
//camera,camera_second,projector
|
type = 'camera,projector,projector_second';
|
||||||
//camera,camera_second,projector,projector_second
|
}
|
||||||
|
else if (data === cfg.arduino.cmd.cameras_projector_identifier) {
|
||||||
|
type = 'camera,camera_second,projector';
|
||||||
|
}
|
||||||
|
else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
|
||||||
|
type = 'camera,camera_second,projector,projector_second';
|
||||||
|
}
|
||||||
return resolve(type);
|
return resolve(type);
|
||||||
};
|
};
|
||||||
await delay(cfg.arduino.serialDelay);
|
await delay(cfg.arduino.serialDelay);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -99,9 +99,22 @@ class Camera {
|
||||||
//await delay(100 * 1000);
|
//await delay(100 * 1000);
|
||||||
await this.dig.end();
|
await this.dig.end();
|
||||||
}
|
}
|
||||||
this.log.info('Camera move time', { ms });
|
//this.log.info('Camera move time', { ms });
|
||||||
return this.end(cmd, id, ms);
|
return this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
|
async both(frame, id) {
|
||||||
|
id = 'cameras';
|
||||||
|
const cmd = this.cfg.arduino.cmd[id];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
|
}
|
||||||
|
//this.log.info('Cameras move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
@ -199,11 +212,15 @@ class Camera {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.camerass) {
|
||||||
|
message += 'Cameras both MOVED 1 frame each';
|
||||||
|
}
|
||||||
|
message += ` ${ms}ms`;
|
||||||
this.log.info(message);
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (arduino, cfg, ui, dig) {
|
module.exports = function (arduino, cfg, ui, dig, second) {
|
||||||
return new Camera(arduino, cfg, ui, dig);
|
return new Camera(arduino, cfg, ui, dig, second);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
351
lib/cmd/index.js
351
lib/cmd/index.js
|
@ -2,11 +2,15 @@
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const delay = require("delay");
|
const delay = require("delay");
|
||||||
class Commands {
|
class Commands {
|
||||||
constructor(cfg, proj, cam, light) {
|
constructor(cfg, proj, cam, light, cam2 = null, proj2 = null) {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.proj = proj;
|
this.proj = proj;
|
||||||
this.cam = cam;
|
this.cam = cam;
|
||||||
this.light = light;
|
this.light = light;
|
||||||
|
if (cam2)
|
||||||
|
this.cam2 = cam2;
|
||||||
|
if (proj2)
|
||||||
|
this.proj2 = proj2;
|
||||||
this.ipc = require('electron').ipcMain;
|
this.ipc = require('electron').ipcMain;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -142,8 +146,349 @@ class Commands {
|
||||||
}
|
}
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Move the second camera one frame forward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async camera_second_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the second camera one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async camera_second_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame forward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async cameras_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
async cameras_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async camera_forward_camera_second_backward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async camera_backward_camera_second_forward(rgb = [255, 255, 255]) {
|
||||||
|
const off = [0, 0, 0];
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the secondary projector forward one frame
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
async projector_second_forward() {
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.proj2.move();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_second_backward() {
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.proj2.move();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projectors_forward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projectors_backward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_forward_projector_second_backward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
async projector_backward_projector_second_forward() {
|
||||||
|
let both;
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (cfg, proj, cam, light) {
|
module.exports = function (cfg, proj, cam, light, cam2, proj2) {
|
||||||
return new Commands(cfg, proj, cam, light);
|
return new Commands(cfg, proj, cam, light, cam2, proj2);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -256,7 +256,6 @@ class Devices {
|
||||||
}
|
}
|
||||||
else if (type === 'projector_second') {
|
else if (type === 'projector_second') {
|
||||||
this.connected.projector_second = device;
|
this.connected.projector_second = device;
|
||||||
this.arduino.aliasSerial('projector_second', device);
|
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false);
|
connectSuccess = await this.arduino.connect('projector_second', device, false);
|
||||||
}
|
}
|
||||||
|
@ -267,38 +266,83 @@ class Devices {
|
||||||
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true);
|
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true);
|
||||||
}
|
}
|
||||||
else if (type === 'projector,projector_second') {
|
else if (type === 'projector,projector_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.projector = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('projector', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
this.log.error('Error connecting to projector and secondary projector', err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type === 'camera_second') {
|
else if (type === 'camera_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.camera_second = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('camera_second', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
console.error(err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type === 'camera,camera_second') {
|
else if (type === 'camera,camera_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.camera = device;
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
this.connected.camera_second = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
} catch (err) {
|
}
|
||||||
console.error(err)
|
catch (err) {
|
||||||
return false
|
this.log.error('Error connecting to camera, camera_secondary and projector', err);
|
||||||
}*/
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,projector,projector_second') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, projector and projector_second', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,camera_second,projector') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.camera_second = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second and projector', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ('camera,camera_second,projector,projector_second') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.camera_second = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('camera_second', device);
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
this.arduino.aliasSerial('projector_second', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second, projector and projector_second', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
|
||||||
//camera,camera_second,projector
|
|
||||||
//camera,camera_second,projector,projector_second
|
|
||||||
return connectSuccess;
|
return connectSuccess;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -311,7 +355,8 @@ class Devices {
|
||||||
let l = {};
|
let l = {};
|
||||||
let type;
|
let type;
|
||||||
let d;
|
let d;
|
||||||
let s = {};
|
let cs = {};
|
||||||
|
let ps = {};
|
||||||
let checklist = [];
|
let checklist = [];
|
||||||
this.connected = {
|
this.connected = {
|
||||||
projector: false,
|
projector: false,
|
||||||
|
@ -353,10 +398,13 @@ class Devices {
|
||||||
await this.fakeLight();
|
await this.fakeLight();
|
||||||
}
|
}
|
||||||
l.arduino = this.connected.light;
|
l.arduino = this.connected.light;
|
||||||
if (this.connected.projector_second) {
|
if (this.connected.camera_second) {
|
||||||
s = this.connected.projector_second;
|
cs = { arduino: this.connected.camera_second };
|
||||||
}
|
}
|
||||||
return this.ready(p, c, l, s);
|
if (this.connected.projector_second) {
|
||||||
|
ps = { arduino: this.connected.projector_second };
|
||||||
|
}
|
||||||
|
return this.ready(p, c, l, cs, ps);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -382,25 +430,33 @@ class Devices {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
ready(projector, camera, light, projector_second) {
|
ready(projector, camera, light, camera_second, projector_second) {
|
||||||
let args = {
|
let args = {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.state.profile
|
profile: this.settings.state.profile
|
||||||
};
|
};
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second) {
|
||||||
args.projector_second = projector_second;
|
args.projector_second = projector_second;
|
||||||
}
|
|
||||||
this.ui.send('ready', args);
|
|
||||||
this.settings.update('camera', camera);
|
|
||||||
this.settings.update('projector', projector);
|
|
||||||
this.settings.update('light', light);
|
|
||||||
if (projector_second && projector_second.arduino) {
|
|
||||||
this.settings.update('projector_second', projector_second);
|
this.settings.update('projector_second', projector_second);
|
||||||
this.mainWindow.setSize(800, 800);
|
this.mainWindow.setSize(800, 800);
|
||||||
}
|
}
|
||||||
|
if (camera_second) {
|
||||||
|
args.camera_second = camera_second;
|
||||||
|
this.settings.update('camera_second', camera_second);
|
||||||
|
if (projector_second) {
|
||||||
|
this.mainWindow.setSize(900, 800);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.mainWindow.setSize(800, 800);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.settings.update('camera', camera);
|
||||||
|
this.settings.update('projector', projector);
|
||||||
|
this.settings.update('light', light);
|
||||||
this.settings.save();
|
this.settings.save();
|
||||||
|
this.ui.send('ready', args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -84,7 +84,20 @@ class Projector {
|
||||||
this.log.error(`Error moving ${this.id}`, err);
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
//this.log.info('Projector move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms);
|
||||||
|
}
|
||||||
|
async both(frame, id) {
|
||||||
|
id = 'projectors';
|
||||||
|
const cmd = this.cfg.arduino.cmd[id];
|
||||||
|
let ms;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err);
|
||||||
|
}
|
||||||
|
//this.log.info('Projectors move time', { ms });
|
||||||
return await this.end(cmd, id, ms);
|
return await this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +154,7 @@ class Projector {
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
message = 'Projector second';
|
message = 'Projector second ';
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
message += 'ADVANCED';
|
message += 'ADVANCED';
|
||||||
}
|
}
|
||||||
|
@ -150,11 +163,15 @@ class Projector {
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
}
|
}
|
||||||
|
else if (cmd === this.cfg.arduino.cmd.projectors) {
|
||||||
|
message += 'Projectors both MOVED 1 frame each';
|
||||||
|
}
|
||||||
|
message += ` ${ms}ms`;
|
||||||
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = function (arduino, cfg, ui, dig) {
|
module.exports = function (arduino, cfg, ui, dig, second) {
|
||||||
return new Projector(arduino, cfg, ui, dig);
|
return new Projector(arduino, cfg, ui, dig, second);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -99,6 +99,9 @@ class Sequencer {
|
||||||
while (this.paused) {
|
while (this.paused) {
|
||||||
await delay(42);
|
await delay(42);
|
||||||
}
|
}
|
||||||
|
if (typeof this.arr[y] === 'undefined') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`);
|
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`);
|
||||||
this.ui.send(this.id, { step: y, loop: x, start: true });
|
this.ui.send(this.id, { step: y, loop: x, start: true });
|
||||||
await this.step(y);
|
await this.step(y);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -146,7 +146,10 @@
|
||||||
"camera_second_forward": "1",
|
"camera_second_forward": "1",
|
||||||
"camera_second_backward": "2",
|
"camera_second_backward": "2",
|
||||||
"camera_second": "3",
|
"camera_second": "3",
|
||||||
"cameras": "4"
|
"cameras": "4",
|
||||||
|
"camera_projectors_identifier" : "5",
|
||||||
|
"cameras_projector_identifier" : "6",
|
||||||
|
"cameras_projectors_identifier" : "7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ class Arduino {
|
||||||
if (this.locks[serial]) {
|
if (this.locks[serial]) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
this.timer = new Date().getTime()
|
||||||
this.locks[serial] = true
|
this.locks[serial] = true
|
||||||
await delay(cfg.arduino.serialDelay)
|
await delay(cfg.arduino.serialDelay)
|
||||||
try {
|
try {
|
||||||
|
@ -115,8 +116,9 @@ class Arduino {
|
||||||
return console.error(e)
|
return console.error(e)
|
||||||
}
|
}
|
||||||
this.locks[serial] = false
|
this.locks[serial] = false
|
||||||
this.timer = new Date().getTime()
|
|
||||||
return await eventEmitter.emit('arduino_send', cmd)
|
await eventEmitter.emit('arduino_send', cmd)
|
||||||
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
async string (serial : string, str : string) {
|
async string (serial : string, str : string) {
|
||||||
|
@ -156,23 +158,23 @@ class Arduino {
|
||||||
}
|
}
|
||||||
|
|
||||||
end (serial : string, data : string) {
|
end (serial : string, data : string) {
|
||||||
const end = new Date().getTime()
|
const end = new Date().getTime();
|
||||||
const ms = end - this.timer
|
const ms = end - this.timer;
|
||||||
let complete
|
let complete;
|
||||||
if (this.queue[data] !== undefined) {
|
if (this.queue[data] !== undefined) {
|
||||||
this.locks[serial] = false;
|
this.locks[serial] = false;
|
||||||
complete = this.queue[data](ms) //execute callback
|
complete = this.queue[data](ms); //execute callback
|
||||||
eventEmitter.emit('arduino_end', data)
|
eventEmitter.emit('arduino_end', data);
|
||||||
delete this.queue[data]
|
delete this.queue[data];
|
||||||
} else {
|
} else {
|
||||||
//console.log('Received stray "' + data + '"'); //silent to user
|
//console.log('Received stray "' + data + '"'); //silent to user
|
||||||
}
|
}
|
||||||
return complete
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
aliasSerial (serial : string, device : string) {
|
aliasSerial (serial : string, device : string) {
|
||||||
//console.log(`Making "${serial}" an alias of ${device}`)
|
//this.log.info(`Making "${serial}" an alias of ${device}`);
|
||||||
this.alias[serial] = device
|
this.alias[serial] = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect (serial : string, device : string, confirm : any) {
|
async connect (serial : string, device : string, confirm : any) {
|
||||||
|
@ -280,18 +282,21 @@ class Arduino {
|
||||||
type = 'projector,camera,light'
|
type = 'projector,camera,light'
|
||||||
} else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
} else if (data === cfg.arduino.cmd.projector_camera_identifier) {
|
||||||
type = 'projector,camera'
|
type = 'projector,camera'
|
||||||
} else if (data === cfg.ardino.cmd.projector_second_identifier) {
|
} else if (data === cfg.arduino.cmd.projector_second_identifier) {
|
||||||
type = 'projector_second'
|
type = 'projector_second'
|
||||||
} else if (data === cfg.ardino.cmd.projectors_identifier) {
|
} else if (data === cfg.arduino.cmd.projectors_identifier) {
|
||||||
type = 'projector,projector_second'
|
type = 'projector,projector_second'
|
||||||
} else if (data === cfg.ardino.cmd.camera_second_identifier) {
|
} else if (data === cfg.arduino.cmd.camera_second_identifier) {
|
||||||
type = 'camera_second'
|
type = 'camera_second'
|
||||||
} else if (data === cfg.ardino.cmd.cameras_identifier) {
|
} else if (data === cfg.arduino.cmd.cameras_identifier) {
|
||||||
type = 'camera,camera_second'
|
type = 'camera,camera_second'
|
||||||
|
} else if (data === cfg.arduino.cmd.camera_projectors_identifier) {
|
||||||
|
type = 'camera,projector,projector_second'
|
||||||
|
} else if (data === cfg.arduino.cmd.cameras_projector_identifier) {
|
||||||
|
type = 'camera,camera_second,projector'
|
||||||
|
} else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
|
||||||
|
type = 'camera,camera_second,projector,projector_second'
|
||||||
}
|
}
|
||||||
//camera,projector,projector_second
|
|
||||||
//camera,camera_second,projector
|
|
||||||
//camera,camera_second,projector,projector_second
|
|
||||||
return resolve(type)
|
return resolve(type)
|
||||||
}
|
}
|
||||||
await delay(cfg.arduino.serialDelay)
|
await delay(cfg.arduino.serialDelay)
|
||||||
|
|
|
@ -105,10 +105,23 @@ class Camera {
|
||||||
//await delay(100 * 1000);
|
//await delay(100 * 1000);
|
||||||
await this.dig.end();
|
await this.dig.end();
|
||||||
}
|
}
|
||||||
this.log.info('Camera move time', { ms });
|
//this.log.info('Camera move time', { ms });
|
||||||
return this.end(cmd, id, ms);
|
return this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async both (frame : any, id : string) {
|
||||||
|
id = 'cameras';
|
||||||
|
const cmd : string = this.cfg.arduino.cmd[id];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err)
|
||||||
|
}
|
||||||
|
//this.log.info('Cameras move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
@ -195,12 +208,15 @@ class Camera {
|
||||||
message += 'REWOUND';
|
message += 'REWOUND';
|
||||||
}
|
}
|
||||||
message += ' 1 frame';
|
message += ' 1 frame';
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.camerass) {
|
||||||
|
message += 'Cameras both MOVED 1 frame each';
|
||||||
}
|
}
|
||||||
|
message += ` ${ms}ms`
|
||||||
this.log.info(message);
|
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});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function (arduino : Arduino, cfg : any, ui : any, dig : any) {
|
module.exports = function (arduino : Arduino, cfg : any, ui : any, dig : any, second : boolean) {
|
||||||
return new Camera(arduino, cfg, ui, dig);
|
return new Camera(arduino, cfg, ui, dig, second);
|
||||||
}
|
}
|
376
src/cmd/index.ts
376
src/cmd/index.ts
|
@ -7,15 +7,21 @@ class Commands {
|
||||||
private cam : any;
|
private cam : any;
|
||||||
private light : any;
|
private light : any;
|
||||||
|
|
||||||
|
private cam2 : any;
|
||||||
|
private proj2 : any;
|
||||||
|
|
||||||
private cfg : any;
|
private cfg : any;
|
||||||
private ipc : any;
|
private ipc : any;
|
||||||
|
|
||||||
constructor (cfg : any, proj : any, cam : any, light : any) {
|
constructor (cfg : any, proj : any, cam : any, light : any, cam2 : any = null, proj2 : any = null) {
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
this.proj = proj;
|
this.proj = proj;
|
||||||
this.cam = cam;
|
this.cam = cam;
|
||||||
this.light = light;
|
this.light = light;
|
||||||
|
|
||||||
|
if (cam2) this.cam2 = cam2;
|
||||||
|
if (proj2) this.proj2 = proj2;
|
||||||
|
|
||||||
this.ipc = require('electron').ipcMain;
|
this.ipc = require('electron').ipcMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,52 +153,348 @@ class Commands {
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
camera_second_forward : 'C2F',
|
* Move the second camera one frame forward
|
||||||
camera_second_backward : 'C2B',
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
public async camera_second_forward (rgb : number[] = [255, 255, 255]) {
|
||||||
|
const off : number[] = [0, 0, 0];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the second camera one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
public async camera_second_backward (rgb : number[] = [255, 255, 255]) {
|
||||||
|
const off : number[] = [0, 0, 0];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.cam2.move();
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame forward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
public async cameras_forward (rgb : number[] = [255, 255, 255]) {
|
||||||
|
const off : number[] = [0, 0, 0];
|
||||||
|
let both : number[];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
} else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Move the both cameras one frame backward
|
||||||
|
*
|
||||||
|
* @param {array} rgb Color to set light for frame
|
||||||
|
**/
|
||||||
|
public async cameras_backward (rgb : number[] = [255, 255, 255]) {
|
||||||
|
const off : number[] = [0, 0, 0];
|
||||||
|
let both : number[];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
} else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async camera_forward_camera_second_backward (rgb : number[] = [255, 255, 255]) {
|
||||||
|
const off : number[] = [0, 0, 0];
|
||||||
|
let both : number[];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (!this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(true);
|
||||||
|
}
|
||||||
|
if (this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
} else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async camera_backward_camera_second_forward (rgb : number[] = [255, 255, 255]) {
|
||||||
|
const off : number[] = [0, 0, 0];
|
||||||
|
let both : number[];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (this.cam.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam.set(false);
|
||||||
|
}
|
||||||
|
if (!this.cam2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.cam2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(rgb);
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
|
||||||
|
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
|
||||||
|
ms = await this.cam.both();
|
||||||
|
} else {
|
||||||
|
this.cam.move();
|
||||||
|
this.cam.move();
|
||||||
|
both = [await this.cam.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.light.set(off);
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
cameras_forward : 'CCF',
|
|
||||||
cameras_forward : 'CCB',
|
|
||||||
|
|
||||||
camera_forward_camera_second_backward : 'CFCB',
|
|
||||||
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
|
|
||||||
**/
|
**/
|
||||||
/*cmd.projector_second_forward = function (callback) {
|
public async projector_second_forward () {
|
||||||
'use strict';
|
let ms : number;
|
||||||
var res = function (ms) {
|
try {
|
||||||
$('#cmd_proj2_forward').removeClass('active');
|
if (!this.proj2.state.dir) {
|
||||||
gui.updateState();
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
if (callback) { callback(ms); }
|
await this.proj2.set(true);
|
||||||
};
|
}
|
||||||
$('#cmd_proj2_forward').addClass('active');
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
if (!mcopy.state.projector2.direction) {
|
ms = await this.proj2.move();
|
||||||
proj.set2(true, function (ms) {
|
} catch (err) {
|
||||||
setTimeout(function () {
|
throw err;
|
||||||
proj.move2(res);
|
}
|
||||||
}, this.cfg.arduino.serialDelay);
|
return ms;
|
||||||
});
|
}
|
||||||
} else {
|
public async projector_second_backward () {
|
||||||
setTimeout(function () {
|
let ms : number;
|
||||||
proj.move2(res);
|
try {
|
||||||
}, this.cfg.arduino.serialDelay);
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
ms = await this.proj2.move();
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
cmd.projector_second_backward = function (callback) {};
|
|
||||||
|
|
||||||
cmd.projectors_forward = function (callback) {};
|
public async projectors_forward () {
|
||||||
cmd.projectors_backward = function (callback) {};
|
let both : number[];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
} else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
cmd.projector_forward_projector_second_backward = function (callback) {};
|
public async projectors_backward () {
|
||||||
cmd.projector_backward_projector_second_forward = function (callback) {};
|
let both : number[];
|
||||||
*/
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
} else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async projector_forward_projector_second_backward () {
|
||||||
|
let both : number[];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (!this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(true);
|
||||||
|
}
|
||||||
|
if (this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(false);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
} else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async projector_backward_projector_second_forward () {
|
||||||
|
let both : number[];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
if (this.proj.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj.set(false);
|
||||||
|
}
|
||||||
|
if (!this.proj2.state.dir) {
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
await this.proj2.set(true);
|
||||||
|
}
|
||||||
|
await delay(this.cfg.arduino.serialDelay);
|
||||||
|
//run one projector without await?
|
||||||
|
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
|
||||||
|
ms = await this.proj.both();
|
||||||
|
} else {
|
||||||
|
this.proj.move();
|
||||||
|
this.proj2.move();
|
||||||
|
both = [await this.proj.move, await this.proj2.move];
|
||||||
|
ms = Math.max(...both);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function (cfg : any, proj : any, cam : any, light : any) {
|
module.exports = function (cfg : any, proj : any, cam : any, light : any, cam2 : any, proj2 : any) {
|
||||||
return new Commands(cfg, proj, cam, light);
|
return new Commands(cfg, proj, cam, light, cam2, proj2);
|
||||||
}
|
}
|
|
@ -257,7 +257,6 @@ class Devices {
|
||||||
this.log.info(`Connected to ${device} as PROJECTOR + CAMERA`, 'SERIAL', true, true)
|
this.log.info(`Connected to ${device} as PROJECTOR + CAMERA`, 'SERIAL', true, true)
|
||||||
} else if (type === 'projector_second') {
|
} else if (type === 'projector_second') {
|
||||||
this.connected.projector_second = device
|
this.connected.projector_second = device
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -266,37 +265,74 @@ class Devices {
|
||||||
}
|
}
|
||||||
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true)
|
this.log.info(`Connected to ${device} as PROJECTOR_SECOND`, 'SERIAL', true, true)
|
||||||
} else if (type === 'projector,projector_second') {
|
} else if (type === 'projector,projector_second') {
|
||||||
/*this.connected.projector_second = device
|
this.connected.projector = device
|
||||||
|
this.connected.projector_second = device
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
this.arduino.aliasSerial('projector_second', device)
|
||||||
try {
|
try {
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
connectSuccess = await this.arduino.connect('projector', device, false)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
this.log.error('Error connecting to projector and secondary projector', err)
|
||||||
return false
|
return false
|
||||||
}*/
|
|
||||||
} else if (type === 'camera_second') {
|
|
||||||
/*this.connected.projector_second = device
|
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
|
||||||
try {
|
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
return false
|
|
||||||
}*/
|
|
||||||
} else if (type === 'camera,camera_second') {
|
|
||||||
/*this.connected.projector_second = device
|
|
||||||
this.arduino.aliasSerial('projector_second', device)
|
|
||||||
try {
|
|
||||||
connectSuccess = await this.arduino.connect('projector_second', device, false)
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err)
|
|
||||||
return false
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
} else if (type === 'camera_second') {
|
||||||
|
this.connected.camera_second = device
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera_second', device, false)
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (type === 'camera,camera_second') {
|
||||||
|
this.connected.camera = device
|
||||||
|
this.connected.camera_second = device
|
||||||
|
this.arduino.aliasSerial('camera_second', device)
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_secondary and projector', err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if ('camera,projector,projector_second') {
|
||||||
|
this.connected.camera = device
|
||||||
|
this.connected.projector = device
|
||||||
|
this.connected.projector_second = device
|
||||||
|
this.arduino.aliasSerial('projector', device)
|
||||||
|
this.arduino.aliasSerial('projector_second', device)
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, projector and projector_second', err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if ('camera,camera_second,projector') {
|
||||||
|
this.connected.camera = device
|
||||||
|
this.connected.camera_second = device
|
||||||
|
this.connected.projector = device
|
||||||
|
this.arduino.aliasSerial('camera_second', device)
|
||||||
|
this.arduino.aliasSerial('projector', device)
|
||||||
|
|
||||||
//camera,projector,projector_second
|
try {
|
||||||
//camera,camera_second,projector
|
connectSuccess = await this.arduino.connect('camera', device, false)
|
||||||
//camera,camera_second,projector,projector_second
|
} catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second and projector', err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if ('camera,camera_second,projector,projector_second') {
|
||||||
|
this.connected.camera = device
|
||||||
|
this.connected.camera_second = device
|
||||||
|
this.connected.projector = device
|
||||||
|
this.connected.projector_second = device
|
||||||
|
this.arduino.aliasSerial('camera_second', device)
|
||||||
|
this.arduino.aliasSerial('projector', device)
|
||||||
|
this.arduino.aliasSerial('projector_second', device)
|
||||||
|
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, camera_second, projector and projector_second', err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
return connectSuccess
|
return connectSuccess
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -309,7 +345,8 @@ class Devices {
|
||||||
let l : any = {}
|
let l : any = {}
|
||||||
let type : string;
|
let type : string;
|
||||||
let d : any
|
let d : any
|
||||||
let s : any = {}
|
let cs : any = {}
|
||||||
|
let ps : any = {}
|
||||||
let checklist : any[] = []
|
let checklist : any[] = []
|
||||||
|
|
||||||
this.connected = {
|
this.connected = {
|
||||||
|
@ -358,11 +395,15 @@ class Devices {
|
||||||
|
|
||||||
l.arduino = this.connected.light
|
l.arduino = this.connected.light
|
||||||
|
|
||||||
if (this.connected.projector_second) {
|
if (this.connected.camera_second) {
|
||||||
s = this.connected.projector_second
|
cs = { arduino : this.connected.camera_second }
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ready(p, c, l, s)
|
if (this.connected.projector_second) {
|
||||||
|
ps = { arduino : this.connected.projector_second }
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.ready(p, c, l, cs, ps)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -387,25 +428,37 @@ class Devices {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
private ready (projector : any, camera : any, light : any, projector_second : any) {
|
private ready (projector : any, camera : any, light : any, camera_second : any, projector_second : any) {
|
||||||
let args : any = {
|
let args : any = {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.state.profile
|
profile: this.settings.state.profile
|
||||||
}
|
}
|
||||||
if (projector_second && projector_second.arduino) {
|
|
||||||
|
if (projector_second) {
|
||||||
args.projector_second = projector_second
|
args.projector_second = projector_second
|
||||||
}
|
|
||||||
this.ui.send('ready', args)
|
|
||||||
this.settings.update('camera', camera)
|
|
||||||
this.settings.update('projector', projector)
|
|
||||||
this.settings.update('light', light)
|
|
||||||
if (projector_second && projector_second.arduino) {
|
|
||||||
this.settings.update('projector_second', projector_second)
|
this.settings.update('projector_second', projector_second)
|
||||||
this.mainWindow.setSize(800, 800)
|
this.mainWindow.setSize(800, 800)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (camera_second) {
|
||||||
|
args.camera_second = camera_second
|
||||||
|
this.settings.update('camera_second', camera_second)
|
||||||
|
if (projector_second) {
|
||||||
|
this.mainWindow.setSize(900, 800)
|
||||||
|
} else {
|
||||||
|
this.mainWindow.setSize(800, 800)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.settings.update('camera', camera)
|
||||||
|
this.settings.update('projector', projector)
|
||||||
|
this.settings.update('light', light)
|
||||||
this.settings.save()
|
this.settings.save()
|
||||||
|
|
||||||
|
this.ui.send('ready', args)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,20 @@ class Projector {
|
||||||
this.log.error(`Error moving ${this.id}`, err)
|
this.log.error(`Error moving ${this.id}`, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.log.info('Projector move time', { ms });
|
//this.log.info('Projector move time', { ms });
|
||||||
|
return await this.end(cmd, id, ms)
|
||||||
|
}
|
||||||
|
|
||||||
|
public async both (frame : any, id : string) {
|
||||||
|
id = 'projectors';
|
||||||
|
const cmd : string = this.cfg.arduino.cmd[id];
|
||||||
|
let ms : number;
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error(`Error moving ${this.id}`, err)
|
||||||
|
}
|
||||||
|
//this.log.info('Projectors move time', { ms });
|
||||||
return await this.end(cmd, id, ms)
|
return await this.end(cmd, id, ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,19 +149,22 @@ class Projector {
|
||||||
}
|
}
|
||||||
message += ' 1 frame'
|
message += ' 1 frame'
|
||||||
} else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
} else if (cmd === this.cfg.arduino.cmd.projector_second) {
|
||||||
message = 'Projector second'
|
message = 'Projector second '
|
||||||
if (this.state.dir) {
|
if (this.state.dir) {
|
||||||
message += 'ADVANCED'
|
message += 'ADVANCED'
|
||||||
} else {
|
} else {
|
||||||
message += 'REWOUND'
|
message += 'REWOUND'
|
||||||
}
|
}
|
||||||
message += ' 1 frame'
|
message += ' 1 frame'
|
||||||
|
} else if (cmd === this.cfg.arduino.cmd.projectors) {
|
||||||
|
message += 'Projectors both MOVED 1 frame each';
|
||||||
}
|
}
|
||||||
|
message += ` ${ms}ms`
|
||||||
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})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function (arduino : Arduino, cfg : any, ui : any, dig : any) {
|
module.exports = function (arduino : Arduino, cfg : any, ui : any, dig : any, second : boolean) {
|
||||||
return new Projector(arduino, cfg, ui, dig);
|
return new Projector(arduino, cfg, ui, dig, second);
|
||||||
}
|
}
|
|
@ -120,6 +120,10 @@ class Sequencer {
|
||||||
await delay(42);
|
await delay(42);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof this.arr[y] === 'undefined') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`)
|
this.log.info(`Starting step ${y + 1} of loop ${x + 1}`)
|
||||||
this.ui.send(this.id, { step : y, loop : x, start : true });
|
this.ui.send(this.id, { step : y, loop : x, start : true });
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue