Commit 8e26f37f authored by 潘栩锋's avatar 潘栩锋 🚴

添加 ad2021.B2 1分钟位变化

parent 03821181
......@@ -22,7 +22,7 @@ namespace FlyADBase
public partial class FlyAd2021B2 : IFlyADClient
{
public Logger logger = NLog.LogManager.GetCurrentClassLogger();
public Logger logger_adcnt = NLog.LogManager.GetLogger("adcnt");
#region MARKNO
const int MARKNO_SET_SAVE = 4;
const int MARKNO_PARAM_APPLY = 5;
......@@ -648,6 +648,40 @@ namespace FlyADBase
}
}
}
void CountAD(int ad, int ad2)
{
for (int i = 0; i < 16; i++)
{
if (Misc.MyBase.CHECKBIT((UInt16)ad, i))
{
ad_bitCntAt1min[i]++;
}
}
for (int i = 0; i < 16; i++)
{
if (Misc.MyBase.CHECKBIT((UInt16)ad2, i))
{
ad2_bitCntAt1min[i]++;
}
}
totalCntAt1min++;
if (totalCntAt1min >= 60000)
{
AD_bitCntAt1min = ad_bitCntAt1min;
AD2_bitCntAt1min = ad2_bitCntAt1min;
//数了1min,导出数据
logger_adcnt.Debug($"TOTAL = {totalCntAt1min} ADCNT = {Newtonsoft.Json.JsonConvert.SerializeObject(ad_bitCntAt1min)}");
logger_adcnt.Debug($"TOTAL = {totalCntAt1min} AD2CNT = {Newtonsoft.Json.JsonConvert.SerializeObject(ad2_bitCntAt1min)}");
totalCntAt1min = 0;
ad_bitCntAt1min = new int[16];
ad2_bitCntAt1min = new int[16];
}
}
int totalCntAt1min = 0;
int[] ad_bitCntAt1min = new int[16];
int[] ad2_bitCntAt1min = new int[16];
public int[] AD_bitCntAt1min { get; private set; }
public int[] AD2_bitCntAt1min { get; private set; }
Stopwatch sw_reset = new Stopwatch();
......@@ -657,7 +691,8 @@ namespace FlyADBase
Now = sysTickContext.ToDateTime(e.SysTick);
AD = e.AD;
AD2 = e.AD2;
//TODO 统计1分钟内,每个位出现1的次数
CountAD(AD, AD2);
if (e.ENC1 != null)
......
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