Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
URSolderingRobot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0a8030fe
由
几米阳光
编写于
2018-07-20 09:21:57 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
送丝器修改
1 个父辈
637e6ef8
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
46 行增加
和
26 行删除
Common/util/SerialBean.cs
DeviceLibrary/deviceLibrary/jbc/SendWireManager.cs
URSolderingClient/FrmSendWire.cs
Common/util/SerialBean.cs
查看文件 @
0a8030f
...
...
@@ -341,8 +341,7 @@ namespace URSoldering.Common
}
if
(
_serialPort
.
BytesToRead
>=
ReceiveData
.
Length
)
{
ReceiveData
=
new
byte
[
_serialPort
.
BytesToRead
];
ret
=
_serialPort
.
Read
(
ReceiveData
,
0
,
_serialPort
.
BytesToRead
);
ret
=
_serialPort
.
Read
(
ReceiveData
,
0
,
ReceiveData
.
Length
);
}
else
if
(
_serialPort
.
BytesToRead
>
0
)
{
...
...
@@ -524,7 +523,7 @@ namespace URSoldering.Common
int
j
=
0
;
for
(
int
i
=
0
;
i
<
temps
.
Length
;
i
=
i
+
2
,
j
++)
{
tempb
[
j
]
=
Convert
.
ToByte
(
temps
.
Substring
(
i
,
2
),
16
);
tempb
[
j
]
=
Convert
.
ToByte
(
temps
.
Substring
(
i
,
2
),
16
);
}
byte
[]
send
=
new
byte
[
j
];
Array
.
Copy
(
tempb
,
send
,
j
);
...
...
DeviceLibrary/deviceLibrary/jbc/SendWireManager.cs
查看文件 @
0a8030f
...
...
@@ -26,16 +26,16 @@ namespace URSoldering.DeviceLibrary
private
static
StopBits
stopBits
=
StopBits
.
One
;
//停止位
private
static
SerialBean
sb
=
null
;
private
static
string
CMD_WriteMode
=
"WMOD00002"
;
private
static
string
CMD_SetSpeed
=
"WSPD"
;
private
static
string
CMD_SetSendLength
=
"WLEN"
;
private
static
string
CMD_GetS
peed
=
"
RLEN"
;
private
static
string
CMD_GetS
endLength
=
"
RSPD"
;
private
static
string
CMD_GetStatus
=
"RECV"
;
private
static
string
CMD_StartForwardSend
=
"WSFD00001"
;
private
static
string
CMD_StartBackSend
=
"WSFD00000"
;
private
static
string
CMD_StopSend
=
"WSSD00000"
;
private
static
string
CMD_Reset
=
"WCTP00000"
;
private
static
string
CMD_WriteMode
=
"
0010
WMOD00002"
;
private
static
string
CMD_SetSpeed
=
"
0010
WSPD"
;
private
static
string
CMD_SetSendLength
=
"
0010
WLEN"
;
private
static
string
CMD_GetS
endLength
=
"0010
RLEN"
;
private
static
string
CMD_GetS
peed
=
"0010
RSPD"
;
private
static
string
CMD_GetStatus
=
"
0010
RECV"
;
private
static
string
CMD_StartForwardSend
=
"
0010
WSFD00001"
;
private
static
string
CMD_StartBackSend
=
"
0010
WSFD00000"
;
private
static
string
CMD_StopSend
=
"
0010
WSSD00000"
;
private
static
string
CMD_Reset
=
"
0010
WCTP00000"
;
//private static string CMD_WriteMode = "02 57 4D 4F 44 30 30 30 30 32 03 22";
//private static string CMD_SetSpeed = "02 57 53 50 44 30 30 31 31 30 03 21";
...
...
@@ -110,14 +110,16 @@ namespace URSoldering.DeviceLibrary
{
bool
isOk
=
false
;
byte
[]
reviceData
=
parseCommand
(
CMD_GetSpeed
,
out
isOk
);
return
getReviceData
(
reviceData
);
int
data
=
getReviceData
(
reviceData
);
return
data
;
}
public
static
int
queryLength
()
{
bool
isOk
=
false
;
byte
[]
reviceData
=
parseCommand
(
CMD_GetSendLength
,
out
isOk
);
return
getReviceData
(
reviceData
);
int
data
=
getReviceData
(
reviceData
);
return
data
;
}
public
static
int
getReviceData
(
byte
[]
dataArray
)
{
...
...
@@ -128,10 +130,12 @@ namespace URSoldering.DeviceLibrary
{
return
0
;
}
for
(
int
i
=
5
;
i
<=
9
;
i
++)
if
(
dataArray
.
Length
>=
14
)
{
strData
+=
dataArray
[
i
]
+
""
;
for
(
int
i
=
9
;
i
<=
13
;
i
++)
{
strData
+=
(
char
)
dataArray
[
i
]
+
""
;
}
}
}
catch
(
Exception
ex
)
...
...
@@ -229,7 +233,11 @@ namespace URSoldering.DeviceLibrary
byte
[]
messageAll
=
new
byte
[
message
.
Length
+
1
];
message
.
CopyTo
(
messageAll
,
0
);
messageAll
[
messageAll
.
Length
-
1
]
=
(
byte
)
bcc
;
if
(
"R"
.
Equals
(
commandText
.
Substring
(
0
,
1
)))
if
(
commandText
.
Length
>=
5
&&
(
"R"
.
Equals
(
commandText
.
Substring
(
4
,
1
))))
{
data
=
new
byte
[
messageAll
.
Length
+
5
];
}
else
if
(
"R"
.
Equals
(
commandText
.
Substring
(
0
,
1
)))
{
data
=
new
byte
[
messageAll
.
Length
+
5
];
}
...
...
@@ -237,6 +245,8 @@ namespace URSoldering.DeviceLibrary
{
data
=
new
byte
[
messageAll
.
Length
-
5
];
}
string
str
=
SerialBean
.
byteToHexStr
(
messageAll
);
LogUtil
.
info
(
" 【"
+
commandText
+
"】 转换后【"
+
str
+
"】"
);
//data = new byte[messageAll.Length];
sb
.
SendCommand
(
messageAll
,
ref
data
,
2
,
out
isOk
);
string
rawMsg
=
Encoding
.
ASCII
.
GetString
(
data
,
0
,
data
.
Length
);
...
...
URSolderingClient/FrmSendWire.cs
查看文件 @
0a8030f
...
...
@@ -140,18 +140,29 @@ namespace URSoldering.Client
private
void
btnSend_Click
(
object
sender
,
EventArgs
e
)
{
string
msg
=
""
;
string
str
=
"02 30 30 31 30 57 53 46 44 30 30 30 30 31 03 37 "
;
byte
[]
data
=
SerialBean
.
StringToByte
(
str
);
if
(
data
!=
null
&&
data
.
Length
>
0
)
{
msg
=
Encoding
.
ASCII
.
GetString
(
data
,
1
,
data
.
Length
-
3
);
}
txtRevice
.
Text
=
""
;
string
text
=
txtSend
.
Text
;
bool
isOk
=
false
;
byte
[]
reviceData
=
SendWireManager
.
parseCommand
(
text
,
out
isOk
);
int
length
=
reviceData
.
Length
-
3
;
if
(
length
<=
0
)
byte
[]
reviceData
=
SendWireManager
.
parseCommand
(
text
,
out
isOk
);
if
(
reviceData
!=
null
&&
reviceData
.
Length
>
0
)
{
length
=
reviceData
.
Length
;
int
length
=
reviceData
.
Length
-
3
;
if
(
length
<=
0
)
{
length
=
reviceData
.
Length
;
}
string
rawMsg
=
Encoding
.
ASCII
.
GetString
(
reviceData
,
1
,
length
);
txtRevice
.
Text
=
rawMsg
;
}
string
rawMsg
=
Encoding
.
ASCII
.
GetString
(
reviceData
,
1
,
length
);
txtRevice
.
Text
=
rawMsg
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论