Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
PastureGateway
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
steven.sha
PastureGateway
Commits
468680e9
Commit
468680e9
authored
Jun 20, 2019
by
leon.huang
Browse files
Options
Browse Files
Download
Plain Diff
merge origin
parents
a510cf6a
c7bb3e30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
AutoControl.cs
ModbusDemo/application/AutoControl.cs
+4
-2
Form1.cs
ModbusDemo/windows/Form1.cs
+27
-2
No files found.
ModbusDemo/application/AutoControl.cs
View file @
468680e9
...
...
@@ -152,7 +152,7 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelControlError
|
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelRunOverTimeError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
if
(
Runtimeout
>
Runtimeout
*
2
)
if
(
timespan
.
TotalMinutes
>
Runtimeout
*
2
)
{
ETime
.
Reset
();
ETime
.
Stop
();
// 停止监视
...
...
@@ -245,7 +245,7 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelControlError
|
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelRunOverTimeError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
if
(
Runtimeout
>
Runtimeout
*
2
)
if
(
Wtime
.
TotalMinutes
>
Runtimeout
*
2
)
{
WTime
.
Reset
();
WTime
.
Stop
();
//停止监视
...
...
@@ -334,6 +334,8 @@ namespace ModbusDemo.application
usEcontrol
.
modbusID
=
LevelmodbusID
[
1
];
}
}
if
(
ModualControl
.
cPoolLevelConfig
[
i
].
byModbusID
==
LevelmodbusID
[
0
])
{
usWcontrol
.
maxLevel
=
ModualControl
.
cPoolLevelConfig
[
i
].
dUpLevel
;
...
...
ModbusDemo/windows/Form1.cs
View file @
468680e9
...
...
@@ -80,7 +80,7 @@ namespace ModbusDemo
string
mqttUsername
;
string
mqttPwd
;
public
const
string
mqttSn
=
"
256333344
"
;
public
const
string
mqttSn
=
"
66666666
"
;
public
const
string
mqttSubscribeControlTopic
=
"Witium/WTDS78X/"
+
mqttSn
+
"/Ctrl"
;
public
const
string
mqttBackTopic
=
"Witium/WTDS78X/"
+
mqttSn
+
"/Back"
;
public
const
string
mqttCfgTopic
=
"Witium/WTDS78X/"
+
mqttSn
+
"/Config"
;
...
...
@@ -396,7 +396,7 @@ namespace ModbusDemo
private
void
Sendout
()
{
Control
.
CheckForIllegalCrossThreadCalls
=
false
;
MQTTTimer
.
Interval
=
20000
;
//120500
MQTTTimer
.
Interval
=
20000
l
;
//120500
MQTTTimer
.
Enabled
=
true
;
MQTTTimer
.
AutoReset
=
true
;
//设置是执行一次(false)还是一直执行(true);
MQTTTimer
.
Start
();
...
...
@@ -1061,6 +1061,17 @@ namespace ModbusDemo
ModbusComm
.
Modbus
.
Transport
.
ReadTimeout
=
1000
;
ModbusComm
.
Modbus
.
Transport
.
WriteTimeout
=
1000
;
ModbusComm
.
Modbus
.
Transport
.
WaitToRetryMilliseconds
=
0
;
<<<<<<<
HEAD
//t_AutoControl = new Thread(T_AutoControl);
//t_AutoControl.IsBackground = true;
//t_AutoControl.Start();
=======
//t_AutoControl = new Thread(T_AutoControl)
//{
// IsBackground = true
//};
//t_AutoControl.Start();
modbus_Timer
.
Enabled
=
true
;
btOpenCOM
.
Enabled
=
false
;
...
...
@@ -1119,6 +1130,12 @@ namespace ModbusDemo
ModbusComm
.
Modbus
.
Transport
.
WriteTimeout
=
1000
;
ModbusComm
.
Modbus
.
Transport
.
WaitToRetryMilliseconds
=
0
;
//t_AutoControl = new Thread(T_AutoControl)
//{
// IsBackground = true
//};
//t_AutoControl.Start();
modbus_Timer
.
Enabled
=
true
;
btOpenCOM
.
Enabled
=
false
;
btCloseCOM
.
Enabled
=
true
;
...
...
@@ -1167,6 +1184,14 @@ namespace ModbusDemo
comPort
.
Close
();
totxt
.
Log
(
DateTime
.
Now
.
ToString
()
+
" =>Disconnect "
+
comPort
.
PortName
);
}
private
void
AtuoControl_run
()
{
while
(
true
)
{
AutoControl
.
T_AutoControl
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment