Skip to content

Commit

Permalink
feat: Skaarhoj panels - add number of hw buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Feb 1, 2022
1 parent f630a18 commit 5dede51
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 10 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,31 @@ If you open up a brower and type:
localhost:5901/?target=3 (or whatever ip-address the NDI-Controller is located)
```
You'll get a personal source selector for a single target
In Mtx setup under targets you can select what sources that should be excludes for a specific target.
<img src="doc/clientpanel.png">

## MTX Setup view:
<img src="doc/mtx-setup.png">

## Add source:
When adding a source you can either type in manually (e.g. adding a non-discoverable source) or select a discoveret NDI Source.
Pressing RE-DISCOVER will search for NDI sources again.
<img src="doc/source-select.png">

## Add Target:
When adding targets it's possible to assign a Skaarhoj HW panel + number of buttons, and exclude sources on User panels (Web client and Skaahoj panels)

<img src="doc/target-setup.png">


## Installation:
Windows: Run the pre-build "ndi-controller Setup x.x.x.exe"
Mac: Run the pre-build "ndi-controller-x.x.x.dmg"

## Skaarhoj panel support:
NDI Controller is listening for Skaahoj raw-panels on port 9923 (standard Skaahoj port)
In MTX settings -> you can add the serial number of the skaarhoj panel on the target you wish to control.

### Build and run:
ndi_mtx.cc will build when yarn is called.
(c compiler on machine is needed)
Expand Down
Binary file added doc/target-setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 23 additions & 5 deletions src/client/components/settingsTargetPopUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ const SettingsTargetPopUp: React.FC<ISettingsSourcePopup> = (props) => {
const [hwPanelId, setHwPanelId] = useState<string>(
props.targets[props.selectedPopUp].hwPanelId || ''
)
const [hwPanelBtnAmount, setHwPanelBtnAmount] = useState<number>(
props.targets[props.selectedPopUp].hwPanelBtnAmount || 0
)
const [sourceFilter, setSourceFilter] = useState<number[]>(
props.targets[props.selectedPopUp].sourceFilter || []
)

const handleUpdateChange = () => {
let newTargets: ITarget[] = props.targets
newTargets[props.selectedPopUp] = { label, selectedSource, hwPanelId, sourceFilter }
newTargets[props.selectedPopUp] = { label, selectedSource, hwPanelId, hwPanelBtnAmount, sourceFilter }
props.setTargets(newTargets)
props.setSelectedPopUp(-1)
}
Expand Down Expand Up @@ -55,12 +58,18 @@ const SettingsTargetPopUp: React.FC<ISettingsSourcePopup> = (props) => {
setHwPanelId(event.target.value)
}

const handleHwPanelBtnAmount = (
event: React.ChangeEvent<HTMLInputElement>
) => {
setHwPanelBtnAmount(parseInt(event.target.value))
}

const handleSelectSources = (
event: React.ChangeEvent<HTMLSelectElement>
) => {
let sourceFilter = Array.from(event.target.selectedOptions).map((selection) => {return parseInt(selection.value)})
console.log('Selected sources to exclude :', sourceFilter)
setSourceFilter(sourceFilter)
let filtered = Array.from(event.target.selectedOptions).map((selection) => {return parseInt(selection.value)})
console.log('Selected sources to exclude :', filtered)
setSourceFilter(filtered)
}

return (
Expand All @@ -85,7 +94,16 @@ const SettingsTargetPopUp: React.FC<ISettingsSourcePopup> = (props) => {
/>
</label>
<label className="settings-popup-label">
Panel exclude :
HW buttons :
<input
className="settings-popup-input"
type="text"
value={hwPanelBtnAmount}
onChange={(event) => handleHwPanelBtnAmount(event)}
/>
</label>
<label className="settings-popup-label">
User Panel Exclude :
<select
className="settings-popup-select-multiple"
onChange={(event) => handleSelectSources(event)}
Expand Down
2 changes: 1 addition & 1 deletion src/client/styles/SettingsPopup.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
justify-content: left;
color: rgb(192, 192, 192);
background-color: rgb(51, 51, 51);
min-height: 300px;
min-height: 350px;
border-radius: 3px;
border-color: rgb(136, 136, 136);
border-style: solid;
Expand Down
1 change: 1 addition & 0 deletions src/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ITarget {
label: string
selectedSource: number
hwPanelId?: string
hwPanelBtnAmount?: number
sourceFilter?: Array<number>
}

Expand Down
10 changes: 6 additions & 4 deletions src/server/hwController/SkaarhojRemoteConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface IClientList {
let clientList: IClientList[] = []
let sources: ISource[]
let targets: ITarget[]
let btnAmount: number = 0

export const initializeSkaarhojServer = (
sourcesProps: ISource[],
Expand Down Expand Up @@ -86,13 +87,14 @@ const findTargetIndex = (command: string): number => {
if (targetIndex === -1) {
targetIndex = 0
}
btnAmount = targets[targetIndex].hwPanelBtnAmount
return targetIndex
}

const findSourcesForPanel = (client: IClientList) => {
let sourceIndex = 0
let btnNumber = 0
while (btnNumber < 6) {
while (btnNumber < btnAmount) {
if (!targets[client.targetIndex].sourceFilter?.includes(sourceIndex)) {
client.sourcesOnbuttons.push(sourceIndex)
btnNumber++
Expand All @@ -116,15 +118,15 @@ const handleReceivedCommand = (command: string, client: IClientList) => {
'Event : ',
event
)
if (btnNumber <= 6) {
if (btnNumber <= btnAmount) {
if (event === 'Up') {
setCrossPoint(client.sourcesOnbuttons[btnNumber-1], client.targetIndex) // For now only targetIndex 0 i supported
}
}
}

const updateAllLabels = () => {
for (let i = 0; i <= 6; i++) {
for (let i = 0; i <= btnAmount; i++) {
clientList.forEach((client) => {
updateLabelState(i, client)
})
Expand All @@ -145,7 +147,7 @@ const updateLabelState = (btnIndex: number, client: IClientList) => {

export const skaarhojUpdateButtonLights = () => {
console.log('Skaarhoj update button state')
for (let i = 0; i <= 6; i++) {
for (let i = 0; i <= btnAmount; i++) {
clientList.forEach((client) => {
let active: string =
targets[client.targetIndex].selectedSource === client.sourcesOnbuttons[i] ? '3' : '0'
Expand Down

0 comments on commit 5dede51

Please sign in to comment.