Commit 18cb84e5 authored by 潘栩锋's avatar 潘栩锋 🚴

flyad2021 格式整理

parent 8ed333d0
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment