Fixed single issue related to #11. If state of secondary projector or camera are set, include in output.

This commit is contained in:
Matt McWilliams 2024-10-13 15:49:44 -04:00
parent 4149d77d70
commit c365eff6a7
10 changed files with 69 additions and 25 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.135", "version": "1.8.136",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

View File

@ -194,10 +194,10 @@ class Mscript {
this.output.meta = this.meta; //all metadata for instructions this.output.meta = this.meta; //all metadata for instructions
this.output.cam = this.cam; this.output.cam = this.cam;
this.output.proj = this.proj; this.output.proj = this.proj;
if (this.contains(this.arr, CAMERA_SECONDARY)) { if (this.contains(this.arr, CAMERA_SECONDARY) || this.cam2 !== 0) {
this.output.cam2 = this.cam2; this.output.cam2 = this.cam2;
} }
if (this.contains(this.arr, PROJECTOR_SECONDARY)) { if (this.contains(this.arr, PROJECTOR_SECONDARY) || this.proj2 !== 0) {
this.output.proj2 = this.proj2; this.output.proj2 = this.proj2;
} }
return this.output; return this.output;
@ -510,18 +510,38 @@ class Mscript {
* @param line {string} String containing set statement * @param line {string} String containing set statement
*/ */
set_state(line) { set_state(line) {
//console.log(`set_state called: ${line}`);
const update = {};
if (line.startsWith('SET CAM2')) { if (line.startsWith('SET CAM2')) {
parseInt(line.split('SET CAM2')[1]); update.cam2 = parseInt(line.split('SET CAM2')[1]);
}
else if (line.startsWith('SET CAMERA2')) {
update.cam2 = parseInt(line.split('SET CAMERA2')[1]);
} }
else if (line.startsWith('SET PROJ2')) { else if (line.startsWith('SET PROJ2')) {
this.cam2 = parseInt(line.split('SET PROJ2')[1]); update.proj2 = parseInt(line.split('SET PROJ2')[1]);
}
else if (line.startsWith('SET PROJECTOR2')) {
update.proj2 = parseInt(line.split('SET PROJECTOR2')[1]);
} }
else if (line.startsWith('SET CAM')) { else if (line.startsWith('SET CAM')) {
this.cam = parseInt(line.split('SET CAM')[1]); update.cam = parseInt(line.split('SET CAM')[1]);
} }
else if (line.startsWith('SET PROJ')) { else if (line.startsWith('SET PROJ')) {
this.proj = parseInt(line.split('SET PROJ')[1]); update.proj = parseInt(line.split('SET PROJ')[1]);
} }
//console.log(JSON.stringify(update));
if (this.rec > -1) {
for (let key of Object.keys(update)) {
this.loops[this.rec][key] = update[key];
}
}
else {
for (let key of Object.keys(update)) {
this[key] = update[key];
}
}
console.dir(JSON.stringify(this));
} }
/** /**
* Return the last loop * Return the last loop

File diff suppressed because one or more lines are too long

2
app/package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy-app", "name": "mcopy-app",
"version": "1.8.135", "version": "1.8.136",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy-app", "name": "mcopy-app",
"version": "1.8.135", "version": "1.8.136",
"description": "GUI for the mcopy small gauge film optical printer platform", "description": "GUI for the mcopy small gauge film optical printer platform",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.135", "version": "1.8.136",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.8.135", "version": "1.8.136",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mcopy", "name": "mcopy",
"version": "1.8.135", "version": "1.8.136",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"alert": "file:app/lib/alert", "alert": "file:app/lib/alert",

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.8.135", "version": "1.8.136",
"description": "Small gauge film optical printer platform", "description": "Small gauge film optical printer platform",
"main": "build.js", "main": "build.js",
"directories": { "directories": {

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.135", "version": "1.8.136",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

View File

@ -6,8 +6,8 @@ interface MscriptOutput {
meta : string[], meta : string[],
cam : number, cam : number,
proj : number, proj : number,
cam2? : number cam2 ? : number
proj2? : number proj2 ? : number
} }
interface MscriptLoop { interface MscriptLoop {
@ -21,8 +21,8 @@ interface MscriptLoop {
start ? : RGB, start ? : RGB,
end ? : RGB, end ? : RGB,
fade? : boolean, fade? : boolean,
fade_len? : number, fade_len ? : number,
fade_count? : number, fade_count ? : number,
count ? : number count ? : number
} }
@ -38,6 +38,13 @@ interface Alts {
[key : string] : string[] [key : string] : string[]
} }
interface MscriptUpdatedState {
cam ? : number,
proj ? : number,
cam2 ? : number,
proj2 ? : number,
}
const BLACK : string = '0,0,0'; const BLACK : string = '0,0,0';
const WHITE : string = '255,255,255'; const WHITE : string = '255,255,255';
const CMD : string[] = [ const CMD : string[] = [
@ -251,10 +258,10 @@ export default class Mscript {
this.output.meta = this.meta; //all metadata for instructions this.output.meta = this.meta; //all metadata for instructions
this.output.cam = this.cam; this.output.cam = this.cam;
this.output.proj = this.proj; this.output.proj = this.proj;
if (this.contains(this.arr, CAMERA_SECONDARY)) { if (this.contains(this.arr, CAMERA_SECONDARY) || this.cam2 !== 0) {
this.output.cam2 = this.cam2; this.output.cam2 = this.cam2;
} }
if (this.contains(this.arr, PROJECTOR_SECONDARY)) { if (this.contains(this.arr, PROJECTOR_SECONDARY) || this.proj2 !== 0) {
this.output.proj2 = this.proj2; this.output.proj2 = this.proj2;
} }
@ -570,15 +577,32 @@ export default class Mscript {
* @param line {string} String containing set statement * @param line {string} String containing set statement
*/ */
private set_state (line : string) { private set_state (line : string) {
//console.log(`set_state called: ${line}`);
const update : MscriptUpdatedState = {};
if (line.startsWith('SET CAM2')) { if (line.startsWith('SET CAM2')) {
parseInt(line.split('SET CAM2')[1]); update.cam2 = parseInt(line.split('SET CAM2')[1]);
} else if (line.startsWith('SET CAMERA2')) {
update.cam2 = parseInt(line.split('SET CAMERA2')[1]);
} else if (line.startsWith('SET PROJ2')) { } else if (line.startsWith('SET PROJ2')) {
this.cam2 = parseInt(line.split('SET PROJ2')[1]); update.proj2 = parseInt(line.split('SET PROJ2')[1]);
} else if (line.startsWith('SET PROJECTOR2')) {
update.proj2 = parseInt(line.split('SET PROJECTOR2')[1]);
} else if (line.startsWith('SET CAM')) { } else if (line.startsWith('SET CAM')) {
this.cam = parseInt(line.split('SET CAM')[1]); update.cam = parseInt(line.split('SET CAM')[1]);
} else if (line.startsWith('SET PROJ')) { } else if (line.startsWith('SET PROJ')) {
this.proj = parseInt(line.split('SET PROJ')[1]); update.proj = parseInt(line.split('SET PROJ')[1]);
} }
//console.log(JSON.stringify(update));
if (this.rec > -1) {
for (let key of Object.keys(update)) {
(this.loops[this.rec] as any)[key] = (update as any)[key];
}
} else {
for (let key of Object.keys(update)) {
(this as any)[key] = (update as any)[key];
}
}
console.dir(JSON.stringify(this));
} }
/** /**
* Return the last loop * Return the last loop