【类 型】:
【原 因】: 【过 程】: 【影 响】:
This commit is contained in:
parent
3516ad02c8
commit
706449d553
@ -14,8 +14,10 @@ extern void Hook_recovery();
|
||||
static const char *MOUDLENAME = "COMMSER";
|
||||
|
||||
/*项目对象*/
|
||||
char* ssid = "szdot"; //wifi帐号
|
||||
char* password = "63587839ab"; //wifi密码
|
||||
char *ssid = "szMate40pro1"; // wifi帐号
|
||||
char *password = "63587839ab"; // wifi密码
|
||||
// char* ssid = "szdot"; //wifi帐号
|
||||
// char* password = "63587839ab"; //wifi密码
|
||||
// char *ssid = "flicube"; // wifi帐号
|
||||
// char *password = "fxmf0622"; // wifi密码
|
||||
// char *ssid = "fxmf_sc01"; // 4g wifi帐号
|
||||
@ -33,10 +35,10 @@ FoodCube fc(ssid, password, mqttServer, mqttPort, mqttName, mqttPassword, mavlin
|
||||
/* 发布 主题 ps:以下是登记发布json内容的组成元素 */
|
||||
// 登记 json成员名字
|
||||
// 0:心跳信息 1:电压信息 2:电流信息 3:电池电量 4:相对高度信息 5:对地速度 6:卫星数量 7:纬度 8:经度 9:定位状态 10:飞机状态 11:网速测试 12:飞机模式 13:重量 14:钩子状态 15:{经度,维度,海拔高度} 16:飞控参数{键:值}
|
||||
const String topicPub[] = {"heartBeat", "voltagBattery", "currentBattery", "batteryRemaining", "positionAlt", "groundSpeed", "satCount", "latitude", "longitude", "fixType", "state", "pingNet", "getPlaneMode", "loadweight", "hookstatus", "position","parameter"};
|
||||
const String topicPub[] = {"heartBeat", "voltagBattery", "currentBattery", "batteryRemaining", "positionAlt", "groundSpeed", "satCount", "latitude", "longitude", "fixType", "state", "pingNet", "getPlaneMode", "loadweight", "hookstatus", "position", "parameter"};
|
||||
const int topicPubCount = sizeof(topicPub) / sizeof(topicPub[0]); // 登记 json成员总数
|
||||
String topicPubMsg[topicPubCount] ={""}; // 登记 json成员的值 对应topicPub
|
||||
String oldMsg[topicPubCount]={""}; // 记录旧的值 用来对比有没有更新
|
||||
String topicPubMsg[topicPubCount] = {""}; // 登记 json成员的值 对应topicPub
|
||||
String oldMsg[topicPubCount] = {""}; // 记录旧的值 用来对比有没有更新
|
||||
/*触发发送 主题*/
|
||||
// 0:对频信息
|
||||
String topicHandle[] = {"crosFrequency"};
|
||||
@ -160,9 +162,9 @@ void mqtt_receiveCallback(char *topic, byte *payload, unsigned int length)
|
||||
String todo = value; // 转换值
|
||||
topicPubMsg[10] = todo; // 恢复初始状态
|
||||
}
|
||||
else if (key == "getBattCapacity")//请求 飞控返回 电池容量
|
||||
else if (key == "getBattCapacity") // 请求 飞控返回 电池容量
|
||||
{
|
||||
fc.mav_parameter_data("BATT_CAPACITY");// 请求飞控 返回参数 电池容量 值
|
||||
fc.mav_parameter_data("BATT_CAPACITY"); // 请求飞控 返回参数 电池容量 值
|
||||
}
|
||||
else if (key == "chan1")
|
||||
{
|
||||
@ -726,13 +728,13 @@ void pubThread()
|
||||
// 设置对象成员 ps:心跳
|
||||
doc[topicPub[i]] = topicPubMsg[i];
|
||||
}
|
||||
else if (i == 3 || i==10)
|
||||
else if (i == 3 || i == 10)
|
||||
{
|
||||
// 设置对象成员 ps:3电池电量 10飞机状态state
|
||||
doc[topicPub[i]] = topicPubMsg[i];
|
||||
}
|
||||
else if (topicPubMsg[i] != oldMsg[i])
|
||||
{
|
||||
{
|
||||
// 非心跳 非飞机状态 有更新 录入成员
|
||||
doc[topicPub[i]] = topicPubMsg[i];
|
||||
oldMsg[i] = topicPubMsg[i];
|
||||
|
Loading…
Reference in New Issue
Block a user