Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
URSolderingRobot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit c00f7091
由
几米阳光
编写于
2018-07-20 14:32:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
送丝调试修改
1 个父辈
0a8030fe
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
19 行删除
DeviceLibrary/deviceLibrary/jbc/SendWireManager.cs
URSolderingClient/FrmSendWire.cs
DeviceLibrary/deviceLibrary/jbc/SendWireManager.cs
查看文件 @
c00f709
...
@@ -24,7 +24,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -24,7 +24,7 @@ namespace URSoldering.DeviceLibrary
private
static
Parity
parity
=
Parity
.
None
;
//校验位
private
static
Parity
parity
=
Parity
.
None
;
//校验位
private
static
int
dataBits
=
8
;
//数据位
private
static
int
dataBits
=
8
;
//数据位
private
static
StopBits
stopBits
=
StopBits
.
One
;
//停止位
private
static
StopBits
stopBits
=
StopBits
.
One
;
//停止位
private
static
SerialBean
sb
=
null
;
private
static
Ac
SerialBean
sb
=
null
;
private
static
string
CMD_WriteMode
=
"0010WMOD00002"
;
private
static
string
CMD_WriteMode
=
"0010WMOD00002"
;
private
static
string
CMD_SetSpeed
=
"0010WSPD"
;
private
static
string
CMD_SetSpeed
=
"0010WSPD"
;
...
@@ -35,7 +35,8 @@ namespace URSoldering.DeviceLibrary
...
@@ -35,7 +35,8 @@ namespace URSoldering.DeviceLibrary
private
static
string
CMD_StartForwardSend
=
"0010WSFD00001"
;
private
static
string
CMD_StartForwardSend
=
"0010WSFD00001"
;
private
static
string
CMD_StartBackSend
=
"0010WSFD00000"
;
private
static
string
CMD_StartBackSend
=
"0010WSFD00000"
;
private
static
string
CMD_StopSend
=
"0010WSSD00000"
;
private
static
string
CMD_StopSend
=
"0010WSSD00000"
;
private
static
string
CMD_Reset
=
"0010WCTP00000"
;
private
static
string
CMD_Reset
=
"0010WECV00001"
;
//private static string CMD_Reset = "0010WCTP00000";
//private static string CMD_WriteMode = "02 57 4D 4F 44 30 30 30 30 32 03 22";
//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";
//private static string CMD_SetSpeed = "02 57 53 50 44 30 30 31 31 30 03 21";
...
@@ -54,7 +55,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -54,7 +55,7 @@ namespace URSoldering.DeviceLibrary
if
(
sb
==
null
)
if
(
sb
==
null
)
{
{
serialPort
=
port
;
serialPort
=
port
;
sb
=
new
SerialBean
(
serialPort
,
bautRate
,
parity
,
dataBits
,
stopBits
);
sb
=
new
Ac
SerialBean
(
serialPort
,
bautRate
,
parity
,
dataBits
,
stopBits
);
}
}
try
try
{
{
...
@@ -106,19 +107,19 @@ namespace URSoldering.DeviceLibrary
...
@@ -106,19 +107,19 @@ namespace URSoldering.DeviceLibrary
bool
isOk
=
false
;
bool
isOk
=
false
;
parseCommand
(
CMD_Reset
,
out
isOk
);
parseCommand
(
CMD_Reset
,
out
isOk
);
}
}
public
static
int
querySpeed
()
public
static
double
querySpeed
()
{
{
bool
isOk
=
false
;
bool
isOk
=
false
;
byte
[]
reviceData
=
parseCommand
(
CMD_GetSpeed
,
out
isOk
);
byte
[]
reviceData
=
parseCommand
(
CMD_GetSpeed
,
out
isOk
);
int
data
=
getReviceData
(
reviceData
)
;
double
data
=
(
double
)
getReviceData
(
reviceData
)/
10
;
return
data
;
return
data
;
}
}
public
static
int
queryLength
()
public
static
double
queryLength
()
{
{
bool
isOk
=
false
;
bool
isOk
=
false
;
byte
[]
reviceData
=
parseCommand
(
CMD_GetSendLength
,
out
isOk
);
byte
[]
reviceData
=
parseCommand
(
CMD_GetSendLength
,
out
isOk
);
int
data
=
getReviceData
(
reviceData
)
;
double
data
=
(
double
)
getReviceData
(
reviceData
)/
10
;
return
data
;
return
data
;
}
}
public
static
int
getReviceData
(
byte
[]
dataArray
)
public
static
int
getReviceData
(
byte
[]
dataArray
)
...
@@ -142,7 +143,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -142,7 +143,7 @@ namespace URSoldering.DeviceLibrary
{
{
LOGGER
.
Info
(
"转换出错:"
+
ex
.
ToString
());
LOGGER
.
Info
(
"转换出错:"
+
ex
.
ToString
());
}
}
///string rawMsg = Encoding.Default.GetString(dataArray, 0, dataArray.Length);
int
data
=
0
;
int
data
=
0
;
try
try
{
{
...
@@ -157,20 +158,21 @@ namespace URSoldering.DeviceLibrary
...
@@ -157,20 +158,21 @@ namespace URSoldering.DeviceLibrary
public
static
void
SendWire
(
double
time
,
int
speed
)
public
static
void
SendWire
(
double
time
,
int
speed
)
{
{
setSpeed
(
speed
);
setSpeed
(
speed
);
setLength
(
time
*
speed
);
double
length
=
(
time
*
speed
);
setLength
(
length
);
StartFSend
();
StartFSend
();
}
}
public
static
bool
setSpeed
(
double
speed
)
public
static
bool
setSpeed
(
double
speed
)
{
{
bool
isOk
=
false
;
bool
isOk
=
false
;
int
data
=
(
int
)
speed
*
10
;
int
data
=
(
int
)
(
speed
*
10
)
;
parseCommand
(
CMD_SetSpeed
+
data
.
ToString
().
PadLeft
(
5
,
'0'
),
out
isOk
);
parseCommand
(
CMD_SetSpeed
+
data
.
ToString
().
PadLeft
(
5
,
'0'
),
out
isOk
);
return
isOk
;
return
isOk
;
}
}
public
static
bool
setLength
(
double
length
)
public
static
bool
setLength
(
double
length
)
{
{
bool
isOk
=
false
;
bool
isOk
=
false
;
int
data
=
(
int
)
length
*
10
;
int
data
=
(
int
)
(
length
*
10
)
;
parseCommand
(
CMD_SetSendLength
+
data
.
ToString
().
PadLeft
(
5
,
'0'
),
out
isOk
);
parseCommand
(
CMD_SetSendLength
+
data
.
ToString
().
PadLeft
(
5
,
'0'
),
out
isOk
);
return
isOk
;
return
isOk
;
}
}
...
@@ -248,8 +250,8 @@ namespace URSoldering.DeviceLibrary
...
@@ -248,8 +250,8 @@ namespace URSoldering.DeviceLibrary
string
str
=
SerialBean
.
byteToHexStr
(
messageAll
);
string
str
=
SerialBean
.
byteToHexStr
(
messageAll
);
LogUtil
.
info
(
" 【"
+
commandText
+
"】 转换后【"
+
str
+
"】"
);
LogUtil
.
info
(
" 【"
+
commandText
+
"】 转换后【"
+
str
+
"】"
);
//data = new byte[messageAll.Length];
//data = new byte[messageAll.Length];
sb
.
SendCommand
(
messageAll
,
ref
data
,
2
,
out
isOk
);
sb
.
SendCommand
(
messageAll
,
ref
data
,
100
,
out
isOk
);
string
rawMsg
=
Encoding
.
ASCII
.
GetString
(
data
,
0
,
data
.
Length
);
//string rawMsg = Encoding.ASCII.GetString(data, 10
0, data.Length);
return
data
;
return
data
;
}
}
...
...
URSolderingClient/FrmSendWire.cs
查看文件 @
c00f709
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
System
;
using
System
;
using
System.Reflection
;
using
System.Reflection
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
URSoldering.Common
;
using
URSoldering.Common
;
using
URSoldering.DeviceLibrary
;
using
URSoldering.DeviceLibrary
;
...
@@ -67,8 +68,8 @@ namespace URSoldering.Client
...
@@ -67,8 +68,8 @@ namespace URSoldering.Client
private
void
btnSetSold_Click
(
object
sender
,
EventArgs
e
)
private
void
btnSetSold_Click
(
object
sender
,
EventArgs
e
)
{
{
int
speed
=
FormUtil
.
GetInt
Value
(
txtSpeed
);
double
speed
=
FormUtil
.
getDouble
Value
(
txtSpeed
);
int
length
=
FormUtil
.
GetInt
Value
(
txtLength
);
double
length
=
FormUtil
.
getDouble
Value
(
txtLength
);
SendWireManager
.
setLength
(
length
);
SendWireManager
.
setLength
(
length
);
SendWireManager
.
setSpeed
(
speed
);
SendWireManager
.
setSpeed
(
speed
);
}
}
...
@@ -125,12 +126,12 @@ namespace URSoldering.Client
...
@@ -125,12 +126,12 @@ namespace URSoldering.Client
private
void
btnReadError_Click_1
(
object
sender
,
EventArgs
e
)
private
void
btnReadError_Click_1
(
object
sender
,
EventArgs
e
)
{
{
int
speed
=
SendWireManager
.
querySpeed
();
double
speed
=
SendWireManager
.
querySpeed
();
int
length
=
SendWireManager
.
queryLength
();
txtSpeed
.
Text
=
speed
.
ToString
();
double
length
=
SendWireManager
.
queryLength
();
txtLength
.
Text
=
length
.
ToString
();
int
value
=
SendWireManager
.
ReadPortError
();
int
value
=
SendWireManager
.
ReadPortError
();
txtPortError
.
Text
=
value
.
ToString
();
txtPortError
.
Text
=
value
.
ToString
();
txtLength
.
Text
=
length
.
ToString
();
txtSpeed
.
Text
=
speed
.
ToString
();
}
}
private
void
btnReset_Click
(
object
sender
,
EventArgs
e
)
private
void
btnReset_Click
(
object
sender
,
EventArgs
e
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论