From c942d895724f7d4783dcc94fb9edbbde1b1bb108 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Tue, 28 May 2019 12:52:50 -0400 Subject: [PATCH] Wire goto button on projector 2 and camera 2 to cmd.projector_second_to and cmd.camera_second_to. Resolves #9 --- app/index.html | 4 +-- app/lib/ui/cmd.js | 81 ++++++++++++++++++++++++++++++++++++++++++++--- app/package.json | 2 +- cli/package.json | 2 +- data/cfg.json | 2 +- package-lock.json | 2 +- package.json | 2 +- 7 files changed, 84 insertions(+), 11 deletions(-) diff --git a/app/index.html b/app/index.html index 2fd31a0..851d523 100644 --- a/app/index.html +++ b/app/index.html @@ -191,14 +191,14 @@
- +
- +
diff --git a/app/lib/ui/cmd.js b/app/lib/ui/cmd.js index c7dae2a..c72f9f4 100644 --- a/app/lib/ui/cmd.js +++ b/app/lib/ui/cmd.js @@ -406,9 +406,9 @@ cmd.camera_to = function (t) { let cont; if (val !== cam.pos) { if (val < cam.pos) { - total = -(cam.pos - val) + total = -(cam.pos - val); } else if (val > cam.pos) { - total = val - cam.pos + total = val - cam.pos; } if (total > 0) { c = cfg.cmd.black_forward; @@ -424,6 +424,42 @@ cmd.camera_to = function (t) { } } }; + +/** + * Move the secondary camera to a specific frame. Accepts the input with the "move_cam_to_2" + * value. Moves as black frames to prevent multiple exposure. + * + * @param {object} t HTML input element with the move to val + **/ +cmd.camera_second_to = function (t) { + const raw = $('#move_cam_to_2').val(); + const val = parseInt(raw); + let proceed = false; + let total; + let steps = []; + let c; + let cont; + if (val !== cam.second.pos) { + if (val < cam.second.pos) { + total = -(cam.second.pos - val) + } else if (val > cam.second.pos) { + total = val - cam.second.pos; + } + if (total > 0) { + c = cfg.cmd.black_second_forward; + } else if (total < 0) { + c = cfg.cmd.black_second_backward; + } + steps = [{ cmd : c, light : [0, 0, 0] }] + cont = confirm(`Do you want to ${(total > 0 ? 'advance' : 'rewind')} the secondary camera ${total} frame${(total === 1 ? '' : 's')} to frame ${val}?`) + if (cont) { + gui.overlay(true); + gui.spinner(true, `Second camera ${(total > 0 ? 'advancing' : 'rewinding')} ${total} frame${(total === 1 ? '' : 's')} `, true, true); + seq.exec(steps, Math.abs(total)); + } + } +}; + /** * Move the projector to a specific frame. Accepts the input with the "move_proj_to" * value. @@ -440,9 +476,9 @@ cmd.projector_to = function (t) { let cont if (val !== proj.pos) { if (val < proj.pos) { - total = -(proj.pos - val) + total = -(proj.pos - val); } else if (val > proj.pos) { - total = val - proj.pos + total = val - proj.pos; } if (total > 0) { c = cfg.cmd.projector_forward; @@ -461,4 +497,41 @@ cmd.projector_to = function (t) { } } +/** + * Move the secondary projector to a specific frame. Accepts the input with the "move_proj_to_2" + * value. + * + * @param {object} t HTML input element with the move to val + **/ +cmd.projector_second_to = function (t) { + const raw = $('#move_proj_to_2').val(); + const val = parseInt(raw); + let proceed = false; + let total; + let steps = []; + let c; + let cont + if (val !== proj.second.pos) { + if (val < proj.second.pos) { + total = -(proj.second.pos - val); + } else if (val > proj.second.pos) { + total = val - proj.second.pos; + } + if (total > 0) { + c = cfg.cmd.projector_second_forward; + } else if (total < 0) { + c = cfg.cmd.projector_second_backward; + } else { + return false; + } + steps = [ { cmd : c }]; + cont = confirm(`Do you want to ${(total > 0 ? 'advance' : 'rewind')} the secondary projector ${total} frame${(total === 1 ? '' : 's')} to frame ${val}?`) + if (cont) { + gui.overlay(true); + gui.spinner(true, `Second projector ${(total > 0 ? 'advancing' : 'rewinding')} ${total} frame${(total === 1 ? '' : 's')} `, true, true); + seq.exec(steps, Math.abs(total)); + } + } +} + module.exports = cmd; \ No newline at end of file diff --git a/app/package.json b/app/package.json index 5955d62..22b8e50 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "mcopy-app", - "version": "1.4.7", + "version": "1.4.8", "description": "GUI for the mcopy small gauge film optical printer platform", "main": "main.js", "scripts": { diff --git a/cli/package.json b/cli/package.json index 4f7c009..44d56d7 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "mcopy-cli", - "version": "1.4.7", + "version": "1.4.8", "description": "CLI for controlling the mcopy optical printer platform", "main": "index.js", "scripts": { diff --git a/data/cfg.json b/data/cfg.json index 83b868f..f07a098 100644 --- a/data/cfg.json +++ b/data/cfg.json @@ -1,5 +1,5 @@ { - "version": "1.4.7", + "version": "1.4.8", "ext_port": 1111, "profiles": { "mcopy": { diff --git a/package-lock.json b/package-lock.json index d1363a9..96a59f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mcopy", - "version": "1.4.7", + "version": "1.4.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9a6b3e8..e101b60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcopy", - "version": "1.4.7", + "version": "1.4.8", "description": "Small gauge film optical printer platform", "main": "build.js", "directories": {