App work
This commit is contained in:
parent
f9d716552b
commit
129647b863
|
@ -696,6 +696,9 @@ button:focus {
|
||||||
border-color: #DAE035;
|
border-color: #DAE035;
|
||||||
color: #DAE035;
|
color: #DAE035;
|
||||||
}
|
}
|
||||||
|
#settings input[type=text] {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
#settings button {
|
#settings button {
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
> div > div{
|
> div > div{
|
||||||
width: 360px;
|
width: 360px;
|
||||||
}
|
}
|
||||||
input[type=text], select{
|
input[type=text],
|
||||||
|
select{
|
||||||
.button();
|
.button();
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
|
@ -17,6 +18,9 @@
|
||||||
color: @SELECTED;
|
color: @SELECTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
input[type=text]{
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
button{
|
button{
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
@ -302,7 +302,7 @@ class Devices {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ('camera,projector,projector_second') {
|
else if (type === 'camera,projector,projector_second') {
|
||||||
this.connected.camera = device;
|
this.connected.camera = device;
|
||||||
this.connected.projector = device;
|
this.connected.projector = device;
|
||||||
this.connected.projector_second = device;
|
this.connected.projector_second = device;
|
||||||
|
@ -316,7 +316,7 @@ class Devices {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ('camera,camera_second,projector') {
|
else if (type === 'camera,camera_second,projector') {
|
||||||
this.connected.camera = device;
|
this.connected.camera = device;
|
||||||
this.connected.camera_second = device;
|
this.connected.camera_second = device;
|
||||||
this.connected.projector = device;
|
this.connected.projector = device;
|
||||||
|
@ -330,7 +330,7 @@ class Devices {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ('camera,camera_second,projector,projector_second') {
|
else if (type === 'camera,camera_second,projector,projector_second') {
|
||||||
this.connected.camera = device;
|
this.connected.camera = device;
|
||||||
this.connected.camera_second = device;
|
this.connected.camera_second = device;
|
||||||
this.connected.projector = device;
|
this.connected.projector = device;
|
||||||
|
@ -346,6 +346,48 @@ class Devices {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (type === 'camera,capper') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.capper = device;
|
||||||
|
this.arduino.aliasSerial('capper', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera and capper', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type === 'camera,capper,projector') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.capper = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.arduino.aliasSerial('capper', device);
|
||||||
|
this.arduino.aliasSerial('projector', device);
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, capper and projector', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type === 'camera,capper,projector,projector_second') {
|
||||||
|
this.connected.camera = device;
|
||||||
|
this.connected.capper = device;
|
||||||
|
this.connected.projector = device;
|
||||||
|
this.connected.projector_second = device;
|
||||||
|
this.arduino.aliasSerial('capper', 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, capper, projector and projector_second', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return connectSuccess;
|
return connectSuccess;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -360,12 +402,14 @@ class Devices {
|
||||||
let d;
|
let d;
|
||||||
let cs = {};
|
let cs = {};
|
||||||
let ps = {};
|
let ps = {};
|
||||||
|
let capper;
|
||||||
let checklist = [];
|
let checklist = [];
|
||||||
this.connected = {
|
this.connected = {
|
||||||
projector: false,
|
projector: false,
|
||||||
camera: false,
|
camera: false,
|
||||||
light: false,
|
light: false,
|
||||||
projector_second: false
|
projector_second: false,
|
||||||
|
capper: false
|
||||||
};
|
};
|
||||||
for (let device of devices) {
|
for (let device of devices) {
|
||||||
try {
|
try {
|
||||||
|
@ -402,10 +446,13 @@ class Devices {
|
||||||
if (this.connected.projector_second) {
|
if (this.connected.projector_second) {
|
||||||
ps = { arduino: this.connected.projector_second };
|
ps = { arduino: this.connected.projector_second };
|
||||||
}
|
}
|
||||||
|
if (this.connected.capper) {
|
||||||
|
capper = { arduino: this.connected.capper };
|
||||||
|
}
|
||||||
if (this.settings.state.camera && this.settings.state.camera.intval) {
|
if (this.settings.state.camera && this.settings.state.camera.intval) {
|
||||||
c.intval = this.settings.state.camera.intval;
|
c.intval = this.settings.state.camera.intval;
|
||||||
}
|
}
|
||||||
return this.ready(p, c, l, cs, ps);
|
return this.ready(p, c, l, cs, ps, capper);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -419,7 +466,7 @@ class Devices {
|
||||||
});
|
});
|
||||||
if (match.length === 0) {
|
if (match.length === 0) {
|
||||||
deviceEntry = {
|
deviceEntry = {
|
||||||
type: type
|
type
|
||||||
};
|
};
|
||||||
deviceEntry[which] = device;
|
deviceEntry[which] = device;
|
||||||
this.settings.state.devices.push(deviceEntry);
|
this.settings.state.devices.push(deviceEntry);
|
||||||
|
@ -430,13 +477,14 @@ class Devices {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
ready(projector, camera, light, camera_second, projector_second) {
|
ready(projector, camera, light, camera_second, projector_second, capper) {
|
||||||
let args = {
|
let args = {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
light,
|
light,
|
||||||
profile: this.settings.state.profile
|
profile: this.settings.state.profile
|
||||||
};
|
};
|
||||||
|
console.log("CHECK " + camera);
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second && projector_second.arduino) {
|
||||||
args.projector_second = projector_second;
|
args.projector_second = projector_second;
|
||||||
this.settings.update('projector_second', projector_second);
|
this.settings.update('projector_second', projector_second);
|
||||||
|
@ -452,6 +500,11 @@ class Devices {
|
||||||
this.mainWindow.setSize(800, 800);
|
this.mainWindow.setSize(800, 800);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (capper) {
|
||||||
|
this.mainWindow.setSize(800, 800);
|
||||||
|
this.settings.update('capper', capper);
|
||||||
|
args.capper = capper;
|
||||||
|
}
|
||||||
this.settings.update('camera', camera);
|
this.settings.update('camera', camera);
|
||||||
this.settings.update('projector', projector);
|
this.settings.update('projector', projector);
|
||||||
this.settings.update('light', light);
|
this.settings.update('light', light);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -18,7 +18,8 @@ class Settings {
|
||||||
profile: 'mcopy',
|
profile: 'mcopy',
|
||||||
camera: {},
|
camera: {},
|
||||||
projector: {},
|
projector: {},
|
||||||
light: {}
|
light: {},
|
||||||
|
capper: {}
|
||||||
};
|
};
|
||||||
this.state = this.freshState();
|
this.state = this.freshState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/settings/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,yBAA0B;AAC1B,6BAA8B;AAC9B,+BAAgC;AAEhC,MAAM,QAAQ;IAcb;;QAEI;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;SACZ;IACF,CAAC;IACD;;QAEI;IACG,KAAK,CAAC,KAAK;QACjB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,MAAM,EAAE;YACX,IAAI;gBACH,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC3B;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACnB;SACD;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAAA,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,QAAQ,EAAE,CAAA"}
|
|
@ -9,7 +9,8 @@ import { delay } from 'delay';
|
||||||
class Camera {
|
class Camera {
|
||||||
private state : any = {
|
private state : any = {
|
||||||
pos : 0,
|
pos : 0,
|
||||||
dir : true
|
dir : true,
|
||||||
|
capepr: false
|
||||||
};
|
};
|
||||||
private arduino : Arduino = null;
|
private arduino : Arduino = null;
|
||||||
private intval : any = null;
|
private intval : any = null;
|
||||||
|
@ -87,6 +88,28 @@ class Camera {
|
||||||
return await this.end(cmd, id, ms);
|
return await this.end(cmd, id, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
public async cap (state : boolean, id : string) {
|
||||||
|
let cmd : string;
|
||||||
|
let ms : number;
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
cmd = this.cfg.arduino.cmd[`${this.id}_forward`];
|
||||||
|
} else {
|
||||||
|
cmd = this.cfg.arduino.cmd[`${this.id}_backward`];
|
||||||
|
}
|
||||||
|
this.state.capper = state;
|
||||||
|
|
||||||
|
try {
|
||||||
|
ms = await this.arduino.send(this.id, cmd);
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error(err);
|
||||||
|
}
|
||||||
|
return await this.end(cmd, id, ms);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
@ -189,20 +212,26 @@ class Camera {
|
||||||
private async listener (event : any, arg : any) {
|
private async listener (event : any, arg : any) {
|
||||||
if (typeof arg.dir !== 'undefined') {
|
if (typeof arg.dir !== 'undefined') {
|
||||||
try {
|
try {
|
||||||
await this.set(arg.dir, arg.id);
|
await this.set(arg.dir, arg.id)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.log.error(err);
|
this.log.error(err)
|
||||||
}
|
}
|
||||||
} else if (typeof arg.frame !== 'undefined') {
|
} else if (typeof arg.frame !== 'undefined') {
|
||||||
try {
|
try {
|
||||||
await this.move(arg.frame, arg.id);
|
await this.move(arg.frame, arg.id)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.log.error(err);
|
this.log.error(err)
|
||||||
}
|
}
|
||||||
} else if (typeof arg.val !== 'undefined') {
|
} else if (typeof arg.val !== 'undefined') {
|
||||||
this.state.pos = arg.val;
|
this.state.pos = arg.val
|
||||||
|
} else if (typeof arg.capper !== 'undefined') {
|
||||||
|
try {
|
||||||
|
await this.cap(arg.capper, arg.id)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error(err)
|
||||||
}
|
}
|
||||||
event.returnValue = true;
|
}
|
||||||
|
event.returnValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -295,7 +295,7 @@ class Devices {
|
||||||
this.log.error('Error connecting to camera, camera_secondary and projector', err)
|
this.log.error('Error connecting to camera, camera_secondary and projector', err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else if ('camera,projector,projector_second') {
|
} else if (type === 'camera,projector,projector_second') {
|
||||||
this.connected.camera = device
|
this.connected.camera = device
|
||||||
this.connected.projector = device
|
this.connected.projector = device
|
||||||
this.connected.projector_second = device
|
this.connected.projector_second = device
|
||||||
|
@ -307,7 +307,7 @@ class Devices {
|
||||||
this.log.error('Error connecting to camera, projector and projector_second', err)
|
this.log.error('Error connecting to camera, projector and projector_second', err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else if ('camera,camera_second,projector') {
|
} else if (type === 'camera,camera_second,projector') {
|
||||||
this.connected.camera = device
|
this.connected.camera = device
|
||||||
this.connected.camera_second = device
|
this.connected.camera_second = device
|
||||||
this.connected.projector = device
|
this.connected.projector = device
|
||||||
|
@ -320,7 +320,7 @@ class Devices {
|
||||||
this.log.error('Error connecting to camera, camera_second and projector', err)
|
this.log.error('Error connecting to camera, camera_second and projector', err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else if ('camera,camera_second,projector,projector_second') {
|
} else if (type === 'camera,camera_second,projector,projector_second') {
|
||||||
this.connected.camera = device
|
this.connected.camera = device
|
||||||
this.connected.camera_second = device
|
this.connected.camera_second = device
|
||||||
this.connected.projector = device
|
this.connected.projector = device
|
||||||
|
@ -335,6 +335,43 @@ class Devices {
|
||||||
this.log.error('Error connecting to camera, camera_second, projector and projector_second', err)
|
this.log.error('Error connecting to camera, camera_second, projector and projector_second', err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
} else if (type === 'camera,capper') {
|
||||||
|
this.connected.camera = device
|
||||||
|
this.connected.capper = device
|
||||||
|
this.arduino.aliasSerial('capper', device)
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error('Error connecting to camera and capper', err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (type === 'camera,capper,projector') {
|
||||||
|
this.connected.camera = device
|
||||||
|
this.connected.capper = device
|
||||||
|
this.connected.projector = device
|
||||||
|
this.arduino.aliasSerial('capper', device)
|
||||||
|
this.arduino.aliasSerial('projector', device)
|
||||||
|
|
||||||
|
try {
|
||||||
|
connectSuccess = await this.arduino.connect('camera', device, false)
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error('Error connecting to camera, capper and projector', err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (type === 'camera,capper,projector,projector_second') {
|
||||||
|
this.connected.camera = device
|
||||||
|
this.connected.capper = device
|
||||||
|
this.connected.projector = device
|
||||||
|
this.connected.projector_second = device
|
||||||
|
this.arduino.aliasSerial('capper', 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, capper, projector and projector_second', err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return connectSuccess
|
return connectSuccess
|
||||||
}
|
}
|
||||||
|
@ -350,13 +387,15 @@ class Devices {
|
||||||
let d : any
|
let d : any
|
||||||
let cs : any = {}
|
let cs : any = {}
|
||||||
let ps : any = {}
|
let ps : any = {}
|
||||||
|
let capper : any;
|
||||||
let checklist : any[] = []
|
let checklist : any[] = []
|
||||||
|
|
||||||
this.connected = {
|
this.connected = {
|
||||||
projector : false,
|
projector : false,
|
||||||
camera : false,
|
camera : false,
|
||||||
light : false,
|
light : false,
|
||||||
projector_second : false
|
projector_second : false,
|
||||||
|
capper : false
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let device of devices) {
|
for (let device of devices) {
|
||||||
|
@ -400,12 +439,15 @@ class Devices {
|
||||||
ps = { arduino : this.connected.projector_second }
|
ps = { arduino : this.connected.projector_second }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.connected.capper) {
|
||||||
|
capper = { arduino : this.connected.capper }
|
||||||
|
}
|
||||||
|
|
||||||
if (this.settings.state.camera && this.settings.state.camera.intval) {
|
if (this.settings.state.camera && this.settings.state.camera.intval) {
|
||||||
c.intval = this.settings.state.camera.intval
|
c.intval = this.settings.state.camera.intval
|
||||||
|
|
||||||
}
|
}
|
||||||
return this.ready(p, c, l, cs, ps)
|
return this.ready(p, c, l, cs, ps, capper)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -430,7 +472,7 @@ class Devices {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
private ready (projector : any, camera : any, light : any, camera_second : any, projector_second : any) {
|
private ready (projector : any, camera : any, light : any, camera_second : any, projector_second : any, capper : any) {
|
||||||
let args : any = {
|
let args : any = {
|
||||||
camera,
|
camera,
|
||||||
projector,
|
projector,
|
||||||
|
@ -438,6 +480,7 @@ class Devices {
|
||||||
profile: this.settings.state.profile
|
profile: this.settings.state.profile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("CHECK " + camera)
|
||||||
if (projector_second && projector_second.arduino) {
|
if (projector_second && projector_second.arduino) {
|
||||||
args.projector_second = projector_second
|
args.projector_second = projector_second
|
||||||
this.settings.update('projector_second', projector_second)
|
this.settings.update('projector_second', projector_second)
|
||||||
|
@ -454,9 +497,17 @@ class Devices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (capper) {
|
||||||
|
this.mainWindow.setSize(800, 800)
|
||||||
|
this.settings.update('capper', capper)
|
||||||
|
args.capper = capper
|
||||||
|
}
|
||||||
|
|
||||||
this.settings.update('camera', camera)
|
this.settings.update('camera', camera)
|
||||||
this.settings.update('projector', projector)
|
this.settings.update('projector', projector)
|
||||||
this.settings.update('light', light)
|
this.settings.update('light', light)
|
||||||
|
|
||||||
|
|
||||||
this.settings.save()
|
this.settings.save()
|
||||||
|
|
||||||
this.ui.send('ready', args)
|
this.ui.send('ready', args)
|
||||||
|
|
|
@ -15,7 +15,8 @@ class Settings {
|
||||||
profile : 'mcopy',
|
profile : 'mcopy',
|
||||||
camera : {},
|
camera : {},
|
||||||
projector : {},
|
projector : {},
|
||||||
light : {}
|
light : {},
|
||||||
|
capper : {}
|
||||||
}
|
}
|
||||||
public state : any;
|
public state : any;
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue