Commit 5695894c LN

新artnet协议料架修改,增加phy地址。

1 个父辈 e85ad7f6
...@@ -28,5 +28,7 @@ namespace SmartShelf.Common ...@@ -28,5 +28,7 @@ namespace SmartShelf.Common
/// 料架灯类型,0=单色灯料架,1=三色灯料架 /// 料架灯类型,0=单色灯料架,1=三色灯料架
/// </summary> /// </summary>
public static string DeviceLedType = "DeviceLedType"; public static string DeviceLedType = "DeviceLedType";
public static string DefaultDeviceIP = "DefaultDeviceIP";
} }
} }
位置,优先级,高度,宽度,料仓ID,设备IP,区域ID,灯索引 位置,优先级,高度,宽度,料仓ID,设备IP,区域ID,灯索引
1_1_1,10,8,7,1,192.168.201.221,0,0 1_1_1,10,8,7,1,192.168.201.191,0,0
1_1_2,10,8,7,1,192.168.201.221,0,1 1_1_2,10,8,7,1,192.168.201.192,0,1
1_1_3,10,8,7,1,192.168.201.221,0,2 1_1_3,10,8,7,1,192.168.201.193,0,2
1_1_4,10,8,7,1,192.168.201.221,0,3 1_1_4,10,8,7,1,192.168.201.221,0,3
1_1_5,10,8,7,1,192.168.201.221,0,4 1_1_5,10,8,7,1,192.168.201.221,0,4
1_1_6,10,8,7,1,192.168.201.221,0,5 1_1_6,10,8,7,1,192.168.201.221,0,5
......
...@@ -13,6 +13,8 @@ namespace SmartShelf.DeviceLibrary ...@@ -13,6 +13,8 @@ namespace SmartShelf.DeviceLibrary
public static Dictionary<string, LEDBaseModule> deviceMap = new Dictionary<string, LEDBaseModule>(); public static Dictionary<string, LEDBaseModule> deviceMap = new Dictionary<string, LEDBaseModule>();
public static byte DefaultLight = 100; public static byte DefaultLight = 100;
public static int DeviceLedType = ConfigAppSettings.GetIntValue(Setting_Init.DeviceLedType); public static int DeviceLedType = ConfigAppSettings.GetIntValue(Setting_Init.DeviceLedType);
public static string DefaultIP = ConfigAppSettings.GetValue(Setting_Init.DefaultDeviceIP);
public void Init() public void Init()
{ {
} }
...@@ -84,7 +86,6 @@ namespace SmartShelf.DeviceLibrary ...@@ -84,7 +86,6 @@ namespace SmartShelf.DeviceLibrary
protected ushort Max_DMX = 16; protected ushort Max_DMX = 16;
public int Max_Light = 170; public int Max_Light = 170;
protected IPEndPoint iep = null;
public string ModuleIP = ""; public string ModuleIP = "";
public static LEDBaseModule GetModule(string ip) public static LEDBaseModule GetModule(string ip)
{ {
......
...@@ -19,15 +19,41 @@ namespace SmartShelf.DeviceLibrary ...@@ -19,15 +19,41 @@ namespace SmartShelf.DeviceLibrary
private int datalength = 512; private int datalength = 512;
private List<byte[]> dmxDatas = null; private List<byte[]> dmxDatas = null;
private string phyIP = "";
private string phyAddr = "00";
private IPEndPoint iep = null;
internal LEDColorArtNet(string ip) : base(ip) internal LEDColorArtNet(string ip) : base(ip)
{ {
this.phyIP = ip;
if (!String.IsNullOrEmpty(LEDManager.DefaultIP))
{
try
{
string[] array = phyIP.Split('.');
if (array.Length == 4)
{
int addr = Convert.ToInt32(array[3]);
phyAddr = ((byte)addr).ToString("X2");
}
}
catch (Exception ex)
{
LogUtil.error("IP【" + ip + "】解析phyAddr出错:" + ex.ToString());
}
iep = new IPEndPoint(IPAddress.Parse(LEDManager.DefaultIP), 6454);
}
else
{
phyAddr = "00";
iep = new IPEndPoint(IPAddress.Parse(ip), 6454);
}
Max_Light = 170; Max_Light = 170;
Max_DMX = 16; Max_DMX = 16;
datalength = 512; datalength = 512;
Max_Light = datalength / 3; Max_Light = datalength / 3;
dmxDatas = new List<byte[]>(Max_DMX); dmxDatas = new List<byte[]>(Max_DMX);
iep = new IPEndPoint(IPAddress.Parse(ip), 6454);
AllLightOff(); AllLightOff();
} }
...@@ -183,6 +209,7 @@ namespace SmartShelf.DeviceLibrary ...@@ -183,6 +209,7 @@ namespace SmartShelf.DeviceLibrary
string ProVer = "000e"; string ProVer = "000e";
string seq = "00"; string seq = "00";
string phy = "00"; string phy = "00";
phy = phyAddr;
string SubUni = "00"; string SubUni = "00";
SubUni = String.Format("{0:X}", dmxIndex).PadLeft(2, '0'); SubUni = String.Format("{0:X}", dmxIndex).PadLeft(2, '0');
string Net = "00"; string Net = "00";
......
...@@ -22,6 +22,7 @@ namespace SmartShelf.DeviceLibrary ...@@ -22,6 +22,7 @@ namespace SmartShelf.DeviceLibrary
//byte[][] dmxData = new byte[MAX_RGBDMX_UNI][]; //byte[][] dmxData = new byte[MAX_RGBDMX_UNI][];
private List<byte[]> dmxDatas = new List<byte[]>(MAX_RGBDMX_UNI); private List<byte[]> dmxDatas = new List<byte[]>(MAX_RGBDMX_UNI);
private IPEndPoint iep = null;
internal LEDColorModule(string ip) : base(ip) internal LEDColorModule(string ip) : base(ip)
{ {
iep = new IPEndPoint(IPAddress.Parse(ip), 6858); iep = new IPEndPoint(IPAddress.Parse(ip), 6858);
......
...@@ -19,6 +19,7 @@ namespace SmartShelf.DeviceLibrary ...@@ -19,6 +19,7 @@ namespace SmartShelf.DeviceLibrary
//每个DMX域的灯数量 //每个DMX域的灯数量
internal const int LIGHT_COUNT_PER_DMX = 512; internal const int LIGHT_COUNT_PER_DMX = 512;
private IPEndPoint iep = null;
private List<byte[]> dmxDatas = new List<byte[]>(MAX_RGBDMX_UNI); private List<byte[]> dmxDatas = new List<byte[]>(MAX_RGBDMX_UNI);
public string ModuleIP = ""; public string ModuleIP = "";
internal LEDSingleModule(string ip) : base(ip) internal LEDSingleModule(string ip) : base(ip)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<!--料仓cid--> <!--料仓cid-->
<add key="Store_CID" value="rc1272_1" /> <add key="Store_CID" value="rc1272_1" />
<add key ="BoxCount" value ="1"/> <add key ="BoxCount" value ="1"/>
<add key ="DefaultDeviceIP" value ="192.168.201.191"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
namespace SmartShelf
{
partial class FrmConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmConfig));
this.label1 = new System.Windows.Forms.Label();
this.btnSave = new System.Windows.Forms.Button();
this.btnBack = new System.Windows.Forms.Button();
this.txtIP = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(12, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(356, 20);
this.label1.TabIndex = 0;
this.label1.Text = "第一块控制器模块IP:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnSave
//
this.btnSave.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(192, 115);
this.btnSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(103, 36);
this.btnSave.TabIndex = 275;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = false;
this.btnSave.Click += new System.EventHandler(this.btnNext_Click);
//
// btnBack
//
this.btnBack.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(84, 115);
this.btnBack.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(103, 36);
this.btnBack.TabIndex = 274;
this.btnBack.Text = "取消";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// txtIP
//
this.txtIP.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtIP.Location = new System.Drawing.Point(84, 68);
this.txtIP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtIP.Name = "txtIP";
this.txtIP.Size = new System.Drawing.Size(211, 29);
this.txtIP.TabIndex = 276;
this.txtIP.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPwd_KeyDown);
//
// FrmConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(380, 205);
this.Controls.Add(this.txtIP);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.label1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "FrmConfig";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "控制器配置";
this.Load += new System.EventHandler(this.FrmPwd_Load);
this.Shown += new System.EventHandler(this.FrmPwd_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmPwd_KeyDown);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.TextBox txtIP;
}
}
\ No newline at end of file \ No newline at end of file

using SmartShelf.Common;
using SmartShelf.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SmartShelf
{
internal partial class FrmConfig :Form
{
internal FrmConfig( )
{
InitializeComponent();
}
private void FrmPwd_Load(object sender, EventArgs e)
{
txtIP.Text = LEDManager.DefaultIP;
}
private void btnNext_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
ConfigAppSettings.SaveValue(Setting_Init.DefaultDeviceIP, ip);
LEDManager.DefaultIP = ip;
MessageBox.Show("保存成功,重启软件后生效");
this.Close();
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmPwd_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.Equals(Keys.Enter))
{
btnNext_Click(null, null);
}
}
private void txtPwd_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.Equals(Keys.Enter))
{
btnNext_Click(null, null);
}else if (e.KeyCode.Equals(Keys.Escape))
{
btnBack_Click(null, null);
}
}
private void FrmPwd_Shown(object sender, EventArgs e)
{
txtIP.Focus();
}
}
}
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.chbAuto = new System.Windows.Forms.CheckBox(); this.chbAuto = new System.Windows.Forms.CheckBox();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -62,6 +63,7 @@ ...@@ -62,6 +63,7 @@
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.启动手动料仓ToolStripMenuItem, this.启动手动料仓ToolStripMenuItem,
this.关闭手动料仓ToolStripMenuItem, this.关闭手动料仓ToolStripMenuItem,
this.toolStripMenuItem1,
this.退出程序ToolStripMenuItem, this.退出程序ToolStripMenuItem,
this.清理日志ToolStripMenuItem}); this.清理日志ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
...@@ -126,6 +128,13 @@ ...@@ -126,6 +128,13 @@
this.chbAuto.UseVisualStyleBackColor = true; this.chbAuto.UseVisualStyleBackColor = true;
this.chbAuto.CheckedChanged += new System.EventHandler(this.chbAuto_CheckedChanged); this.chbAuto.CheckedChanged += new System.EventHandler(this.chbAuto_CheckedChanged);
// //
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(102, 25);
this.toolStripMenuItem1.Text = "控制器配置";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
// FrmShelf // FrmShelf
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -161,5 +170,6 @@ ...@@ -161,5 +170,6 @@
private System.Windows.Forms.ToolStripMenuItem 清理日志ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 清理日志ToolStripMenuItem;
public System.Windows.Forms.RichTextBox richTextBox1; public System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.CheckBox chbAuto; private System.Windows.Forms.CheckBox chbAuto;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -36,6 +36,7 @@ namespace SmartShelf ...@@ -36,6 +36,7 @@ namespace SmartShelf
LogUtil.error("未加载到完整的配置"); LogUtil.error("未加载到完整的配置");
Application.Exit(); Application.Exit();
} }
toolStripMenuItem1.Visible = (LEDManager.DeviceLedType.Equals(2));
LoadStoreData(); LoadStoreData();
LoadOk = true; LoadOk = true;
} }
...@@ -170,5 +171,11 @@ namespace SmartShelf ...@@ -170,5 +171,11 @@ namespace SmartShelf
ManagerUtil.AutoRun(Application.ExecutablePath, false); ManagerUtil.AutoRun(Application.ExecutablePath, false);
} }
} }
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
FrmConfig frm = new FrmConfig();
frm.ShowDialog();
}
} }
} }
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="FrmConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmConfig.Designer.cs">
<DependentUpon>FrmConfig.cs</DependentUpon>
</Compile>
<Compile Include="FrmShelf.cs"> <Compile Include="FrmShelf.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -65,6 +71,9 @@ ...@@ -65,6 +71,9 @@
<Compile Include="ManagerUtil.cs" /> <Compile Include="ManagerUtil.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmConfig.resx">
<DependentUpon>FrmConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmShelf.resx"> <EmbeddedResource Include="FrmShelf.resx">
<DependentUpon>FrmShelf.cs</DependentUpon> <DependentUpon>FrmShelf.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -8,3 +8,8 @@ linePositions.csv文件里面: ...@@ -8,3 +8,8 @@ linePositions.csv文件里面:
设备IP:配置刚刚修改好的IP, 设备IP:配置刚刚修改好的IP,
区域ID:0-15,根据接线的通道配置 区域ID:0-15,根据接线的通道配置
灯索引:0-170,按照灯条顺序配置,第一个灯是0,以此类推。 灯索引:0-170,按照灯条顺序配置,第一个灯是0,以此类推。
20200601
增加与电脑连接的模块IP地址的配置。
库位中对应的IP转为站号使用
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!