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,
"profiles": {
"mcopy": {

View File

@ -194,10 +194,10 @@ class Mscript {
this.output.meta = this.meta; //all metadata for instructions
this.output.cam = this.cam;
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;
}
if (this.contains(this.arr, PROJECTOR_SECONDARY)) {
if (this.contains(this.arr, PROJECTOR_SECONDARY) || this.proj2 !== 0) {
this.output.proj2 = this.proj2;
}
return this.output;
@ -510,18 +510,38 @@ class Mscript {
* @param line {string} String containing set statement
*/
set_state(line) {
//console.log(`set_state called: ${line}`);
const update = {};
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')) {
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')) {
this.cam = parseInt(line.split('SET CAM')[1]);
update.cam = parseInt(line.split('SET CAM')[1]);
}
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

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",
"version": "1.8.135",
"version": "1.8.136",
"lockfileVersion": 2,
"requires": true,
"packages": {

View File

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

View File

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

4
package-lock.json generated
View File

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

View File

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

View File

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

View File

@ -38,6 +38,13 @@ interface Alts {
[key : string] : string[]
}
interface MscriptUpdatedState {
cam ? : number,
proj ? : number,
cam2 ? : number,
proj2 ? : number,
}
const BLACK : string = '0,0,0';
const WHITE : string = '255,255,255';
const CMD : string[] = [
@ -251,10 +258,10 @@ export default class Mscript {
this.output.meta = this.meta; //all metadata for instructions
this.output.cam = this.cam;
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;
}
if (this.contains(this.arr, PROJECTOR_SECONDARY)) {
if (this.contains(this.arr, PROJECTOR_SECONDARY) || this.proj2 !== 0) {
this.output.proj2 = this.proj2;
}
@ -570,15 +577,32 @@ export default class Mscript {
* @param line {string} String containing set statement
*/
private set_state (line : string) {
//console.log(`set_state called: ${line}`);
const update : MscriptUpdatedState = {};
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')) {
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')) {
this.cam = parseInt(line.split('SET CAM')[1]);
update.cam = parseInt(line.split('SET CAM')[1]);
} 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