Commit fd9662ba authored by 957dd's avatar 957dd

1217

parent 63a8fd2f
ip:192.168.1.72
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
serial_usart 1 start
Mqttbeat start
serial_usart 2 start
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
Connected to broker
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
正在处理过期消息{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head":{"message_type":1}}
{"body":{"ip":"192.168.1.72","ID":"controcar0005","N":"","E":""},"head"
\ No newline at end of file
No preview for this file type
......@@ -3,6 +3,8 @@
#include "mqtt.h"
#include "serial.h"
void *serial_usart1(void *arg)
{
printf("serial_usart 1 start\n");
......@@ -16,13 +18,14 @@ void *AppExit(void *arg)
{
/*
unsigned char bufpwm1[3]={0x01,0x01,0x00};
unsigned char bufpwm2[3]={0x01,0x02,0x00};
unsigned char bufpwm3[3]={0x01,0x03,0x00};
unsigned char bufpwm1[3]={gtypeTemp,0x01,0x00};
unsigned char bufpwm2[3]={gtypeTemp,0x02,0x00};
unsigned char bufpwm3[3]={gtypeTemp,0x03,0x00};
unsigned char bufpwm4[3]={gtypeTemp,0x04,0x00};
while(1)
{
Delay_Ms();
Delay_Ms(0,150);
gPwmCount++;
if(gPwmCount>20)
{
......@@ -30,9 +33,9 @@ void *AppExit(void *arg)
serial_Write(bufpwm1);
serial_Write(bufpwm2);
serial_Write(bufpwm3);
serial_Write(bufpwm4);
}
}
}*/
return NULL;
}
......
......@@ -82,32 +82,41 @@ void mqtt_wirte()
void message_0()//message_type为0时候要改变的值
{
for(int i=0;i<2;i++)
for(int i=1;i<=4;i++)
{
gPwmCount = 0;
switch(i)
{
case 0:
case 1:
gvalt[0]=gmodeTmep;
gvalt[1]=0;
gvalt[1]=1;
gvalt[2]=0;
printf("gmodeTmep:%d\n",gvalt[0]);
printf("gtypeTemp:%d\n",gvalt[1]);
printf("gvaltemp:%d\n",gvalt[2]);
serial_Write(gvalt);
break;
case 1:
case 2:
gvalt[0]=gmodeTmep;
gvalt[1]=1;
gvalt[1]=2;
gvalt[2]=0;
printf("gmodeTmep:%d\n",gvalt[0]);
printf("gtypeTemp:%d\n",gvalt[1]);
printf("gvaltemp:%d\n",gvalt[2]);
serial_Write(gvalt);
break;
case 2:
case 3:
gvalt[0]=gmodeTmep;
gvalt[1]=2;
gvalt[1]=3;
gvalt[2]=0;
printf("gmodeTmep:%d\n",gvalt[0]);
printf("gtypeTemp:%d\n",gvalt[1]);
printf("gvaltemp:%d\n",gvalt[2]);
serial_Write(gvalt);
break;
case 4:
gvalt[0]=gmodeTmep;
gvalt[1]=4;
gvalt[2]=0;
printf("gmodeTmep:%d\n",gvalt[0]);
printf("gtypeTemp:%d\n",gvalt[1]);
......@@ -137,7 +146,7 @@ void message_3(cJSON *body,cJSON *pwm_ctrl)//message_type为3,控制pwm
cJSON *val = cJSON_GetObjectItem(pwm_ctrl, "val"); //val为pwm的值 0~100(unsigned char)(unsigned char)
gmodeTmep= mode->valueint;
gtypeTemp=type->valueint;
gvaltemp= val->valueint;
gvaltemp= val->valueint/2+30;
gvalt[0]=gtypeTemp;
gvalt[1]=gmodeTmep;
gvalt[2]=gvaltemp;
......
......@@ -25,6 +25,7 @@ extern int gPwmCount; // 计数
extern int gmessage_type;
extern unsigned char gtypeTemp;
int mqtt_init();
int mqtt_create(struct mosquitto *mosq);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment