Skip to content

Commit 8a7ff83

Browse files
committed
Fix issue that outputs could not be disabled
1 parent 3d434c8 commit 8a7ff83

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

ArtNet4-Plugin/ArtNetInterface.cs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,49 +58,56 @@ private set
5858
}
5959
}
6060

61+
private void setPortConfigType(EPortType type, bool enable)
62+
{
63+
if (enable)
64+
portConfig.Type |= type;
65+
else
66+
portConfig.Type &= ~type;
67+
}
68+
6169
protected override void OnOutputEnable(int port)
6270
{
63-
portConfig.Type |= EPortType.InputToArtNet;
64-
portConfig.Type &= ~EPortType.OutputFromArtNet;
65-
portConfig.GoodInput = GoodInput.None;
71+
setPortConfigType(EPortType.InputToArtNet, true);
6672
portConfig.GoodOutput = new GoodOutput(isBeingOutputAsDMX: true);
73+
6774
IsOutput = true;
6875
}
6976

7077
protected override void OnOutputDisable(int port)
7178
{
72-
portConfig.Type &= ~EPortType.InputToArtNet;
73-
portConfig.GoodInput = GoodInput.None;
74-
portConfig.GoodOutput = new GoodOutput(isBeingOutputAsDMX: true);
79+
setPortConfigType(EPortType.InputToArtNet, false);
80+
portConfig.GoodOutput = GoodOutput.None;
81+
7582
IsOutput = false;
7683
}
7784

7885
protected override void OnInputEnable(int port)
7986
{
80-
portConfig.Type |= EPortType.OutputFromArtNet;
81-
portConfig.Type &= ~EPortType.InputToArtNet;
82-
portConfig.GoodInput = GoodInput.None;
83-
portConfig.GoodOutput = new GoodOutput(isBeingOutputAsDMX: false);
87+
setPortConfigType(EPortType.OutputFromArtNet, true);
88+
portConfig.GoodInput = new GoodInput(inputDisabled: false);
89+
8490
IsInput = true;
8591
}
8692

8793
protected override void OnInputDisable(int port)
8894
{
89-
portConfig.Type &= ~EPortType.OutputFromArtNet;
95+
setPortConfigType(EPortType.OutputFromArtNet, false);
9096
portConfig.GoodInput = GoodInput.None;
91-
portConfig.GoodOutput = new GoodOutput(isBeingOutputAsDMX: false);
97+
9298
IsInput = false;
9399
}
94100

95101
protected override void OnEnable()
96102
{
97-
portConfig.GoodInput = GetOutputState(0) ? new GoodInput(dataReceived: true) : new GoodInput(inputDisabled: true);
98-
portConfig.GoodOutput = GetInputState(0) ? new GoodOutput(isBeingOutputAsDMX: true) : new GoodOutput(isBeingOutputAsDMX: false);
103+
portConfig.Type = EPortType.DMX512;
104+
99105
if (IsInput)
100106
{
101107
OnInputEnable(0);
102108
OnOutputDisable(0);
103109
}
110+
104111
if (IsOutput)
105112
{
106113
OnOutputEnable(0);
@@ -110,9 +117,11 @@ protected override void OnEnable()
110117

111118
protected override void OnDisable()
112119
{
113-
portConfig.Type = EPortType.DMX512;
114120
portConfig.GoodInput = GoodInput.None;
115121
portConfig.GoodOutput = GoodOutput.None;
122+
123+
setPortConfigType(EPortType.OutputFromArtNet, false);
124+
setPortConfigType(EPortType.InputToArtNet, false);
116125
}
117126

118127
public override EInterfaceOptions Options

ArtNet4-Plugin/ArtisticLicenseArtNet4.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="ArtNetSharp" Version="0.0.38" PrivateAssets="all" />
15+
<PackageReference Include="ArtNetSharp" Version="0.0.39" PrivateAssets="all" />
1616
<Reference Include="DMXLIB">
1717
<HintPath Condition="Exists('..\..\DMXPlugins\DMXLIB\bin\Debug\netstandard2.0')">..\..\DMXPlugins\DMXLIB\bin\Debug\netstandard2.0\DMXLIB.dll</HintPath>
1818
<HintPath Condition="Exists('..\dep')">..\dep\DMXLIB.dll</HintPath>

0 commit comments

Comments
 (0)