In a two device simultaneous action, the cmd module was attemptint to await both actions in an array. This was not working and caused await to not occur. Instead, all actions have been replaced by a Promise.all, which awaits both actions simultaneously until both are complete. After that, function is correct.
This commit is contained in:
parent
9b7d1a3e5c
commit
5bad15a79a
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"ext_port": 1111,
|
||||
"profiles": {
|
||||
"mcopy": {
|
||||
|
|
|
@ -281,9 +281,7 @@ class Commands {
|
|||
ms = await this.cam.both();
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all([this.cam.move(), this.cam2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
|
@ -323,9 +321,7 @@ class Commands {
|
|||
ms = await this.cam.both();
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all([this.cam.move(), this.cam2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
|
@ -365,9 +361,7 @@ class Commands {
|
|||
ms = await this.cam.both();
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all([this.cam.move(), this.cam2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
|
@ -407,9 +401,7 @@ class Commands {
|
|||
ms = await this.cam.both();
|
||||
}
|
||||
else {
|
||||
this.cam.move();
|
||||
this.cam.move();
|
||||
both = [await this.cam.move, await this.proj2.move];
|
||||
both = await Promise.all([this.cam.move(), this.cam2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
|
||||
|
@ -482,9 +474,7 @@ class Commands {
|
|||
ms = await this.proj.both();
|
||||
}
|
||||
else {
|
||||
this.proj.move();
|
||||
this.proj2.move();
|
||||
both = [await this.proj.move, await this.proj2.move];
|
||||
both = await Promise.all([this.proj.move(), this.proj2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
@ -511,14 +501,11 @@ class Commands {
|
|||
await this.proj2.set(false);
|
||||
}
|
||||
await (0, delay_1.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];
|
||||
both = await Promise.all([this.proj.move(), this.proj2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
@ -546,14 +533,11 @@ class Commands {
|
|||
await this.proj2.set(false);
|
||||
}
|
||||
await (0, delay_1.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];
|
||||
both = await Promise.all([this.proj.move(), this.proj2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
@ -581,14 +565,11 @@ class Commands {
|
|||
await this.proj2.set(true);
|
||||
}
|
||||
await (0, delay_1.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];
|
||||
both = await Promise.all([this.proj.move(), this.proj2.move()]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mcopy-app",
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mcopy-app",
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"description": "GUI for the mcopy small gauge film optical printer platform",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"ext_port": 1111,
|
||||
"profiles": {
|
||||
"mcopy": {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "mcopy",
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mcopy",
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"alert": "file:app/lib/alert",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mcopy",
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"description": "Small gauge film optical printer platform",
|
||||
"main": "build.js",
|
||||
"directories": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.8.105",
|
||||
"version": "1.8.106",
|
||||
"ext_port": 1111,
|
||||
"profiles": {
|
||||
"mcopy": {
|
||||
|
|
|
@ -293,9 +293,7 @@ class Commands {
|
|||
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.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
|
||||
|
@ -335,9 +333,7 @@ class Commands {
|
|||
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.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
|
||||
|
@ -378,9 +374,7 @@ class Commands {
|
|||
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.cam2.move();
|
||||
both = [await this.cam.move, await this.cam2.move];
|
||||
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
|
||||
|
@ -420,9 +414,7 @@ class Commands {
|
|||
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];
|
||||
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
|
||||
|
@ -494,9 +486,7 @@ class Commands {
|
|||
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];
|
||||
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -522,13 +512,10 @@ class Commands {
|
|||
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];
|
||||
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -556,13 +543,10 @@ class Commands {
|
|||
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];
|
||||
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -589,13 +573,10 @@ class Commands {
|
|||
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];
|
||||
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
|
||||
ms = Math.max(...both);
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue