-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve DMX Usb device type detection. Add customizable OpenDMXUsb re…
…fresh rate
- Loading branch information
Showing
16 changed files
with
255 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { DmxDevice_t } from 'shared/connection' | ||
import { DmxConnectionUsb } from './DmxConnectionUsb' | ||
import { RealtimeState } from 'renderer/redux/realtimeStore' | ||
import { EngineContext } from 'main/engine/engineContext' | ||
|
||
export type DmxConnection = DmxConnectionUsb | ||
|
||
export async function createDmxConnection( | ||
device: DmxDevice_t, | ||
getRealtimeState: () => RealtimeState | ||
c: EngineContext | ||
): Promise<DmxConnection> { | ||
return DmxConnectionUsb.create(device, getRealtimeState) | ||
return DmxConnectionUsb.create(device, c) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,25 @@ | ||
import { SerialportInfo, DmxDevice_t, ConnectionId } from 'shared/connection' | ||
|
||
const dmxDeviceNames: { [key in DmxDevice_t['type']]: string } = { | ||
DmxUsbPro: 'Dmx Usb Pro', | ||
OpenDmxUsb: 'Open Dmx Usb', | ||
} | ||
|
||
function getConnectionId(port: SerialportInfo): ConnectionId { | ||
return port.path | ||
return port.serialNumber ?? port.path | ||
} | ||
|
||
function getDmxDeviceType(port: SerialportInfo): DmxDevice_t['type'] | null { | ||
const mfg = port.manufacturer | ||
|
||
if (mfg?.includes('DMX') || mfg?.includes('ENTTEC')) return 'DmxUsbPro' | ||
else if (mfg?.includes('FTDI')) return 'OpenDmxUsb' | ||
|
||
return null | ||
function isDmxDevice(port: SerialportInfo): boolean { | ||
return port.productId === '6001' | ||
} | ||
|
||
export function getDmxDevice(port: SerialportInfo): DmxDevice_t | null { | ||
let type = getDmxDeviceType(port) | ||
if (type === null) return null | ||
if (!isDmxDevice(port)) return null | ||
|
||
return { | ||
type, | ||
type: null, | ||
connectionId: getConnectionId(port), | ||
path: port.path, | ||
manufacturer: port.manufacturer, | ||
pnpId: port.pnpId, | ||
productId: port.productId, | ||
serialNumber: port.serialNumber, | ||
vendorId: port.vendorId, | ||
name: dmxDeviceNames[type], | ||
name: 'Dmx Usb Device', | ||
} | ||
} |
Oops, something went wrong.