Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Common/inpout32.dll
Binary file not shown.
Binary file modified Common/inpoutx64.dll
Binary file not shown.
32 changes: 25 additions & 7 deletions Modules/Output/595/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@
using Vixen.Module;
using Vixen.Module.Controller;
using Vixen.Commands;
using System;

namespace VixenModules.Output.Olsen595
{
public class Module : ControllerModuleInstanceBase {
internal class LoadInpOutDLL
{
[DllImport("inpout32", EntryPoint = "Out32")]
private static extern void Out(ushort port, short data);
private static extern short Out32(ushort port, short data);

[DllImport("inpoutx64", EntryPoint = "Out32")]
private static extern short Out64(ushort port, short data);

public static short outputData(ushort port, short data)
{
if (Environment.Is64BitOperatingSystem)
{
return Out64(port, data);
}
else
{
return Out32(port, data);
}
}
}
public class Module : ControllerModuleInstanceBase {
private Data _moduleData;
private CommandHandler _commandHandler;

Expand Down Expand Up @@ -43,13 +61,13 @@ public override void UpdateState(int chainIndex, ICommand[] outputStates) {
command.Dispatch(_commandHandler);
}

Out(_moduleData.Port, _commandHandler.Value);
Out(controlPort, 2);
Out(controlPort, 3);
LoadInpOutDLL.outputData(_moduleData.Port, _commandHandler.Value);
LoadInpOutDLL.outputData(controlPort, 2);
LoadInpOutDLL.outputData(controlPort, 3);
}

Out(controlPort, 1);
Out(controlPort, 3);
LoadInpOutDLL.outputData(controlPort, 1);
LoadInpOutDLL.outputData(controlPort, 3);
}
}
}
Expand Down
Binary file modified Modules/Output/595/inpout32.dll
Binary file not shown.
Binary file modified Modules/Output/595/inpoutx64.dll
Binary file not shown.
37 changes: 27 additions & 10 deletions Modules/Output/Hill320/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,35 @@ namespace VixenModules.Output.Hill320
[DataContract]
class Data : ModuleDataModelBase
{
private ushort _controlPort;
private ushort _dataPort;
private ushort _statusPort;

[DataMember]
public ushort PortAddress { get; set; }
[DataMember]
public ushort ControlPort { get; set; }
public ushort PortAddress
{
get { return _dataPort; }
set{_dataPort = value;}
}

[DataMember]
public ushort StatusPort { get; set; }

public ushort ControlPort
{
get { return _controlPort; }
set { _controlPort = value; }
}

[DataMember]
public ushort StatusPort
{
get { return _statusPort; }
set { _statusPort = value; }
}


public override IModuleDataModel Clone()
{
Data newInstance = new Data() { PortAddress = PortAddress };
return newInstance;
}
public override IModuleDataModel Clone()
{
return new Data() { PortAddress = PortAddress, ControlPort = ControlPort, StatusPort = StatusPort };
}
}
}
3 changes: 2 additions & 1 deletion Modules/Output/Hill320/Hill320.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down
75 changes: 27 additions & 48 deletions Modules/Output/Hill320/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
using Vixen.Commands;
using Vixen.Module;
using Vixen.Module.Controller;
using Vixen.Sys;
using System.Diagnostics;

namespace VixenModules.Output.Hill320 {
internal class LoadInpOutDLL {
[DllImport("inpout32", EntryPoint = "Out32")]
private static extern short Out32(ushort port, short data);
private static extern short Out32(ushort port, ushort data);

[DllImport("inpoutx64", EntryPoint = "Out32")]
private static extern short Out64(ushort port, short data);
private static extern short Out64(ushort port, ushort data);

public static short outputData(ushort port, short data) {
public static short outputData(ushort port, ushort data) {
if(Environment.Is64BitOperatingSystem) {
return Out64(port, data);
} else {
Expand Down Expand Up @@ -62,65 +62,44 @@ public override void UpdateState(int chainIndex, ICommand[] outputStates) {

int loopCount = outputStates.Length >> 3;

for(int box = 0; box < loopCount; box++) {
for(int box = 0; box < loopCount; box++)
{
value = 0;
for(bitCount = 0; bitCount < 8; bitCount++) {
ICommand command = outputStates[valueIndex++];
for(bitCount = 0; bitCount < 8; bitCount++)
{
_commandHandler.Reset();
if(command != null) {

ICommand command = outputStates[valueIndex++];

if (command != null)
{
command.Dispatch(_commandHandler);
}

value >>= 1;
if(_commandHandler.Value > 0) {
value |= 0x80;
value >>= 1;
if (_commandHandler.Value > 0)
value |= (byte)0x80;
else
value |= (byte)0;
}
else
{
value >>= 1;
value |= (byte)0;
}

}

bank = (byte)(8 << (box >> 3));
bankBox = (byte)(box % 8);


//Write #1
//Outputs data byte (D0-D7) on pins 2-9 of parallel port. This is the data
//we are trying to send to box XX.
LoadInpOutDLL.outputData(_moduleData.PortAddress, value);


//Write #2:
//Outputs a 1 (high) on C0 and C1 (pins 1 and 14) since they are inverted
//without changing any states on the data pins. This opens the
//"data buffer" flip-flop so that it can read the data on D0-D7.
//It also opens up the decoders for each bank solely to avoid the need for a 7th write.
LoadInpOutDLL.outputData(_moduleData.ControlPort, 0);


//Write #3
//Outputs a 0 (low) on C0 and a 1 (high) on C1 since they are inverted. Again, not
//changing any states on the data pins. This "locks" the data presently on D0-D7
//into the data buffer (C0) but leaves the state of the decoders (C1) unchanged.
LoadInpOutDLL.outputData(_moduleData.ControlPort, 1);

// Write #4
// Outputs the steering (addressing) data on the data pins
LoadInpOutDLL.outputData(_moduleData.ControlPort, (short)(bank | bankBox));
if(value > 0) {
Console.Out.WriteLine((short)(bank | bankBox) + "," + value);
}

//Write #5
//Outputs a 0 (low) on both C0 and C1 since they are inverted. This locks
//the data into the correct decoder which sends a "low" single to the clock
//port of one of the 40 flip flops allowing the data from the "buffer" flip flop
//to flow in.
LoadInpOutDLL.outputData(_moduleData.PortAddress, (ushort)(bank | bankBox));
LoadInpOutDLL.outputData(_moduleData.ControlPort, 3);

//Write #6
//Outputs a 0 (low) on C0 and a 1 (high) on C1 since they are inverted. Again, not
//changing any states on the data pins. This locks the data into the correct
//flip flop and will remain transmitting this data to the relays until the next time
//this box needs to be modified.
LoadInpOutDLL.outputData(_moduleData.ControlPort, 1);

Debug.WriteLine(String.Format("{0} {1} {2}",_moduleData.PortAddress, value, ((ushort)(bank | bankBox))));
}
}
}
Expand Down
Binary file modified Modules/Output/Hill320/inpout32.dll
Binary file not shown.
Binary file modified Modules/Output/Hill320/inpoutx64.dll
Binary file not shown.