Skip to content

Commit

Permalink
Add option to override DLE/STX sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahCallaway committed Dec 7, 2021
1 parent 24e4c14 commit 9fd3694
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/actions/TSL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const TSL5Fields: TallyInputConfigField[] = [
{ fieldName: 'text_tally', fieldLabel: 'Text Tally', fieldType: 'dropdown', options: [{ id: '0', label: 'Off' }, { id: '1', label: 'Red' }, { id: '2', label: 'Green' }, { id: '3', label: 'Amber' }] },
{ fieldName: 'rh_tally', fieldLabel: 'Right Tally', fieldType: 'dropdown', options: [{ id: '0', label: 'Off' }, { id: '1', label: 'Red' }, { id: '2', label: 'Green' }, { id: '3', label: 'Amber' }] },
{ fieldName: 'lh_tally', fieldLabel: 'Left Tally', fieldType: 'dropdown', options: [{ id: '0', label: 'Off' }, { id: '1', label: 'Red' }, { id: '2', label: 'Green' }, { id: '3', label: 'Amber' }] },
{ fieldName: 'brightness', fieldLabel: 'Brightness', fieldType: 'dropdown', options: [{ id: '0', label: '0' }, { id: '1', label: '1' }, { id: '2', label: '2' }, { id: '3', label: '3' }] }
{ fieldName: 'brightness', fieldLabel: 'Brightness', fieldType: 'dropdown', options: [{ id: '0', label: '0' }, { id: '1', label: '1' }, { id: '2', label: '2' }, { id: '3', label: '3' }] },
{ fieldName: 'sequence', fieldLabel: 'DLE/STX sequence', fieldType: 'dropdown', options: [{ id: 'default', label: 'Default' }, { id: 'ON', label: 'ON' }, { id: 'OFF', label: 'OFF' }] }
];


Expand Down Expand Up @@ -91,14 +92,22 @@ export class TSL extends Action {
var umd = new TSLUMDv5();
var display_fields = ['rh_tally', 'text_tally', 'lh_tally', 'brightness', 'text']
let tally: any = { display: {} };

let sequence = null;

if (!(this.action.data.ip && this.action.data.port)) {
logger(`Error in TSL 5 ${this.action.outputTypeId == "8b99d588" ? "UDP" : "TCP"} Action. IP and Port must be given`, 'error')
}
if (!this.action.data.index) {
logger(`TSL 5 ${this.action.outputTypeId == "8b99d588" ? "UDP" : "TCP"} Action. No index given. Using index 1 by default`, 'info')
tally.index = 1
}

if (this.action.data.sequence == 'ON') {
sequence = true
}
if (this.action.data.sequnece == 'OFF') {
sequence = false
}

for (var [key, value] of Object.entries(this.action.data)) {
if (display_fields.includes(key)) {
Expand All @@ -111,10 +120,10 @@ export class TSL extends Action {

if (this.action.outputTypeId == "8b99d588") {
// UDP
umd.sendTallyUDP(this.action.data.ip, this.action.data.port, tally)
umd.sendTallyUDP(this.action.data.ip, this.action.data.port, tally, sequence)
} else {
// TCP
umd.sendTallyTCP(this.action.data.ip, this.action.data.port, tally)
umd.sendTallyTCP(this.action.data.ip, this.action.data.port, tally, sequence)
}
logger(`TSL 5 ${this.action.outputTypeId == "8b99d588" ? "UDP" : "TCP"} Data sent.`, 'info');
} catch (error) {
Expand Down

0 comments on commit 9fd3694

Please sign in to comment.