Sequencer now blocks system sleep while running a sequence. Made me upset last night when it happened during a filmout and I shot 1000 frames of black. Resolves #26

This commit is contained in:
mmcwilliams 2019-10-04 14:36:26 -04:00
parent ac1da17b8d
commit 8e4c32073a
7 changed files with 35 additions and 3 deletions

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const Log = require("log"); const Log = require("log");
const electron_1 = require("electron");
/** @module lib/sequencer **/ /** @module lib/sequencer **/
let seq; let seq;
class Sequencer { class Sequencer {
@ -127,6 +128,7 @@ class Sequencer {
async start(arg) { async start(arg) {
let startTime = +new Date(); let startTime = +new Date();
let ms; let ms;
this.psbId = electron_1.powerSaveBlocker.start('prevent-display-sleep');
if (arg && arg.arr) { if (arg && arg.arr) {
this.arr = arg.arr; //overwrite sequence this.arr = arg.arr; //overwrite sequence
} }
@ -180,6 +182,8 @@ class Sequencer {
if (this.cmd.proj.filmout.state.enabled === true) { if (this.cmd.proj.filmout.state.enabled === true) {
await this.cmd.proj.filmout.display.close(); await this.cmd.proj.filmout.display.close();
} }
electron_1.powerSaveBlocker.stop(this.psbId);
this.psbId = null;
ms = (+new Date()) - startTime; ms = (+new Date()) - startTime;
//end sequence //end sequence
this.log.info(`Ended sequence`); this.log.info(`Ended sequence`);
@ -199,6 +203,9 @@ class Sequencer {
this.cmd.proj.filmout.display.close(); this.cmd.proj.filmout.display.close();
} }
this.running = false; this.running = false;
if (this.psbId) {
electron_1.powerSaveBlocker.stop(this.psbId);
}
//clear? //clear?
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const Log = require("log"); const Log = require("log");
const electron_1 = require("electron");
/** @module lib/sequencer **/ /** @module lib/sequencer **/
let seq; let seq;
class Sequencer { class Sequencer {
@ -127,6 +128,7 @@ class Sequencer {
async start(arg) { async start(arg) {
let startTime = +new Date(); let startTime = +new Date();
let ms; let ms;
this.psbId = electron_1.powerSaveBlocker.start('prevent-display-sleep');
if (arg && arg.arr) { if (arg && arg.arr) {
this.arr = arg.arr; //overwrite sequence this.arr = arg.arr; //overwrite sequence
} }
@ -180,6 +182,8 @@ class Sequencer {
if (this.cmd.proj.filmout.state.enabled === true) { if (this.cmd.proj.filmout.state.enabled === true) {
await this.cmd.proj.filmout.display.close(); await this.cmd.proj.filmout.display.close();
} }
electron_1.powerSaveBlocker.stop(this.psbId);
this.psbId = null;
ms = (+new Date()) - startTime; ms = (+new Date()) - startTime;
//end sequence //end sequence
this.log.info(`Ended sequence`); this.log.info(`Ended sequence`);
@ -199,6 +203,9 @@ class Sequencer {
this.cmd.proj.filmout.display.close(); this.cmd.proj.filmout.display.close();
} }
this.running = false; this.running = false;
if (this.psbId) {
electron_1.powerSaveBlocker.stop(this.psbId);
}
//clear? //clear?
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const Log = require("log"); const Log = require("log");
const electron_1 = require("electron");
/** @module lib/sequencer **/ /** @module lib/sequencer **/
let seq; let seq;
class Sequencer { class Sequencer {
@ -127,6 +128,7 @@ class Sequencer {
async start(arg) { async start(arg) {
let startTime = +new Date(); let startTime = +new Date();
let ms; let ms;
this.psbId = electron_1.powerSaveBlocker.start('prevent-display-sleep');
if (arg && arg.arr) { if (arg && arg.arr) {
this.arr = arg.arr; //overwrite sequence this.arr = arg.arr; //overwrite sequence
} }
@ -180,6 +182,8 @@ class Sequencer {
if (this.cmd.proj.filmout.state.enabled === true) { if (this.cmd.proj.filmout.state.enabled === true) {
await this.cmd.proj.filmout.display.close(); await this.cmd.proj.filmout.display.close();
} }
electron_1.powerSaveBlocker.stop(this.psbId);
this.psbId = null;
ms = (+new Date()) - startTime; ms = (+new Date()) - startTime;
//end sequence //end sequence
this.log.info(`Ended sequence`); this.log.info(`Ended sequence`);
@ -199,6 +203,9 @@ class Sequencer {
this.cmd.proj.filmout.display.close(); this.cmd.proj.filmout.display.close();
} }
this.running = false; this.running = false;
if (this.psbId) {
electron_1.powerSaveBlocker.stop(this.psbId);
}
//clear? //clear?
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,8 @@
import uuid from 'uuid/v4'; import uuid from 'uuid/v4';
import Log = require('log'); import Log = require('log');
import { powerSaveBlocker } from 'electron'
/** @module lib/sequencer **/ /** @module lib/sequencer **/
@ -25,6 +27,7 @@ class Sequencer {
private log : any; private log : any;
private id : string = 'sequence'; private id : string = 'sequence';
private alerted : boolean = false; private alerted : boolean = false;
private psbId : any;
/** /**
* @constructor * @constructor
@ -145,6 +148,8 @@ class Sequencer {
let startTime : number = +new Date(); let startTime : number = +new Date();
let ms : number; let ms : number;
this.psbId = powerSaveBlocker.start('prevent-display-sleep');
if (arg && arg.arr) { if (arg && arg.arr) {
this.arr = arg.arr; //overwrite sequence this.arr = arg.arr; //overwrite sequence
} else { } else {
@ -209,6 +214,9 @@ class Sequencer {
await this.cmd.proj.filmout.display.close(); await this.cmd.proj.filmout.display.close();
} }
powerSaveBlocker.stop(this.psbId)
this.psbId = null
ms = ( +new Date() ) - startTime; ms = ( +new Date() ) - startTime;
//end sequence //end sequence
this.log.info(`Ended sequence`); this.log.info(`Ended sequence`);
@ -230,6 +238,9 @@ class Sequencer {
this.cmd.proj.filmout.display.close(); this.cmd.proj.filmout.display.close();
} }
this.running = false; this.running = false;
if (this.psbId) {
powerSaveBlocker.stop(this.psbId);
}
//clear? //clear?
} }