添加 MX-PD-盘古 项目文件
将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using MwFramework.Device;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MainShell.Common.Extension
|
||||
{
|
||||
public static class DeviceExtension
|
||||
{
|
||||
private static readonly int _taskNum = 3;
|
||||
public static void GetLastSamples(this IDiastimeter diastimeter, out double distance)
|
||||
{
|
||||
var doubles = new List<double>();
|
||||
for (int i = 0; i < _taskNum; i++)
|
||||
{
|
||||
diastimeter.GetLastSample(out double val);
|
||||
if (val != double.NaN)
|
||||
doubles.Add(val);
|
||||
}
|
||||
distance = doubles.Average();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user