Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
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
潘栩锋
Thick-Common
Commits
18cb84e5
Commit
18cb84e5
authored
Nov 11, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flyad2021 格式整理
parent
8ed333d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
23 deletions
+31
-23
FlyAd2021.cs
Project.FLY.FlyADBase/FlyAd2021/FlyAd2021.cs
+31
-23
No files found.
Project.FLY.FlyADBase/FlyAd2021/FlyAd2021.cs
View file @
18cb84e5
...
...
@@ -349,10 +349,32 @@ namespace FlyADBase
comm
?.
SendMsg
(
msg
);
};
core
.
PushDataEvent
+=
Core_PushDataEvent
;
core
.
PushRunResultEvent
+=
Core_PushRunResultEvent
;
core
.
PushDataEvent
+=
(
sender
,
e
)
=>
{
//这个线程非主线程, 数据接收完,应该快速返回。
//事件触发,都放在主线程操作。
//要有线程锁!!!!!
lock
(
pushEventArgs
)
{
pushEventArgs
.
Add
(
e
);
}
};
core
.
PushRunResultEvent
+=
(
sender
,
e
)
=>
{
//这个线程非主线程, 数据接收完,应该快速返回。
//事件触发,都放在主线程操作。
lock
(
pushEventArgs
)
{
pushEventArgs
.
Add
(
e
);
}
};
//避免推送太快,全部推送事件统一周期处理
PollModule
.
Current
.
Poll_Config
(
onPoll_PushEvent
,
TimeSpan
.
FromSeconds
(
0.1
));
core
.
StartMeasure
();
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
core
.
OnPoll_TimeOut
,
TimeSpan
.
FromSeconds
(
0.5
));
PollModule
.
Current
.
Poll_Config
(
core
.
OnPoll_TimeOut
,
TimeSpan
.
FromSeconds
(
0.5
));
core
.
PropertyChanged
+=
Core_PropertyChanged
;
...
...
@@ -368,7 +390,7 @@ namespace FlyADBase
//每隔一个小时,改变剩下时间
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
()
=>
PollModule
.
Current
.
Poll_Config
(()
=>
{
if
(!
IsConnected
)
return
;
...
...
@@ -383,8 +405,8 @@ namespace FlyADBase
},
TimeSpan
.
FromMinutes
(
60
));
//每隔1
秒
发送一次 脉冲,输入输出,状态
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
()
=>
//每隔1
分钟
发送一次 脉冲,输入输出,状态
PollModule
.
Current
.
Poll_Config
(()
=>
{
if
(!
IsConnected
)
return
;
...
...
@@ -393,8 +415,7 @@ namespace FlyADBase
},
TimeSpan
.
FromSeconds
(
60
));
//更新线速度
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
()
=>
PollModule
.
Current
.
Poll_Config
(()
=>
{
if
(
calSpeed
.
Cal
(
Now
,
out
int
speed1
,
out
int
speed2
))
{
...
...
@@ -405,8 +426,7 @@ namespace FlyADBase
},
TimeSpan
.
FromSeconds
(
1
));
//当状态为Running时,且每秒脉冲没变,需要 查 当前的状态, 也许Stop状态少推送了
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
()
=>
PollModule
.
Current
.
Poll_Config
(()
=>
{
if
(!
IsConnected
)
return
;
...
...
@@ -426,10 +446,6 @@ namespace FlyADBase
}
},
TimeSpan
.
FromSeconds
(
1
));
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
onPoll_PushEvent
,
TimeSpan
.
FromSeconds
(
0.1
));
}
void
GetRunResult
()
...
...
@@ -515,15 +531,7 @@ namespace FlyADBase
}
}
private
void
Core_PushRunResultEvent
(
object
sender
,
PushRunResultEventArgs
_e
)
{
//这个线程非主线程, 数据接收完,应该快速返回。
//事件触发,都放在主线程操作。
lock
(
pushEventArgs
)
{
pushEventArgs
.
Add
(
_e
);
}
}
void
_core_PushRunResultEvent
(
PushRunResultEventArgs
e
)
{
Now
=
sysTickContext
.
ToDateTime
(
e
.
SysTick
);
...
...
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