|
|
|
@ -190,7 +190,7 @@ void Sensor_Communication_task(void *pvParameters)
|
|
|
|
C= RS485_RX_BUF_COPY[19];
|
|
|
|
C= RS485_RX_BUF_COPY[19];
|
|
|
|
C = C<<8|RS485_RX_BUF_COPY[20];
|
|
|
|
C = C<<8|RS485_RX_BUF_COPY[20];
|
|
|
|
|
|
|
|
|
|
|
|
//printf("now_tem=%d.%d℃,now_hum=%d.%d%% ,co2=%d\r\n",T/10,T%10,H/10,H%10,C);
|
|
|
|
printf("now_tem=%d.%d℃,now_hum=%d.%d%% ,co2=%d\r\n",T/10,T%10,H/10,H%10,C);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*GPIO1->报警铃 GPIO2->压缩机 GPIO3->四通阀 GPIO4—>新风风扇 GPIO5->加湿器 */
|
|
|
|
/*GPIO1->报警铃 GPIO2->压缩机 GPIO3->四通阀 GPIO4—>新风风扇 GPIO5->加湿器 */
|
|
|
|
@ -262,20 +262,23 @@ void Sensor_Communication_task(void *pvParameters)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int index=0;
|
|
|
|
int index=0;
|
|
|
|
|
|
|
|
//if()与while()的顺序不能变
|
|
|
|
|
|
|
|
if((RS485_RX_BUF_COPY[0]!=0x00))//不为0,处理掉
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RX_BUF_Transfer(0,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while(RS485_RX_BUF_COPY[index]==0x00)
|
|
|
|
while(RS485_RX_BUF_COPY[index]==0x00)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
index++;
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RX_BUF_Transfer(0,index);
|
|
|
|
RX_BUF_Transfer(0,index);
|
|
|
|
//printf("previous array cut\r\n");
|
|
|
|
printf("previous array cut\r\n");
|
|
|
|
// while(RS485_RX_BUF_COPY[0]==0x00)//前面数据为0,删掉
|
|
|
|
// while(RS485_RX_BUF_COPY[0]==0x00)//前面数据为0,删掉
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
//RX_BUF_Transfer(0,1);
|
|
|
|
//RX_BUF_Transfer(0,1);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if((RS485_RX_BUF_COPY[0]!=0x00))//不为0,处理掉
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RX_BUF_Transfer(0,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//RX_BUF_Printf(128);
|
|
|
|
//RX_BUF_Printf(128);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -307,7 +310,7 @@ void Host_Computer_Communication(void)
|
|
|
|
if(RS485_RX_BUF_COPY[2]==0x03)//单个同步
|
|
|
|
if(RS485_RX_BUF_COPY[2]==0x03)//单个同步
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Analysis(&n,&i,RS485_RX_BUF_COPY);
|
|
|
|
Analysis(&n,&i,RS485_RX_BUF_COPY);
|
|
|
|
//printf("B6 03 cmd: batch sync\r\n");
|
|
|
|
printf("B6 03 cmd: batch sync\r\n");
|
|
|
|
Array(&now_stage,&hour,&min,&tem,&hum,&red,&blue,&white);//更新对应阶段号的参数
|
|
|
|
Array(&now_stage,&hour,&min,&tem,&hum,&red,&blue,&white);//更新对应阶段号的参数
|
|
|
|
Write_Init();
|
|
|
|
Write_Init();
|
|
|
|
RX_BUF_Transfer(0,11);
|
|
|
|
RX_BUF_Transfer(0,11);
|
|
|
|
@ -316,18 +319,18 @@ void Host_Computer_Communication(void)
|
|
|
|
if(RS485_RX_BUF_COPY[2]==0x04)//阶段切换
|
|
|
|
if(RS485_RX_BUF_COPY[2]==0x04)//阶段切换
|
|
|
|
{
|
|
|
|
{
|
|
|
|
change_stage_rev1=RS485_RX_BUF_COPY[3];
|
|
|
|
change_stage_rev1=RS485_RX_BUF_COPY[3];
|
|
|
|
//printf("B6 04 cmd: change stage\r\n");
|
|
|
|
printf("B6 04 cmd: change stage\r\n");
|
|
|
|
RTC_synchronization_ins(2023,9,1,0,00,00);
|
|
|
|
RTC_synchronization_ins(2023,9,1,0,00,00);
|
|
|
|
now_stage=change_stage_rev1;
|
|
|
|
now_stage=change_stage_rev1;
|
|
|
|
store_stage=change_stage_rev1;
|
|
|
|
store_stage=change_stage_rev1;
|
|
|
|
Write_Init();
|
|
|
|
Write_Init();
|
|
|
|
RX_BUF_Transfer(0,8);
|
|
|
|
RX_BUF_Transfer(0,8);
|
|
|
|
//RX_BUF_Printf(128);
|
|
|
|
RX_BUF_Printf(128);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(RS485_RX_BUF_COPY[2]==0x01)//批量同步
|
|
|
|
if(RS485_RX_BUF_COPY[2]==0x01)//批量同步
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Batch_synchronization(&n,RS485_RX_BUF_COPY);
|
|
|
|
Batch_synchronization(&n,RS485_RX_BUF_COPY);
|
|
|
|
//printf("B6 01 cmd: get one %d\r\n", n);
|
|
|
|
printf("B6 01 cmd: get one %d\r\n", n);
|
|
|
|
Array(&now_stage,&hour,&min,&tem,&hum,&red,&blue,&white);//更新对应阶段号的参数
|
|
|
|
Array(&now_stage,&hour,&min,&tem,&hum,&red,&blue,&white);//更新对应阶段号的参数
|
|
|
|
//Write_Init();减少擦写的次数
|
|
|
|
//Write_Init();减少擦写的次数
|
|
|
|
RX_BUF_Transfer(0,20);
|
|
|
|
RX_BUF_Transfer(0,20);
|
|
|
|
|