#include "include.h" #include "metertable.h" #include "meterseltable.h" #include "rtc_ext.h" SemaphoreHandle_t xSemaphore_ctl; extern void simul_plc_rx_addr(u8 *str1); extern void controlkeyaddr(u8 *str1,u8 val); static u8 state_flag = 0; static u8 ctl_type = 0; void ctl_task_1() { u16 num = metertable_getnum(); u16 i = 0; for(i=0;iyear,time->month,time->day,time->hour,time->min,time->sec); printf("阀门动作 总数=%d i=%d 完成\r\n",num,i+1); } } void ctl_task_2() { u16 num = meterseltable_getnum(); u16 i = 0; for(i=0;iyear,time->month,time->day,time->hour,time->min,time->sec); printf("阀门动作 总数=%d i=%d 完成\r\n",num,i+1); } meterseltable_init(); } void ctl_start(u8 flag) { ctl_type = 0; state_flag = flag; xSemaphoreGive(xSemaphore_ctl); } void ctl_sel_start(u8 flag) { ctl_type = 1; state_flag = flag; xSemaphoreGive(xSemaphore_ctl); } void ctl_task() { vSemaphoreCreateBinary(xSemaphore_ctl); xSemaphoreTake(xSemaphore_ctl, 0); for (;;) { xSemaphoreTake(xSemaphore_ctl, portMAX_DELAY); vTaskDelay(10000); //先等待gprs回应 printf("先等待gprs回应\r\n"); // if(0 == ctl_type) { ctl_task_1(); } else { ctl_task_2(); } xSemaphoreTake(xSemaphore_ctl, 0); } }