Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
SmartShelf
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit beb326b5
由
LN
编写于
2020-06-04 09:27:26 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
RGB颜色顺序增加配置
1 个父辈
e618cd30
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
125 行增加
和
18 行删除
Common/Setting_Init.cs
DeviceLibrary/DeviceLibrary/led/BaseLEDManager.cs
DeviceLibrary/DeviceLibrary/led/LEDColorArtNet.cs
DeviceLibrary/DeviceLibrary/led/LEDSingleModule.cs
DeviceLibrary/manager/BOXManager.cs
SmartShelf/App.config
SmartShelf/FrmConfig.Designer.cs
SmartShelf/FrmConfig.cs
SmartShelf/记录.txt
Common/Setting_Init.cs
查看文件 @
beb326b
...
...
@@ -35,5 +35,10 @@ namespace SmartShelf.Common
/// 状态灯区域ID
/// </summary>
public
static
string
StatusLedDmx
=
"StatusLedDmx"
;
/// <summary>
/// 颜色规则配置
/// </summary>
public
static
string
ColorRuleConfig
=
"ColorRuleConfig"
;
}
}
DeviceLibrary/DeviceLibrary/led/BaseLEDManager.cs
查看文件 @
beb326b
...
...
@@ -14,6 +14,9 @@ namespace SmartShelf.DeviceLibrary
public
static
byte
DefaultLight
=
100
;
public
static
int
DeviceLedType
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
DeviceLedType
);
public
static
string
ColorRule
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ColorRuleConfig
).
ToUpper
();
public
static
string
DefaultIP
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
DefaultDeviceIP
);
public
static
LEDBaseModule
GetLedModule
(
string
ip
)
...
...
@@ -30,6 +33,20 @@ namespace SmartShelf.DeviceLibrary
}
return
led
;
}
public
static
void
Init
()
{
ColorRule
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ColorRuleConfig
).
ToUpper
();
if
(
ColorRule
.
Length
==
3
&&
ColorRule
.
Contains
(
"R"
)
&&
ColorRule
.
Contains
(
"G"
)
&&
ColorRule
.
Contains
(
"B"
))
{
}
else
{
LEDManager
.
ColorRule
=
"RGB"
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
ColorRuleConfig
,
LEDManager
.
ColorRule
);
}
LoadStatusDMX
();
}
public
static
void
LoadStatusDMX
()
{
StatusLedDmx
=
new
List
<
int
>();
...
...
DeviceLibrary/DeviceLibrary/led/LEDColorArtNet.cs
查看文件 @
beb326b
...
...
@@ -82,10 +82,19 @@ namespace SmartShelf.DeviceLibrary
}
byte
[]
data
=
dmxDatas
[
ldmx
];
int
redIndex
=
LEDManager
.
ColorRule
.
IndexOf
(
'R'
);
int
greedIndex
=
LEDManager
.
ColorRule
.
IndexOf
(
'G'
);
int
blueIndex
=
LEDManager
.
ColorRule
.
IndexOf
(
'B'
);
//SPI第二通道为蓝色,DMX第二通道为绿色
data
[
lIndex
*
3
]
=
red
;
data
[
lIndex
*
3
+
1
]
=
green
;
data
[
lIndex
*
3
+
2
]
=
blue
;
data
[
lIndex
*
3
+
redIndex
]
=
red
;
data
[
lIndex
*
3
+
greedIndex
]
=
green
;
data
[
lIndex
*
3
+
blueIndex
]
=
blue
;
////SPI第二通道为蓝色,DMX第二通道为绿色
//data[lIndex * 3] = red;
//data[lIndex * 3 + 1] = green;
//data[lIndex * 3 + 2] = blue;
}
public
override
void
AllLightOff
(
int
dmx
=
-
1
)
{
...
...
DeviceLibrary/DeviceLibrary/led/LEDSingleModule.cs
查看文件 @
beb326b
using
System
;
using
SmartShelf.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
...
...
DeviceLibrary/manager/BOXManager.cs
查看文件 @
beb326b
...
...
@@ -71,7 +71,7 @@ namespace SmartShelf.DeviceLibrary
{
return
false
;
}
LEDManager
.
LoadStatusDMX
();
LEDManager
.
Init
();
LEDManager
.
deviceMap
=
new
Dictionary
<
string
,
LEDBaseModule
>();
StatusColorMap
=
new
Dictionary
<
string
,
string
>();
foreach
(
BoxPosition
box
in
PositionMap
.
Values
)
...
...
SmartShelf/App.config
查看文件 @
beb326b
...
...
@@ -20,6 +20,8 @@
<
add
key
=
"DefaultDeviceIP"
value
=
"192.168.201.191"
/>
<!--状态灯地址,;分割-->
<
add
key
=
"StatusLedDmx"
value
=
"0"
/>
<!--灯条颜色规则配置-->
<
add
key
=
"ColorRuleConfig"
value
=
"RGB"
/>
</
appSettings
>
<
log4net
>
<
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
...
...
SmartShelf/FrmConfig.Designer.cs
查看文件 @
beb326b
...
...
@@ -35,14 +35,17 @@
this
.
txtIP
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtStaDmxId
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label2
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
comBoxColor
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
SuspendLayout
();
//
// label1
//
this
.
label1
.
AutoSize
=
true
;
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
.
Location
=
new
System
.
Drawing
.
Point
(
72
,
71
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
356
,
20
);
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
148
,
20
);
this
.
label1
.
TabIndex
=
0
;
this
.
label1
.
Text
=
"第一块控制器模块IP:"
;
this
.
label1
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
...
...
@@ -52,7 +55,7 @@
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
,
231
);
this
.
btnSave
.
Location
=
new
System
.
Drawing
.
Point
(
226
,
256
);
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
);
...
...
@@ -66,7 +69,7 @@
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
,
231
);
this
.
btnBack
.
Location
=
new
System
.
Drawing
.
Point
(
118
,
256
);
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
);
...
...
@@ -78,37 +81,68 @@
// 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
.
Location
=
new
System
.
Drawing
.
Point
(
226
,
67
);
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
.
Size
=
new
System
.
Drawing
.
Size
(
142
,
29
);
this
.
txtIP
.
TabIndex
=
276
;
this
.
txtIP
.
KeyDown
+=
new
System
.
Windows
.
Forms
.
KeyEventHandler
(
this
.
txtPwd_KeyDown
);
//
// txtStaDmxId
//
this
.
txtStaDmxId
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
txtStaDmxId
.
Location
=
new
System
.
Drawing
.
Point
(
84
,
157
);
this
.
txtStaDmxId
.
Location
=
new
System
.
Drawing
.
Point
(
226
,
121
);
this
.
txtStaDmxId
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
2
,
3
,
2
);
this
.
txtStaDmxId
.
Name
=
"txtStaDmxId"
;
this
.
txtStaDmxId
.
Size
=
new
System
.
Drawing
.
Size
(
211
,
29
);
this
.
txtStaDmxId
.
Size
=
new
System
.
Drawing
.
Size
(
142
,
29
);
this
.
txtStaDmxId
.
TabIndex
=
278
;
//
// label2
//
this
.
label2
.
AutoSize
=
true
;
this
.
label2
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
123
);
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
44
,
125
);
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
35
6
,
20
);
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
17
6
,
20
);
this
.
label2
.
TabIndex
=
277
;
this
.
label2
.
Text
=
"状态灯区域地址(用;分隔):"
;
this
.
label2
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// label3
//
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
113
,
185
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
107
,
20
);
this
.
label3
.
TabIndex
=
279
;
this
.
label3
.
Text
=
"灯条颜色顺序:"
;
this
.
label3
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// comBoxColor
//
this
.
comBoxColor
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
comBoxColor
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
comBoxColor
.
FormattingEnabled
=
true
;
this
.
comBoxColor
.
Items
.
AddRange
(
new
object
[]
{
"RGB=红绿蓝"
,
"RBG=红蓝绿"
,
"GRB=绿红蓝"
,
"GBR=绿蓝红"
,
"BRG=蓝红绿"
,
"BGR=蓝绿红"
});
this
.
comBoxColor
.
Location
=
new
System
.
Drawing
.
Point
(
226
,
182
);
this
.
comBoxColor
.
Name
=
"comBoxColor"
;
this
.
comBoxColor
.
Size
=
new
System
.
Drawing
.
Size
(
142
,
28
);
this
.
comBoxColor
.
TabIndex
=
280
;
//
// FrmConfig
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
380
,
308
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
459
,
339
);
this
.
Controls
.
Add
(
this
.
comBoxColor
);
this
.
Controls
.
Add
(
this
.
label3
);
this
.
Controls
.
Add
(
this
.
txtStaDmxId
);
this
.
Controls
.
Add
(
this
.
label2
);
this
.
Controls
.
Add
(
this
.
txtIP
);
...
...
@@ -136,5 +170,7 @@
private
System
.
Windows
.
Forms
.
TextBox
txtIP
;
private
System
.
Windows
.
Forms
.
TextBox
txtStaDmxId
;
private
System
.
Windows
.
Forms
.
Label
label2
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
ComboBox
comBoxColor
;
}
}
\ No newline at end of file
SmartShelf/FrmConfig.cs
查看文件 @
beb326b
...
...
@@ -19,11 +19,34 @@ namespace SmartShelf
{
InitializeComponent
();
}
private
List
<
string
>
ColorList
=
new
List
<
string
>();
private
void
FrmPwd_Load
(
object
sender
,
EventArgs
e
)
{
txtIP
.
Text
=
LEDManager
.
DefaultIP
;
txtStaDmxId
.
Text
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
StatusLedDmx
);
ColorList
=
new
List
<
string
>(){
"RGB=红绿蓝"
,
"RBG=红蓝绿"
,
"GRB=绿红蓝"
,
"GBR=绿蓝红"
,
"BRG=蓝红绿"
,
"BGR=蓝绿红"
};
comBoxColor
.
Items
.
Clear
();
int
index
=
0
;
int
i
=
0
;
foreach
(
string
s
in
ColorList
)
{
comBoxColor
.
Items
.
Add
(
s
);
if
(
s
.
Contains
(
LEDManager
.
ColorRule
))
{
index
=
i
;
}
i
++;
}
comBoxColor
.
SelectedIndex
=
index
;
}
private
void
btnNext_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -37,6 +60,15 @@ namespace SmartShelf
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
StatusLedDmx
,
dmxIds
);
LEDManager
.
LoadStatusDMX
();
string
colorText
=
comBoxColor
.
Text
;
if
(
colorText
.
Length
>=
7
)
{
string
result
=
colorText
.
Substring
(
0
,
3
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
ColorRuleConfig
,
result
);
LEDManager
.
ColorRule
=
result
;
LogUtil
.
info
(
"保存灯条颜色配置:"
+
Setting_Init
.
ColorRuleConfig
+
"="
+
result
);
}
MessageBox
.
Show
(
"保存成功,重启软件后生效"
);
this
.
Close
();
}
...
...
SmartShelf/记录.txt
查看文件 @
beb326b
...
...
@@ -19,4 +19,9 @@ linePositions.csv文件里面:
增加配置,表示状态灯区域地址。
<!--状态灯地址,;分割-->
<add key ="StatusLedDmx" value ="0"/>
\ No newline at end of file
<add key ="StatusLedDmx" value ="0"/>
20200603
RGB颜色顺序增加配置。
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论