【类 型】:factor
【主 题】:发送飞机状态 不够频繁 【描 述】: [原因]:前端接收飞机状态 太旧 [过程]:和心跳一起频繁发送 一秒一次 [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
1303b1aaff
commit
3f0352daf0
@ -16,10 +16,10 @@ static const char *MOUDLENAME = "COMMSER";
|
||||
/*项目对象*/
|
||||
// char* ssid = "szdot"; //wifi帐号
|
||||
// char* password = "Ttaj@#*.com"; //wifi密码
|
||||
// char *ssid = "flicube"; // wifi帐号
|
||||
// char *password = "fxmf0622"; // wifi密码
|
||||
char *ssid = "fxmf_sc01"; // 4g wifi帐号
|
||||
char *password = "12345678"; // 4g wifi密码
|
||||
char *ssid = "flicube"; // wifi帐号
|
||||
char *password = "fxmf0622"; // wifi密码
|
||||
// char *ssid = "fxmf_sc01"; // 4g wifi帐号
|
||||
// char *password = "12345678"; // 4g wifi密码
|
||||
char *mqttServer = "szdot.top"; // mqtt地址
|
||||
int mqttPort = 1883; // mqtt端口
|
||||
char *mqttName = "admin"; // mqtt帐号
|
||||
@ -628,24 +628,27 @@ void pubThread()
|
||||
// 遍历 有更新的数据 组成一个json对象
|
||||
for (int i = 0; i < topicPubCount; i++)
|
||||
{
|
||||
if (topicPubMsg[i] != oldMsg[i])
|
||||
if (i == 0)
|
||||
{ // 心跳包 每每向心跳主题发布信息
|
||||
// 启动飞控 第一次心跳 ps:防止飞控 滞后启动 拿不到数据
|
||||
if (fc.getIsInit())
|
||||
{
|
||||
fc.setIsInit(false);
|
||||
fc.mav_request_data(); // 再向飞控请求一次 设定飞控输出数据流内容
|
||||
}
|
||||
// 设置对象成员 ps:心跳
|
||||
doc[topicPub[0]] = topicPubMsg[0];
|
||||
}
|
||||
else if (i == 10)
|
||||
{
|
||||
if (i == 0)
|
||||
{ // 心跳包 每每向心跳主题发布信息
|
||||
// 启动飞控 第一次心跳 ps:防止飞控 滞后启动 拿不到数据
|
||||
if (fc.getIsInit())
|
||||
{
|
||||
fc.setIsInit(false);
|
||||
fc.mav_request_data(); // 再向飞控请求一次 设定飞控输出数据流内容
|
||||
}
|
||||
// 设置对象成员 ps:心跳
|
||||
doc[topicPub[0]] = topicPubMsg[0];
|
||||
}
|
||||
else
|
||||
{ // 非心跳 有更新 录入成员
|
||||
doc[topicPub[i]] = topicPubMsg[i];
|
||||
oldMsg[i] = topicPubMsg[i];
|
||||
}
|
||||
// 设置对象成员 ps:飞机状态 state
|
||||
doc[topicPub[10]] = topicPubMsg[10];
|
||||
}
|
||||
else if (topicPubMsg[i] != oldMsg[i])
|
||||
{
|
||||
// 非心跳 非飞机状态 有更新 录入成员
|
||||
doc[topicPub[i]] = topicPubMsg[i];
|
||||
oldMsg[i] = topicPubMsg[i];
|
||||
}
|
||||
}
|
||||
// 将JSON对象序列化为JSON字符串
|
||||
|
Loading…
Reference in New Issue
Block a user