Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1069_MIMO_PlUS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0bc3a2d7
由
LN
编写于
2024-12-23 10:53:57 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加异常处理
1 个父辈
d91c34b0
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
44 行增加
和
12 行删除
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/DeviceLibrary/weightSensor/OKLE_WeightSensor.cs
DeviceLibrary/theMachine/MainMachine.cs
TheMachine/Form1.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
0bc3a2d
...
@@ -115,7 +115,13 @@ namespace DeviceLibrary
...
@@ -115,7 +115,13 @@ namespace DeviceLibrary
{
{
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
{
return
;
return
;
}
if
(
RobotManage
.
mainMachine
.
runStatus
!=
RunStatus
.
Running
)
{
return
;
}
lock
(
serverclock
)
lock
(
serverclock
)
{
{
var
code
=
ProcessCode
(
codelist
,
reel
.
PlateW
,
reel
.
PlateH
);
var
code
=
ProcessCode
(
codelist
,
reel
.
PlateW
,
reel
.
PlateH
);
...
@@ -133,7 +139,7 @@ namespace DeviceLibrary
...
@@ -133,7 +139,7 @@ namespace DeviceLibrary
operation
.
data
.
Add
(
"singleIn"
,
"false"
);
operation
.
data
.
Add
(
"singleIn"
,
"false"
);
}
}
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
,
printlog
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
,
printlog
);
if
(
operation
.
seq
!=
resultOperation
?.
seq
)
if
(
resultOperation
!=
null
&&
resultOperation
.
seq
>
0
&&
operation
.
seq
!=
resultOperation
?.
seq
)
{
{
Thread
.
Sleep
(
1000
);
Thread
.
Sleep
(
1000
);
SendInStoreRequest
(
codelist
,
reel
,
printlog
);
SendInStoreRequest
(
codelist
,
reel
,
printlog
);
...
...
DeviceLibrary/DeviceLibrary/weightSensor/OKLE_WeightSensor.cs
查看文件 @
0bc3a2d
...
@@ -220,14 +220,16 @@ namespace DeviceLibrary
...
@@ -220,14 +220,16 @@ namespace DeviceLibrary
}
}
byte
[]
SendAndReceive
(
byte
[]
buff
,
string
cmdname
=
""
)
byte
[]
SendAndReceive
(
byte
[]
buff
,
string
cmdname
=
""
)
{
{
try
{
lock
(
port
)
lock
(
port
)
{
{
byte
[]
restr
=
new
byte
[
0
];
byte
[]
restr
=
new
byte
[
0
];
if
(
port
==
null
||
!
port
.
IsOpen
)
if
(
port
==
null
||
!
port
.
IsOpen
)
{
{
if
(!
Open
(
PortName
,
out
string
msg
))
if
(!
Open
(
PortName
,
out
string
msg
))
{
{
log
(
PortName
+
"未初始化,或已断开连接"
);
log
(
PortName
+
"未初始化,或已断开连接"
);
return
restr
;
return
restr
;
}
}
}
}
...
@@ -267,6 +269,13 @@ namespace DeviceLibrary
...
@@ -267,6 +269,13 @@ namespace DeviceLibrary
else
else
return
new
byte
[
0
];
return
new
byte
[
0
];
}
}
}
catch
(
Exception
ex
)
{
error
(
"SendAndReceive , "
+
cmdname
+
", error :"
+
ex
.
ToString
());
}
return
new
byte
[
0
];
}
}
/// <summary>
/// <summary>
/// 初始化设置
/// 初始化设置
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
0bc3a2d
...
@@ -276,6 +276,8 @@ namespace DeviceLibrary
...
@@ -276,6 +276,8 @@ namespace DeviceLibrary
public
void
Run
()
public
void
Run
()
{
{
mstart
=
true
;
mstart
=
true
;
try
{
while
(
mstart
)
while
(
mstart
)
{
{
try
try
...
@@ -353,6 +355,11 @@ namespace DeviceLibrary
...
@@ -353,6 +355,11 @@ namespace DeviceLibrary
ServerCM
.
storeStatus
=
currnetstoreStatus
;
ServerCM
.
storeStatus
=
currnetstoreStatus
;
}
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"Run error :"
+
ex
.
ToString
());
}
RobotManage
.
isRunning
=
false
;
RobotManage
.
isRunning
=
false
;
RobotManage
.
UserPause
(
$
"isRunning = false"
,
false
);
RobotManage
.
UserPause
(
$
"isRunning = false"
,
false
);
LogUtil
.
info
(
"主线程已退出."
);
LogUtil
.
info
(
"主线程已退出."
);
...
@@ -364,6 +371,8 @@ namespace DeviceLibrary
...
@@ -364,6 +371,8 @@ namespace DeviceLibrary
}
}
public
void
Stop
()
public
void
Stop
()
{
{
try
{
LogUtil
.
info
(
"开始停止系统2."
);
LogUtil
.
info
(
"开始停止系统2."
);
mstart
=
false
;
mstart
=
false
;
AutoInOutTest
=
false
;
AutoInOutTest
=
false
;
...
@@ -377,7 +386,15 @@ namespace DeviceLibrary
...
@@ -377,7 +386,15 @@ namespace DeviceLibrary
LedProcess
(
null
);
LedProcess
(
null
);
CloseRgbLed
();
CloseRgbLed
();
SoundsController
.
StopPlay
();
SoundsController
.
StopPlay
();
runStatus
=
RunStatus
.
Stop
;
mstart
=
false
;
LogUtil
.
info
(
"开始停止系统3."
);
LogUtil
.
info
(
"开始停止系统3."
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"停止系统 Stop error :"
+
ex
.
ToString
());
}
}
}
public
void
BeginHomeReset
(
bool
firstRun
=
false
)
public
void
BeginHomeReset
(
bool
firstRun
=
false
)
{
{
...
...
TheMachine/Form1.cs
查看文件 @
0bc3a2d
...
@@ -605,15 +605,6 @@ namespace TheMachine
...
@@ -605,15 +605,6 @@ namespace TheMachine
if
(
RobotManage
.
isRunning
)
if
(
RobotManage
.
isRunning
)
{
{
btn_stop
.
Enabled
=
true
;
btn_stop
.
Enabled
=
true
;
}
else
{
btn_stop
.
Enabled
=
false
;
btn_run
.
Text
=
crc
.
GetString
(
L
.
start
,
"启动"
);
btn_run
.
BackColor
=
Color
.
Transparent
;
cb_IgnoreSafecheck
.
Enabled
=
true
;
return
;
}
if
(
e
)
if
(
e
)
{
{
(
btn_run
as
Button
).
Text
=
crc
.
GetString
(
L
.
device_resume
,
"恢复运行"
);
(
btn_run
as
Button
).
Text
=
crc
.
GetString
(
L
.
device_resume
,
"恢复运行"
);
...
@@ -626,6 +617,15 @@ namespace TheMachine
...
@@ -626,6 +617,15 @@ namespace TheMachine
(
btn_run
as
Button
).
BackColor
=
Color
.
Yellow
;
(
btn_run
as
Button
).
BackColor
=
Color
.
Yellow
;
cb_IgnoreSafecheck
.
Enabled
=
false
;
cb_IgnoreSafecheck
.
Enabled
=
false
;
}
}
}
else
{
btn_stop
.
Enabled
=
false
;
btn_run
.
Text
=
crc
.
GetString
(
L
.
start
,
"启动"
);
btn_run
.
BackColor
=
Color
.
Transparent
;
cb_IgnoreSafecheck
.
Enabled
=
true
;
return
;
}
}
}
private
void
btn_stop_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_stop_Click
(
object
sender
,
EventArgs
e
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论