|
@@ -447,6 +447,7 @@ static void dtu_thread_entry_send(void *parameter)
|
|
|
device_status.num_updata = 0;
|
|
device_status.num_updata = 0;
|
|
|
static uint16_t current_arry[10];
|
|
static uint16_t current_arry[10];
|
|
|
static uint8_t record_current = 0;
|
|
static uint8_t record_current = 0;
|
|
|
|
|
+ static uint8_t lamp_sta_cnt = 0;
|
|
|
rt_thread_delay(10000);
|
|
rt_thread_delay(10000);
|
|
|
static rt_uint16_t wait_i = 0;
|
|
static rt_uint16_t wait_i = 0;
|
|
|
static rt_uint8_t check_i = 0;
|
|
static rt_uint8_t check_i = 0;
|
|
@@ -505,7 +506,7 @@ static void dtu_thread_entry_send(void *parameter)
|
|
|
ctr_RTU_DTU(ON);
|
|
ctr_RTU_DTU(ON);
|
|
|
power_i = 0;
|
|
power_i = 0;
|
|
|
}
|
|
}
|
|
|
- if(device_status.work_status==1&&device_status.num_updata%5==0&&atoi(device_status.power)>20) //每过5S把电流值存入数组,连续10条数据的电流值大于400mA判断为正常
|
|
|
|
|
|
|
+ if(device_status.work_status==1&&device_status.num_updata%10==0&&atoi(device_status.power)>20) //每过10S把电流值存入数组,连续10条数据的电流值大于400mA判断为正常
|
|
|
{
|
|
{
|
|
|
current_arry[record_current] = atoi(device_status.power);
|
|
current_arry[record_current] = atoi(device_status.power);
|
|
|
record_current++;
|
|
record_current++;
|
|
@@ -515,11 +516,13 @@ static void dtu_thread_entry_send(void *parameter)
|
|
|
if(hasElementGreaterThan400(current_arry, 10)==0) //连续10条电流值大于400,灯管状态正常
|
|
if(hasElementGreaterThan400(current_arry, 10)==0) //连续10条电流值大于400,灯管状态正常
|
|
|
{
|
|
{
|
|
|
device_status.lamp_status = 0;
|
|
device_status.lamp_status = 0;
|
|
|
|
|
+ lamp_sta_cnt = 0;
|
|
|
}
|
|
}
|
|
|
if(hasElementGreater_lessThan400(current_arry,10)==0) //连续10条电流值小于400,灯管状态异常
|
|
if(hasElementGreater_lessThan400(current_arry,10)==0) //连续10条电流值小于400,灯管状态异常
|
|
|
{
|
|
{
|
|
|
- device_status.lamp_status = 1;
|
|
|
|
|
|
|
+ lamp_sta_cnt++;
|
|
|
}
|
|
}
|
|
|
|
|
+ if(lamp_sta_cnt>=3) device_status.lamp_status = 1;
|
|
|
memset(current_arry,0,sizeof(current_arry));
|
|
memset(current_arry,0,sizeof(current_arry));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|