Merge the estimates branch #79
|
@ -41,9 +41,16 @@ class Devices {
|
|||
* local settings object.
|
||||
**/
|
||||
listener(event, arg) {
|
||||
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
||||
this.settings.update('profile', arg.profile);
|
||||
this.settings.save();
|
||||
if (typeof arg.profile !== 'undefined') {
|
||||
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
||||
this.settings.update('profile', arg.profile);
|
||||
this.settings.save();
|
||||
}
|
||||
if (typeof arg.timing !== 'undefined') {
|
||||
this.log.info(`Saving timing info`, 'SETTINGS', false, false);
|
||||
this.settings.update('timing', arg.timing);
|
||||
this.settings.save();
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -510,6 +517,9 @@ class Devices {
|
|||
light,
|
||||
profile: this.settings.state.profile
|
||||
};
|
||||
if (this.settings.state.timing) {
|
||||
args.timing = this.settings.state.timing;
|
||||
}
|
||||
if (projector_second && projector_second.arduino) {
|
||||
args.projector_second = projector_second;
|
||||
this.settings.update('projector_second', projector_second);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,8 @@ class Settings {
|
|||
camera: {},
|
||||
projector: {},
|
||||
light: {},
|
||||
capper: {}
|
||||
capper: {},
|
||||
timing: {}
|
||||
};
|
||||
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;IAeb;;QAEI;IACJ;QAjBQ,SAAI,GAAW,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,uBAAuB,CAAC,CAAC;QAChE,iBAAY,GAAS;YAC5B,MAAM,EAAG;gBACR,IAAI,EAAG,IAAI;gBACX,OAAO,EAAG,IAAI;aACd;YACD,OAAO,E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M,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"}
|
|
@ -80,6 +80,7 @@ cam.end = function (c, id, ms) {
|
|||
}
|
||||
gui.counterUpdate('cam2', cam.second.pos);
|
||||
}
|
||||
timing.update(c, ms);
|
||||
gui.counterUpdate('cam', cam.pos)
|
||||
if (typeof cam.queue[id] !== 'undefined') {
|
||||
if (typeof cam.queue[id].callback !== 'undefined') {
|
||||
|
@ -182,6 +183,7 @@ cam.second.end = function (c, id, ms) {
|
|||
cam.second.pos -= 1;
|
||||
}
|
||||
}
|
||||
timing.update(c, ms);
|
||||
gui.counterUpdate('cam2', cam.second.pos)
|
||||
if (typeof cam.second.queue[id] !== 'undefined') {
|
||||
if (typeof cam.queue[id].callback !== 'undefined') {
|
||||
|
|
|
@ -86,6 +86,9 @@ class Devices {
|
|||
timing.reset(p);
|
||||
//devices.profile(arg.profile)
|
||||
}
|
||||
if (arg && arg.timing) {
|
||||
timing.restore(arg.timing);
|
||||
}
|
||||
if (arg.projector_second) {
|
||||
//add second row of projector pads to grid
|
||||
proj.second.enable();
|
||||
|
@ -137,6 +140,7 @@ class Devices {
|
|||
light.enable();
|
||||
}
|
||||
ipcRenderer.send('profile', { profile });
|
||||
timing.store();
|
||||
}
|
||||
intval() {
|
||||
const url = $('#intval').val();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -173,6 +173,7 @@ proj.second.end = function (c, id, ms) {
|
|||
proj.second.pos -= 1;
|
||||
}
|
||||
}
|
||||
timing.update(c, ms);
|
||||
gui.counterUpdate('proj2', proj.second.pos);
|
||||
if (typeof proj.second.queue[id] !== 'undefined') {
|
||||
if (typeof proj.second.queue[id].callback !== 'undefined') {
|
||||
|
|
|
@ -51,6 +51,8 @@ class Sequence {
|
|||
$('#cmd_capper_off').addClass('active');
|
||||
$('#cmd_capper_on').removeClass('active');
|
||||
}
|
||||
this.stats();
|
||||
timing.store();
|
||||
}
|
||||
}
|
||||
return event.returnValue = true;
|
||||
|
@ -173,29 +175,13 @@ class Sequence {
|
|||
}
|
||||
return true;
|
||||
});
|
||||
console.dir(cfg);
|
||||
//timing
|
||||
for (let step of this.grid) {
|
||||
if (!step)
|
||||
continue;
|
||||
c = step.cmd;
|
||||
if (c === cfg.cmd.camera_forward || c === cfg.cmd.camera_backward) {
|
||||
ms += cfg.arduino.cam.time;
|
||||
ms += cfg.arduino.cam.delay;
|
||||
ms += cfg.arduino.serialDelay;
|
||||
}
|
||||
if (c === cfg.cmd.projector_forward || c === cfg.cmd.projector_backward) {
|
||||
ms += cfg.arduino.proj.time;
|
||||
ms += cfg.arduino.proj.delay;
|
||||
ms += cfg.arduino.serialDelay;
|
||||
}
|
||||
if (c === cfg.cmd.black_forward || c === cfg.cmd.black_backward) {
|
||||
ms += cfg.arduino.black.before;
|
||||
ms += cfg.arduino.black.after;
|
||||
ms += cfg.arduino.cam.time;
|
||||
ms += cfg.arduino.cam.delay;
|
||||
ms += cfg.arduino.serialDelay;
|
||||
}
|
||||
ms += timing.get(c);
|
||||
ms += cfg.arduino.serialDelay;
|
||||
ms += cfg.arduino.sequenceDelay;
|
||||
if (c === cfg.cmd.camera_forward || c === cfg.cmd.black_forward) {
|
||||
cam_total++;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,13 +3,44 @@ let timing;
|
|||
class Timing {
|
||||
constructor() {
|
||||
this.data = {};
|
||||
this.fromArduino = {
|
||||
'c': 'cam',
|
||||
'3': 'cam2',
|
||||
'4': 'cams',
|
||||
'b': 'black',
|
||||
'p': 'proj',
|
||||
'w': 'proj2',
|
||||
'x': 'projs'
|
||||
};
|
||||
this.fromCmd = {
|
||||
'CF': 'cam',
|
||||
'CB': 'cam',
|
||||
'BF': 'black',
|
||||
'BB': 'black',
|
||||
'C2F': 'cam2',
|
||||
'C2B': 'cam2',
|
||||
'CCF': 'cams',
|
||||
'CCB': 'cams',
|
||||
'CFCB': 'cams',
|
||||
'CBCF': 'cams',
|
||||
'PF': 'proj',
|
||||
'PB': 'proj',
|
||||
'P2F': 'proj2',
|
||||
'P2B': 'proj2',
|
||||
'PPF': 'projs',
|
||||
'PPB': 'projs',
|
||||
'PFPB': 'projs',
|
||||
'PBPF': 'projs'
|
||||
};
|
||||
}
|
||||
reset(profile) {
|
||||
const keys = Object.keys(profile);
|
||||
const cmds = Object.keys(cfg.cmd);
|
||||
let cam;
|
||||
let proj;
|
||||
let pad;
|
||||
for (let key of keys) {
|
||||
console.log(key);
|
||||
if (key === 'label') {
|
||||
continue;
|
||||
}
|
||||
|
@ -17,37 +48,48 @@ class Timing {
|
|||
cam = 0;
|
||||
cam += profile[key].time;
|
||||
cam += profile[key].delay;
|
||||
for (let cmd of cmds) {
|
||||
if (cmd.indexOf('camera') !== -1 || cmd.indexOf('black') !== -1) {
|
||||
this.data[cfg.cmd[cmd]] = cam;
|
||||
}
|
||||
cam += profile[key].momentary;
|
||||
pad = 0;
|
||||
if (typeof profile['black'] !== 'undefined' && typeof profile['black'].before !== 'undefined' && typeof profile['black'].after !== 'undefined') {
|
||||
pad = (profile['black'].before + profile['black'].after);
|
||||
}
|
||||
this.data['cam'] = cam;
|
||||
this.data['cam2'] = cam;
|
||||
this.data['cams'] = cam;
|
||||
this.data['black'] = cam + pad;
|
||||
}
|
||||
else if (key === 'proj') {
|
||||
proj = 0;
|
||||
proj += profile[key].time;
|
||||
proj += profile[key].delay;
|
||||
for (let cmd of cmds) {
|
||||
if (cmd.indexOf('projector') !== -1) {
|
||||
this.data[cfg.cmd[cmd]] = proj;
|
||||
}
|
||||
}
|
||||
proj += profile[key].momentary;
|
||||
this.data['proj'] = proj;
|
||||
this.data['proj2'] = proj;
|
||||
this.data['projs'] = proj;
|
||||
}
|
||||
}
|
||||
}
|
||||
restore(timing) {
|
||||
this.data = timing;
|
||||
}
|
||||
//update with rolling average
|
||||
update(cmd, ms) {
|
||||
if (typeof this.data[cmd] !== 'undefined') {
|
||||
this.data[cmd] = (this.data[cmd] + ms) / 2;
|
||||
update(c, ms) {
|
||||
let cmd = this.fromArduino[c];
|
||||
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
||||
this.data[cmd] = Math.round((this.data[cmd] + ms) / 2);
|
||||
}
|
||||
}
|
||||
//get current value
|
||||
get(cmd) {
|
||||
if (typeof this.data[cmd] !== 'undefined') {
|
||||
get(c) {
|
||||
const cmd = this.fromCmd[c];
|
||||
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
||||
return this.data[cmd];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
store() {
|
||||
ipcRenderer.send('profile', { timing: this.data });
|
||||
}
|
||||
}
|
||||
timing = new Timing();
|
||||
module.exports = timing;
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"timing.js","sourceRoot":"","sources":["../../src/lib/ui/timing.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,MAAe,CAAC;AAMpB,MAAM,MAAM;IAIX;QAHQ,SAAI,GAAgB,EAE3B,CAAA;IAGD,CAAC;IAEM,KAAK,CAAE,OAAa;QAC1B,MAAM,IAAI,GAAc,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAc,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,GAAY,CAAC;QACjB,IAAI,IAAa,CAAC;QAClB,KAAK,IAAI,GAAG,IAAI,IAAI,EAAE;YACrB,IAAI,GAAG,KAAK,OAAO,EA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C;CACD;AAED,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAEtB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
|
|
@ -82,6 +82,9 @@ class Devices {
|
|||
timing.reset(p);
|
||||
//devices.profile(arg.profile)
|
||||
}
|
||||
if (arg && arg.timing) {
|
||||
timing.restore(arg.timing);
|
||||
}
|
||||
|
||||
if (arg.projector_second) {
|
||||
//add second row of projector pads to grid
|
||||
|
@ -127,7 +130,7 @@ class Devices {
|
|||
const p : any = cfg.profiles[profile];
|
||||
const keys : any[] = Object.keys(p);
|
||||
for (let key of keys) {
|
||||
cfg[key] = keys[key]
|
||||
cfg[key] = keys[key];
|
||||
}
|
||||
timing.reset(p);
|
||||
if (typeof p.light !== 'undefined' && p.light === false) {
|
||||
|
@ -136,6 +139,8 @@ class Devices {
|
|||
light.enable();
|
||||
}
|
||||
ipcRenderer.send('profile', { profile })
|
||||
timing.store();
|
||||
|
||||
}
|
||||
|
||||
intval () {
|
||||
|
|
|
@ -75,6 +75,8 @@ class Sequence {
|
|||
$('#cmd_capper_off').addClass('active');
|
||||
$('#cmd_capper_on').removeClass('active');
|
||||
}
|
||||
this.stats();
|
||||
timing.store();
|
||||
}
|
||||
}
|
||||
return event.returnValue = true;
|
||||
|
@ -207,28 +209,13 @@ class Sequence {
|
|||
}
|
||||
return true;
|
||||
});
|
||||
console.dir(cfg);
|
||||
|
||||
//timing
|
||||
for (let step of this.grid) {
|
||||
if (!step) continue
|
||||
c = step.cmd;
|
||||
if (c === cfg.cmd.camera_forward || c === cfg.cmd.camera_backward){
|
||||
ms += cfg.arduino.cam.time;
|
||||
ms += cfg.arduino.cam.delay;
|
||||
ms += cfg.arduino.serialDelay;
|
||||
}
|
||||
if (c === cfg.cmd.projector_forward || c === cfg.cmd.projector_backward){
|
||||
ms += cfg.arduino.proj.time;
|
||||
ms += cfg.arduino.proj.delay;
|
||||
ms += cfg.arduino.serialDelay;
|
||||
}
|
||||
if (c === cfg.cmd.black_forward || c === cfg.cmd.black_backward){
|
||||
ms += cfg.arduino.black.before;
|
||||
ms += cfg.arduino.black.after;
|
||||
ms += cfg.arduino.cam.time;
|
||||
ms += cfg.arduino.cam.delay;
|
||||
ms += cfg.arduino.serialDelay;
|
||||
}
|
||||
ms += timing.get(c);
|
||||
ms += cfg.arduino.serialDelay;
|
||||
ms += cfg.arduino.sequenceDelay;
|
||||
|
||||
if (c === cfg.cmd.camera_forward || c === cfg.cmd.black_forward) {
|
||||
|
|
|
@ -7,9 +7,41 @@ interface TimingData {
|
|||
}
|
||||
|
||||
class Timing {
|
||||
private data : TimingData = {
|
||||
public data : TimingData = {
|
||||
|
||||
}
|
||||
|
||||
private fromArduino : any = {
|
||||
'c' : 'cam',
|
||||
'3' : 'cam2',
|
||||
'4' : 'cams',
|
||||
'b' : 'black',
|
||||
'p' : 'proj',
|
||||
'w' : 'proj2',
|
||||
'x' : 'projs'
|
||||
}
|
||||
|
||||
private fromCmd : any = {
|
||||
'CF' : 'cam',
|
||||
'CB' : 'cam',
|
||||
'BF' : 'black',
|
||||
'BB' : 'black',
|
||||
'C2F': 'cam2',
|
||||
'C2B': 'cam2',
|
||||
'CCF' : 'cams',
|
||||
'CCB' : 'cams',
|
||||
'CFCB': 'cams',
|
||||
'CBCF': 'cams',
|
||||
'PF' : 'proj',
|
||||
'PB' : 'proj',
|
||||
'P2F' : 'proj2',
|
||||
'P2B' : 'proj2',
|
||||
'PPF' : 'projs',
|
||||
'PPB' : 'projs',
|
||||
'PFPB' : 'projs',
|
||||
'PBPF' : 'projs'
|
||||
}
|
||||
|
||||
constructor () {
|
||||
|
||||
}
|
||||
|
@ -19,6 +51,7 @@ class Timing {
|
|||
const cmds : string[] = Object.keys(cfg.cmd);
|
||||
let cam : number;
|
||||
let proj : number;
|
||||
let pad : number;
|
||||
for (let key of keys) {
|
||||
if (key === 'label') {
|
||||
continue
|
||||
|
@ -26,38 +59,53 @@ class Timing {
|
|||
cam = 0;
|
||||
cam += profile[key].time;
|
||||
cam += profile[key].delay;
|
||||
for (let cmd of cmds) {
|
||||
if (cmd.indexOf('camera') !== -1 || cmd.indexOf('black') !== -1) {
|
||||
this.data[cfg.cmd[cmd]] = cam;
|
||||
}
|
||||
cam += profile[key].momentary;
|
||||
pad = 0;
|
||||
|
||||
if (typeof profile['black'] !== 'undefined' && typeof profile['black'].before !== 'undefined' && typeof profile['black'].after !== 'undefined') {
|
||||
pad = (profile['black'].before + profile['black'].after);
|
||||
}
|
||||
|
||||
this.data['cam'] = cam
|
||||
this.data['cam2'] = cam
|
||||
this.data['cams'] = cam
|
||||
this.data['black'] = cam + pad
|
||||
} else if (key === 'proj') {
|
||||
proj = 0;
|
||||
proj += profile[key].time;
|
||||
proj += profile[key].delay;
|
||||
for (let cmd of cmds) {
|
||||
if (cmd.indexOf('projector') !== -1) {
|
||||
this.data[cfg.cmd[cmd]] = proj;
|
||||
}
|
||||
}
|
||||
proj += profile[key].momentary;
|
||||
this.data['proj'] = proj;
|
||||
this.data['proj2'] = proj;
|
||||
this.data['projs'] = proj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public restore (timing : TimingData) {
|
||||
this.data = timing;
|
||||
}
|
||||
|
||||
//update with rolling average
|
||||
public update (cmd : string, ms : number) {
|
||||
if (typeof this.data[cmd] !== 'undefined') {
|
||||
this.data[cmd] = (this.data[cmd] + ms) / 2;
|
||||
public update (c : string, ms : number) {
|
||||
let cmd : string = this.fromArduino[c];
|
||||
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
||||
this.data[cmd] = Math.round((this.data[cmd] + ms) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
//get current value
|
||||
public get (cmd : string) {
|
||||
if (typeof this.data[cmd] !== 'undefined') {
|
||||
public get (c : string) : number {
|
||||
const cmd : string = this.fromCmd[c];
|
||||
if (typeof cmd !== 'undefined' && typeof this.data[cmd] !== 'undefined') {
|
||||
return this.data[cmd];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public store () {
|
||||
ipcRenderer.send('profile', { timing : this.data })
|
||||
}
|
||||
}
|
||||
|
||||
timing = new Timing();
|
||||
|
|
|
@ -53,9 +53,16 @@ class Devices {
|
|||
* local settings object.
|
||||
**/
|
||||
private listener (event : any, arg : any){
|
||||
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
||||
this.settings.update('profile', arg.profile);
|
||||
this.settings.save();
|
||||
if (typeof arg.profile !== 'undefined') {
|
||||
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
|
||||
this.settings.update('profile', arg.profile);
|
||||
this.settings.save();
|
||||
}
|
||||
if (typeof arg.timing !== 'undefined') {
|
||||
this.log.info(`Saving timing info`, 'SETTINGS', false, false);
|
||||
this.settings.update('timing', arg.timing);
|
||||
this.settings.save();
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -501,7 +508,10 @@ class Devices {
|
|||
camera,
|
||||
projector,
|
||||
light,
|
||||
profile: this.settings.state.profile
|
||||
profile: this.settings.state.profile
|
||||
}
|
||||
if (this.settings.state.timing) {
|
||||
args.timing = this.settings.state.timing
|
||||
}
|
||||
|
||||
if (projector_second && projector_second.arduino) {
|
||||
|
|
|
@ -16,7 +16,8 @@ class Settings {
|
|||
camera : {},
|
||||
projector : {},
|
||||
light : {},
|
||||
capper : {}
|
||||
capper : {},
|
||||
timing : {}
|
||||
}
|
||||
public state : any;
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue