|
@@ -34,6 +34,7 @@ Device_Status_typedef device_status;
|
|
|
rt_thread_t tid_workloop = RT_NULL;
|
|
rt_thread_t tid_workloop = RT_NULL;
|
|
|
rt_thread_t tid_wkstc = RT_NULL;
|
|
rt_thread_t tid_wkstc = RT_NULL;
|
|
|
rt_thread_t tid_ctr = RT_NULL;
|
|
rt_thread_t tid_ctr = RT_NULL;
|
|
|
|
|
+rt_thread_t tid_heat = RT_NULL;
|
|
|
/**************************1.0定制2000W*************************************/
|
|
/**************************1.0定制2000W*************************************/
|
|
|
uint8_t ctr_Fan_PUT(uint8_t status_ws)
|
|
uint8_t ctr_Fan_PUT(uint8_t status_ws)
|
|
|
{
|
|
{
|
|
@@ -807,13 +808,13 @@ void Hk_Take_io(void)
|
|
|
|
|
|
|
|
void calorstat(uint16_t heat_time)
|
|
void calorstat(uint16_t heat_time)
|
|
|
{
|
|
{
|
|
|
- uint8_t heat_up_cnt = 0;
|
|
|
|
|
|
|
+ //uint8_t heat_up_cnt = 0;
|
|
|
uint16_t n = 0;
|
|
uint16_t n = 0;
|
|
|
uint16_t delay_heat = 60;
|
|
uint16_t delay_heat = 60;
|
|
|
FlagStatus heat_flg = RESET;
|
|
FlagStatus heat_flg = RESET;
|
|
|
device_status.heat_time_min = 0;
|
|
device_status.heat_time_min = 0;
|
|
|
ctr_Heat(ON);
|
|
ctr_Heat(ON);
|
|
|
- UpLoad_Data(); //开始加热时的第一条数据
|
|
|
|
|
|
|
+// UpLoad_Data(); //开始加热时的第一条数据
|
|
|
//恒温模式
|
|
//恒温模式
|
|
|
for(n=0;n < heat_time;n++)
|
|
for(n=0;n < heat_time;n++)
|
|
|
{
|
|
{
|
|
@@ -833,25 +834,25 @@ void calorstat(uint16_t heat_time)
|
|
|
}
|
|
}
|
|
|
if(device_status.heattem < (device_status.heatvalue - 5)&&heat_flg == SET)
|
|
if(device_status.heattem < (device_status.heatvalue - 5)&&heat_flg == SET)
|
|
|
{
|
|
{
|
|
|
- heat_up_cnt = 0;
|
|
|
|
|
|
|
+ //heat_up_cnt = 0;
|
|
|
ctr_Heat(ON);
|
|
ctr_Heat(ON);
|
|
|
}
|
|
}
|
|
|
else if (device_status.heattem>device_status.heatvalue&&heat_flg==SET)
|
|
else if (device_status.heattem>device_status.heatvalue&&heat_flg==SET)
|
|
|
{
|
|
{
|
|
|
- if(heat_up_cnt==0)
|
|
|
|
|
- {
|
|
|
|
|
- UpLoad_Data(); //加热到设定温度的数据
|
|
|
|
|
- heat_up_cnt = 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if(heat_up_cnt==0)
|
|
|
|
|
+// {
|
|
|
|
|
+// UpLoad_Data(); //加热到设定温度的数据
|
|
|
|
|
+// heat_up_cnt = 1;
|
|
|
|
|
+// }
|
|
|
ctr_Heat(OFF);
|
|
ctr_Heat(OFF);
|
|
|
}
|
|
}
|
|
|
if((n % 60)==0)
|
|
if((n % 60)==0)
|
|
|
{
|
|
{
|
|
|
device_status.heat_time_min = device_status.heat_time_min + 1;
|
|
device_status.heat_time_min = device_status.heat_time_min + 1;
|
|
|
- if(device_status.heat_time_min % 2 == 0)
|
|
|
|
|
- {
|
|
|
|
|
- UpLoad_Data(); //从加热开始每两分钟上传的数据
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if(device_status.heat_time_min % 2 == 0)
|
|
|
|
|
+// {
|
|
|
|
|
+// UpLoad_Data(); //从加热开始每两分钟上传的数据
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
//如果触发异常退出加热
|
|
//如果触发异常退出加热
|
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
@@ -1264,6 +1265,7 @@ void WorkTask(void)
|
|
|
{
|
|
{
|
|
|
ctr_router(ON); //打开路由器供电
|
|
ctr_router(ON); //打开路由器供电
|
|
|
static int clt_time = 0; //收集时间差秒数
|
|
static int clt_time = 0; //收集时间差秒数
|
|
|
|
|
+ static int heat_time = 0;
|
|
|
static uint16_t controltime = 6;
|
|
static uint16_t controltime = 6;
|
|
|
rt_kprintf("工作状态:%d\n",device_status.work_status);
|
|
rt_kprintf("工作状态:%d\n",device_status.work_status);
|
|
|
rt_kprintf("开关机状态:%d\n",device_status.ds);
|
|
rt_kprintf("开关机状态:%d\n",device_status.ds);
|
|
@@ -1387,8 +1389,13 @@ void WorkTask(void)
|
|
|
// rt_kprintf("等待上仓门关闭!!!\n");
|
|
// rt_kprintf("等待上仓门关闭!!!\n");
|
|
|
// }
|
|
// }
|
|
|
//5.加热
|
|
//5.加热
|
|
|
- rt_kprintf("加热!!!\n");
|
|
|
|
|
- calorstat(device_status.heattime*60);
|
|
|
|
|
|
|
+ heat_time = device_status.heattime * 60;
|
|
|
|
|
+ while(heat_time!=0)
|
|
|
|
|
+ {
|
|
|
|
|
+ heat_time--;
|
|
|
|
|
+ rt_kprintf("正在加热状态!!!\n");
|
|
|
|
|
+ rt_thread_delay(1000);
|
|
|
|
|
+ }
|
|
|
//6.打开下仓门
|
|
//6.打开下仓门
|
|
|
if(device_status.rain_status==0)
|
|
if(device_status.rain_status==0)
|
|
|
{
|
|
{
|
|
@@ -1530,14 +1537,44 @@ static void Control_Clear_thread_entry(void *parameter)
|
|
|
rt_thread_delay(100);
|
|
rt_thread_delay(100);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+/*入口函数加热*/
|
|
|
|
|
+static void Control_Heat_thread_entry(void *parameter)
|
|
|
|
|
+{
|
|
|
|
|
+ while(1)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(device_status.work_status==1)
|
|
|
|
|
+ {
|
|
|
|
|
+ calorstat(device_status.heattime*60);
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ rt_kprintf("not calorstat!\n");
|
|
|
|
|
+ }
|
|
|
|
|
+ rt_thread_delay(1000);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
/**/
|
|
/**/
|
|
|
int Control_clear(void)
|
|
int Control_clear(void)
|
|
|
{
|
|
{
|
|
|
/* 创建线程*/
|
|
/* 创建线程*/
|
|
|
- tid_ctr = rt_thread_create("Control_Clear_thread_entry",
|
|
|
|
|
|
|
+ tid_heat = rt_thread_create("Control_Clear_thread_entry",
|
|
|
|
|
+ Control_Heat_thread_entry, RT_NULL,
|
|
|
|
|
+ 512, //2048
|
|
|
|
|
+ 24, //23
|
|
|
|
|
+ WORK_CHECK_THREAD_TIMESLICE); //5
|
|
|
|
|
+ if(tid_heat!=RT_NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ rt_thread_startup(tid_heat);
|
|
|
|
|
+ }
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+/**/
|
|
|
|
|
+int Control_heat(void)
|
|
|
|
|
+{
|
|
|
|
|
+ /* 创建线程*/
|
|
|
|
|
+ tid_heat = rt_thread_create("Control_Heat_thread_entry",
|
|
|
Control_Clear_thread_entry, RT_NULL,
|
|
Control_Clear_thread_entry, RT_NULL,
|
|
|
512, //2048
|
|
512, //2048
|
|
|
- 13, //23
|
|
|
|
|
|
|
+ 25, //23
|
|
|
WORK_CHECK_THREAD_TIMESLICE); //5
|
|
WORK_CHECK_THREAD_TIMESLICE); //5
|
|
|
if(tid_ctr!=RT_NULL)
|
|
if(tid_ctr!=RT_NULL)
|
|
|
{
|
|
{
|