|
|
@@ -36,8 +36,9 @@
|
|
|
Device_Status_typedef device_status;
|
|
|
|
|
|
rt_thread_t tid_workloop = RT_NULL;
|
|
|
-rt_thread_t tid_wkstc = RT_NULL;
|
|
|
-rt_thread_t tid_ctr = RT_NULL;
|
|
|
+
|
|
|
+rt_timer_t timer_shibie = RT_NULL;
|
|
|
+
|
|
|
rt_thread_t tid_heat = RT_NULL;
|
|
|
rt_thread_t tid_485_play = RT_NULL;
|
|
|
|
|
|
@@ -1150,7 +1151,7 @@ void ResetInit(void)
|
|
|
ctr_Heat(OFF); //风机关闭
|
|
|
ctr_Motor_Driver_Power(ON); //步进电机驱动电源开启
|
|
|
ctr_Motor86_move(0, 500000, 0); //86电机复位
|
|
|
- device_status.ctr_up_motor = 1; //推杆电机缩进去(落虫)
|
|
|
+ device_status.ctr_up_motor = 2; //推杆电机缩进去(落虫)
|
|
|
ctr_Collect_Fan(OFF);
|
|
|
PWM2_CH3_PB10_Fan_LCTD(OFF);
|
|
|
ctr_Motor_Driver_Power(OFF);
|
|
|
@@ -1166,106 +1167,6 @@ void ResetInit(void)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-/*三色光源*/
|
|
|
-void Led_Check(uint8_t tp)
|
|
|
-{
|
|
|
- if(tp==3)
|
|
|
- {
|
|
|
- if(device_status.light_over_tim>2*3600)
|
|
|
- {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 1;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- LOG_I("光控定时,计时中:光源1计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- else if (device_status.light_over_tim>3600&&device_status.light_over_tim<7200) {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp1_status = 1;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- LOG_I("光控定时,计时中:光源2计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- else if (device_status.light_over_tim<1*3600) {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 1;
|
|
|
- LOG_I("光控定时,计时中:光源3计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (tp==6) {
|
|
|
- if(device_status.light_over_tim>4*3600)
|
|
|
- {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 1;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- LOG_I("光控定时,计时中:光源1计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- else if (device_status.light_over_tim<14400&&device_status.light_over_tim>7200) {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp1_status = 1;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- LOG_I("光控定时,计时中:光源2计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- else if (device_status.light_over_tim<7200) {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 1;
|
|
|
- LOG_I("光控定时,计时中:光源3计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (tp==9) {
|
|
|
- if(device_status.light_over_tim>6*3600)
|
|
|
- {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 1;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- LOG_I("光控定时,计时中:光源1计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- else if (device_status.light_over_tim<6*3600&&device_status.light_over_tim>3*3600) {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp1_status = 1;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- LOG_I("光控定时,计时中:光源2计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- else if (device_status.light_over_tim<3*3600) {
|
|
|
- device_status.work_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 1;
|
|
|
- LOG_I("光控定时,计时中:光源3计数:%d",device_status.light_over_tim);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-//出厂前自检 0-开机自检 1-屏幕或指令下发手动自检
|
|
|
-void HardWare_Check(uint8_t boot)
|
|
|
-{
|
|
|
- if(boot==0&&device_status.version_type!=6)
|
|
|
- {
|
|
|
- //停止所有动作 -完成
|
|
|
- HardWare_Init(boot);
|
|
|
- }
|
|
|
- else {
|
|
|
- //停止所有动作
|
|
|
- //读取记录待机功耗(实测大概70mA)
|
|
|
- //(需减去屏幕的功耗大概120mA)
|
|
|
- //动作上仓门,读取功率值保存
|
|
|
- //动作下仓门,读取功率值保存
|
|
|
- //动作清扫,读取功率值保存
|
|
|
- //打开镇流器,读取功率值保存
|
|
|
- //打开海康相机供电,读取功率值保存
|
|
|
- //打开补光灯,读取功率值保存
|
|
|
- //打开路由器/RTU供电,读取功率值保存
|
|
|
- //打开加热,读取功率值保存
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
void WorkCheck(void)
|
|
|
{
|
|
|
@@ -1364,6 +1265,7 @@ void WorkCheck(void)
|
|
|
void guanshan_on(void *args)
|
|
|
{
|
|
|
LOG_W("guanshan_on!");
|
|
|
+ rt_timer_start(timer_shibie);
|
|
|
rt_event_send(event_485_play, 0x01);
|
|
|
}
|
|
|
|
|
|
@@ -1555,7 +1457,6 @@ void WorkTask_CB5(void)
|
|
|
pin_guangshan_unbind();
|
|
|
//pin_motor_86_unbind();
|
|
|
//打开推杆电机,益虫放生
|
|
|
- device_status.ctr_down_motor = 1;
|
|
|
DTU_Write("{\"cmd\":\"workdone\"}");
|
|
|
ResetInit();
|
|
|
}
|
|
|
@@ -1603,10 +1504,8 @@ static void Work_Loop_thread_entry(void *parameter)
|
|
|
ResetInit();
|
|
|
while(1)
|
|
|
{
|
|
|
- if(device_status.version_type==5)
|
|
|
- {
|
|
|
- WorkTask_CB5();
|
|
|
- }
|
|
|
+
|
|
|
+ WorkTask_CB5();
|
|
|
rt_thread_delay(1000);
|
|
|
}
|
|
|
}
|
|
|
@@ -1645,6 +1544,7 @@ static void Control_Check_thread_entry(void *parameter)
|
|
|
if(device_status.update_flag==1) break;
|
|
|
if(device_status.version_type==5) break;
|
|
|
{
|
|
|
+
|
|
|
if(device_status.selfcheck_ws==2)
|
|
|
{
|
|
|
while(current_second <= total_seconds)
|
|
|
@@ -1756,7 +1656,7 @@ static void Control_Check_thread_entry(void *parameter)
|
|
|
//延时10S
|
|
|
rt_thread_delay(10000);
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
rt_thread_delay(1000);
|
|
|
@@ -1793,7 +1693,7 @@ static void thread_485_play_entry(void *param)
|
|
|
int Control_clear(void)
|
|
|
{
|
|
|
/* 创建线程*/
|
|
|
- tid_ctr = rt_thread_create("Control_Clear_thread_entry",
|
|
|
+ rt_thread_t tid_ctr = rt_thread_create("Control_Clear_thread_entry",
|
|
|
Control_Clear_thread_entry, RT_NULL,
|
|
|
2048, //2048
|
|
|
24, //23
|
|
|
@@ -1842,7 +1742,7 @@ int Workstatus_check(void)
|
|
|
{
|
|
|
|
|
|
/* 创建线程*/
|
|
|
- tid_wkstc = rt_thread_create("work_status_check_thread",
|
|
|
+ rt_thread_t tid_wkstc = rt_thread_create("work_status_check_thread",
|
|
|
Work_status_thread_entry, RT_NULL,
|
|
|
WORK_CHECK_THREAD_STACK_SIZE, //1024
|
|
|
WORK_CHECK_THREAD_PRIORITY, //23
|
|
|
@@ -1871,10 +1771,36 @@ int Work_Loop_Task(void)
|
|
|
return result_loop;
|
|
|
}
|
|
|
|
|
|
+void timer_shibie_stop()
|
|
|
+{
|
|
|
+ rt_timer_stop(timer_shibie);
|
|
|
+ LOG_W("timer_shibie_stop!");
|
|
|
+}
|
|
|
+
|
|
|
+static void t_shibie_callback(void *parameter)
|
|
|
+{
|
|
|
+ LOG_E("识别超时!");
|
|
|
+ device_status.autotakepic = 10;
|
|
|
+}
|
|
|
+
|
|
|
+int rt_software_timer_init(void)
|
|
|
+{
|
|
|
+ //启动拍照超时定时器
|
|
|
+ timer_shibie = rt_timer_create("t_shibie",t_shibie_callback,RT_NULL, 50000, RT_TIMER_FLAG_ONE_SHOT|RT_TIMER_FLAG_HARD_TIMER);
|
|
|
+ if(timer_takephoto==RT_NULL)
|
|
|
+ {
|
|
|
+ LOG_E("rt_timer_create t_shibie failed!");
|
|
|
+ return RT_ERROR;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return RT_EOK;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+INIT_APP_EXPORT(rt_software_timer_init);
|
|
|
|
|
|
|
|
|
-MSH_CMD_EXPORT(HardWare_Check,HardWare_Check<ON|OFF>);
|
|
|
MSH_CMD_EXPORT(ctr_lamp,ctr_lamp<ON|OFF>);
|
|
|
MSH_CMD_EXPORT(ctr_Heat,ctr_Heat<ON|OFF>);
|
|
|
MSH_CMD_EXPORT(ctr_clear,ctr_clear<ON|OFF>);
|