All work on manual exposure control. Disable image controls UI for now (needs more thought and positional guardrails). Placeholder types for SequenceStatistics which will have data and estimates about completion times.

This commit is contained in:
Matt McWilliams 2024-10-17 23:06:37 -04:00
parent 2f48625a58
commit a4d964ef20
12 changed files with 86 additions and 15 deletions

View File

@ -151,8 +151,10 @@ class Client {
(document.getElementById('sequenceSelectForm') as HTMLFormElement ).reset(); (document.getElementById('sequenceSelectForm') as HTMLFormElement ).reset();
(document.getElementById('sequenceCtrlForm') as HTMLFormElement ).reset(); (document.getElementById('sequenceCtrlForm') as HTMLFormElement ).reset();
(document.getElementById('manualCtrlForm') as HTMLFormElement ).reset(); (document.getElementById('manualCtrlForm') as HTMLFormElement ).reset();
(document.getElementById('exposureCtrlForm') as HTMLFormElement ).reset();
this.disableClass('sequenceCtrl'); this.disableClass('sequenceCtrl');
this.disableClass('manualCtrl'); this.disableClass('manualCtrl');
this.disableClass('exposureCtrl');
this.setProgress({ hash: null, progress: 0 }); this.setProgress({ hash: null, progress: 0 });
} }
@ -187,6 +189,7 @@ class Client {
this.setProgress(state.sequence); this.setProgress(state.sequence);
this.setFrame(state.sequence); this.setFrame(state.sequence);
this.setStatus(state.sequence); this.setStatus(state.sequence);
this.setExposure(state);
this.setDisplay(state); this.setDisplay(state);
(document.getElementById('sequence') as HTMLSelectElement ).value = state.sequence.hash; (document.getElementById('sequence') as HTMLSelectElement ).value = state.sequence.hash;
} }
@ -195,6 +198,7 @@ class Client {
this.setProgress(state.sequence); this.setProgress(state.sequence);
this.setFrame(state.sequence); this.setFrame(state.sequence);
this.setStatus(state.sequence); this.setStatus(state.sequence);
this.setExposure(state);
this.display.updateImage(); this.display.updateImage();
} }
@ -233,6 +237,13 @@ class Client {
} }
} }
private setExposure (state : State) {
if (typeof state.exposure !== 'undefined') {
this.enableClass('exposureCtrl');
(document.getElementById('exposure') as HTMLInputElement).value = `${state.exposure}`;
}
}
private setDisplay (state : State) { private setDisplay (state : State) {
const widthEl : HTMLInputElement = document.getElementById('displayWidth') as HTMLInputElement; const widthEl : HTMLInputElement = document.getElementById('displayWidth') as HTMLInputElement;
const heightEl : HTMLInputElement = document.getElementById('displayHeight') as HTMLInputElement; const heightEl : HTMLInputElement = document.getElementById('displayHeight') as HTMLInputElement;
@ -383,6 +394,11 @@ class Client {
this.client.send(JSON.stringify({ cmd : 'stop' })); this.client.send(JSON.stringify({ cmd : 'stop' }));
} }
public sendExposure () {
const exposure : number = parseInt((document.getElementById('exposure') as HTMLSelectElement ).value);
this.client.send(JSON.stringify({ cmd : 'exposure', state : { exposure }}));
}
private receiveUpdate (msg : Message) { private receiveUpdate (msg : Message) {
this.setUpdate(msg.state); this.setUpdate(msg.state);
} }

9
dist/index.js vendored
View File

@ -230,6 +230,9 @@ async function cmd(msg) {
case 'set': case 'set':
frameSet(msg.state.sequence.current); frameSet(msg.state.sequence.current);
break; break;
case 'exposure':
exposureSet(msg.state.exposure);
break;
default: default:
log.warn(`No matching command: ${msg.cmd}`); log.warn(`No matching command: ${msg.cmd}`);
} }
@ -251,6 +254,12 @@ function frameRewind() {
function frameSet(frame) { function frameSet(frame) {
sequence.frameSet(frame); sequence.frameSet(frame);
} }
function exposureSet(exposure) {
if (exposure < 1) {
exposure = 1;
}
sequence.setExposure(exposure);
}
async function select(id) { async function select(id) {
const sequencesArr = await files_1.Files.enumerateSequences(sequences); const sequencesArr = await files_1.Files.enumerateSequences(sequences);
const seq = sequencesArr.find(el => el.hash === id); const seq = sequencesArr.find(el => el.hash === id);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -58,6 +58,7 @@ class Sequence {
this.frameAdvance(); this.frameAdvance();
} }
//complete running //complete running
this.updateClientsOnState();
} }
async load(seq) { async load(seq) {
this.current = seq; this.current = seq;
@ -158,6 +159,8 @@ class Sequence {
} }
setExposure(ms) { setExposure(ms) {
this.exposure = ms; this.exposure = ms;
this.log.info(`Updated exposure: ${ms}ms`);
this.updateClientsOnState();
} }
getStatus() { getStatus() {
if (this.running && this.paused) { if (this.running && this.paused) {

File diff suppressed because one or more lines are too long

5
src/globals.d.ts vendored
View File

@ -18,12 +18,17 @@ interface SequenceState {
status? : any status? : any
} }
interface SequenceStatistics {
}
interface State { interface State {
display? : StateDimensions, display? : StateDimensions,
offset? : StateOffset, offset? : StateOffset,
source? : StateDimensions, source? : StateDimensions,
screen? : StateDimensions, screen? : StateDimensions,
sequence? : SequenceState, sequence? : SequenceState,
statistics? : SequenceStatistics,
exposure? : number exposure? : number
} }

View File

@ -218,6 +218,9 @@ async function cmd (msg : Message) {
case 'set' : case 'set' :
frameSet(msg.state.sequence.current); frameSet(msg.state.sequence.current);
break; break;
case 'exposure' :
exposureSet(msg.state.exposure);
break;
default : default :
log.warn(`No matching command: ${msg.cmd}`); log.warn(`No matching command: ${msg.cmd}`);
} }
@ -244,6 +247,14 @@ function frameRewind () {
function frameSet (frame : number) { function frameSet (frame : number) {
sequence.frameSet(frame); sequence.frameSet(frame);
} }
function exposureSet (exposure : number) {
if (exposure < 1) {
exposure = 1;
}
sequence.setExposure(exposure);
}
async function select (id : string) : Promise<boolean> { async function select (id : string) : Promise<boolean> {
const sequencesArr : SequenceObject[] = await Files.enumerateSequences(sequences); const sequencesArr : SequenceObject[] = await Files.enumerateSequences(sequences);
const seq : SequenceObject = sequencesArr.find(el => el.hash === id); const seq : SequenceObject = sequencesArr.find(el => el.hash === id);

View File

@ -75,6 +75,7 @@ export class Sequence {
this.frameAdvance(); this.frameAdvance();
} }
//complete running //complete running
this.updateClientsOnState();
} }
public async load (seq : SequenceObject) { public async load (seq : SequenceObject) {
@ -188,6 +189,8 @@ export class Sequence {
public setExposure (ms : number) { public setExposure (ms : number) {
this.exposure = ms; this.exposure = ms;
this.log.info(`Updated exposure: ${ms}ms`);
this.updateClientsOnState();
} }
public getStatus () : SequenceStatus { public getStatus () : SequenceStatus {

View File

@ -54,6 +54,7 @@ declare class Client {
private setStatus; private setStatus;
private setProgress; private setProgress;
private setFrame; private setFrame;
private setExposure;
private setDisplay; private setDisplay;
private cmd; private cmd;
disableClass(className: string): void; disableClass(className: string): void;
@ -73,6 +74,7 @@ declare class Client {
private receiveSelect; private receiveSelect;
sendStart(): void; sendStart(): void;
sendStop(): void; sendStop(): void;
sendExposure(): void;
private receiveUpdate; private receiveUpdate;
fullscreen(): void; fullscreen(): void;
exitFullscreen(): void; exitFullscreen(): void;

View File

@ -126,8 +126,10 @@ class Client {
document.getElementById('sequenceSelectForm').reset(); document.getElementById('sequenceSelectForm').reset();
document.getElementById('sequenceCtrlForm').reset(); document.getElementById('sequenceCtrlForm').reset();
document.getElementById('manualCtrlForm').reset(); document.getElementById('manualCtrlForm').reset();
document.getElementById('exposureCtrlForm').reset();
this.disableClass('sequenceCtrl'); this.disableClass('sequenceCtrl');
this.disableClass('manualCtrl'); this.disableClass('manualCtrl');
this.disableClass('exposureCtrl');
this.setProgress({ hash: null, progress: 0 }); this.setProgress({ hash: null, progress: 0 });
} }
getWebsocketUri() { getWebsocketUri() {
@ -155,6 +157,7 @@ class Client {
this.setProgress(state.sequence); this.setProgress(state.sequence);
this.setFrame(state.sequence); this.setFrame(state.sequence);
this.setStatus(state.sequence); this.setStatus(state.sequence);
this.setExposure(state);
this.setDisplay(state); this.setDisplay(state);
document.getElementById('sequence').value = state.sequence.hash; document.getElementById('sequence').value = state.sequence.hash;
} }
@ -162,6 +165,7 @@ class Client {
this.setProgress(state.sequence); this.setProgress(state.sequence);
this.setFrame(state.sequence); this.setFrame(state.sequence);
this.setStatus(state.sequence); this.setStatus(state.sequence);
this.setExposure(state);
this.display.updateImage(); this.display.updateImage();
} }
setStatus(sequence) { setStatus(sequence) {
@ -196,6 +200,12 @@ class Client {
document.getElementById('frame').value = `${sequence.current}`.padStart(5, '0'); document.getElementById('frame').value = `${sequence.current}`.padStart(5, '0');
} }
} }
setExposure(state) {
if (typeof state.exposure !== 'undefined') {
this.enableClass('exposureCtrl');
document.getElementById('exposure').value = `${state.exposure}`;
}
}
setDisplay(state) { setDisplay(state) {
const widthEl = document.getElementById('displayWidth'); const widthEl = document.getElementById('displayWidth');
const heightEl = document.getElementById('displayHeight'); const heightEl = document.getElementById('displayHeight');
@ -323,6 +333,10 @@ class Client {
sendStop() { sendStop() {
this.client.send(JSON.stringify({ cmd: 'stop' })); this.client.send(JSON.stringify({ cmd: 'stop' }));
} }
sendExposure() {
const exposure = parseInt(document.getElementById('exposure').value);
this.client.send(JSON.stringify({ cmd: 'exposure', state: { exposure } }));
}
receiveUpdate(msg) { receiveUpdate(msg) {
this.setUpdate(msg.state); this.setUpdate(msg.state);
} }

File diff suppressed because one or more lines are too long

View File

@ -77,17 +77,12 @@
<button id="select" onclick="client.sendSelect();">Select</button> <button id="select" onclick="client.sendSelect();">Select</button>
</form> </form>
</fieldset> </fieldset>
<fieldset id="displayAdjust" class="inline half"> <fieldset id="exposureCtrl" class="inline half">
<legend>Display Adjust</legend> <legend>Exposure</legend>
<form id="displayAdjustForm" onsubmit="return false;"> <form id="exposureCtrlForm" onsubmit="return false;">
<button class="small sequenceCtrl" id="offsetXPlus">X +</button> <input id="exposure" class="medium exposureCtrl" type="number" value="0" disabled />
<button class="small sequenceCtrl" id="offsetXMinus">X -</button> <span>ms </span>
<button class="small sequenceCtrl" id="offsetYPlus">Y +</button> <button id="exposureUpdate" class="exposureCtrl" onclick="client.sendExposure();">Update</button>
<button class="small sequenceCtrl" id="offsetYMinus">Y -</button>
<button class="small sequenceCtrl" id="widthPlus">W +</button>
<button class="small sequenceCtrl" id="widthMinus">W -</button>
<button class="small sequenceCtrl" id="heightPlus">H +</button>
<button class="small sequenceCtrl" id="heightMinus">H -</button>
</form> </form>
</fieldset> </fieldset>
</div> </div>
@ -104,9 +99,22 @@
<button id="advance" class="small sequenceCtrl" onclick="client.sendToEnd()" disabled>>></button> <button id="advance" class="small sequenceCtrl" onclick="client.sendToEnd()" disabled>>></button>
</form> </form>
</fieldset> </fieldset>
<fieldset id="displayAdjust" class="inline half">
<legend>Display Adjust</legend>
<form id="displayAdjustForm" onsubmit="return false;">
<button class="small" id="offsetXPlus" disabled>X +</button>
<button class="small" id="offsetXMinus" disabled>X -</button>
<button class="small" id="offsetYPlus" disabled>Y +</button>
<button class="small" id="offsetYMinus" disabled>Y -</button>
<button class="small" id="widthPlus" disabled>W +</button>
<button class="small" id="widthMinus" disabled>W -</button>
<button class="small" id="heightPlus" disabled>H +</button>
<button class="small" id="heightMinus" disabled>H -</button>
</form>
</fieldset>
</div> </div>
<div> <div>
<fieldset id="manualCtrl"> <fieldset id="manualCtrl" class="inline half">
<legend>Manual Controls</legend> <legend>Manual Controls</legend>
<form id="manualCtrlForm" onsubmit="return false;" > <form id="manualCtrlForm" onsubmit="return false;" >
<button id="open" class="manualCtrl" onclick="client.sendCameraOpen()">Open</button> <button id="open" class="manualCtrl" onclick="client.sendCameraOpen()">Open</button>