【类 型】:style
【主 题】:动态传入 topicPubMsg oldMsg 的长度 【描 述】: [原因]:修改 订阅主题 时 动态获取 长度 让主题内容变量自适应长度 [过程]: [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
54adf4ad3f
commit
a23bc5a277
@ -31,10 +31,10 @@ FoodCube fc(ssid, password, mqttServer, mqttPort, mqttName, mqttPassword, mavlin
|
|||||||
/* 发布 主题 ps:以下是登记发布json内容的组成元素 */
|
/* 发布 主题 ps:以下是登记发布json内容的组成元素 */
|
||||||
// 登记 json成员名字
|
// 登记 json成员名字
|
||||||
// 0:心跳信息 1:电压信息 2:电流信息 3:电池电量 4:相对高度信息 5:对地速度 6:卫星数量 7:纬度 8:经度 9:定位状态 10:飞机状态 11:网速测试 12:飞机模式 13:重量 14:钩子状态 15:{经度,维度,海拔高度}
|
// 0:心跳信息 1:电压信息 2:电流信息 3:电池电量 4:相对高度信息 5:对地速度 6:卫星数量 7:纬度 8:经度 9:定位状态 10:飞机状态 11:网速测试 12:飞机模式 13:重量 14:钩子状态 15:{经度,维度,海拔高度}
|
||||||
String topicPub[] = {"heartBeat", "voltagBattery", "currentBattery", "batteryRemaining", "positionAlt", "groundSpeed", "satCount", "latitude", "longitude", "fixType", "state", "pingNet", "getPlaneMode", "loadweight", "hookstatus", "position"};
|
const String topicPub[] = {"heartBeat", "voltagBattery", "currentBattery", "batteryRemaining", "positionAlt", "groundSpeed", "satCount", "latitude", "longitude", "fixType", "state", "pingNet", "getPlaneMode", "loadweight", "hookstatus", "position"};
|
||||||
int topicPubCount = sizeof(topicPub) / sizeof(topicPub[0]); // 登记 json成员总数
|
const int topicPubCount = sizeof(topicPub) / sizeof(topicPub[0]); // 登记 json成员总数
|
||||||
String topicPubMsg[16]; // 登记 json成员的值 对应topicPub
|
String topicPubMsg[topicPubCount]; // 登记 json成员的值 对应topicPub
|
||||||
String oldMsg[16]; // 记录旧的值 用来对比有没有更新
|
String oldMsg[topicPubCount]; // 记录旧的值 用来对比有没有更新
|
||||||
/*触发发送 主题*/
|
/*触发发送 主题*/
|
||||||
// 0:对频信息
|
// 0:对频信息
|
||||||
String topicHandle[] = {"crosFrequency"};
|
String topicHandle[] = {"crosFrequency"};
|
||||||
|
@ -12,8 +12,8 @@ extern void pubThread();
|
|||||||
extern void flashThread();
|
extern void flashThread();
|
||||||
extern void writeRoute(String topicStr);
|
extern void writeRoute(String topicStr);
|
||||||
extern void mavlink_receiveCallback(uint8_t c);
|
extern void mavlink_receiveCallback(uint8_t c);
|
||||||
extern String topicPub[];
|
extern const String topicPub[];
|
||||||
extern int topicPubCount;
|
extern const int topicPubCount;
|
||||||
extern String topicPubMsg[];
|
extern String topicPubMsg[];
|
||||||
extern String topicHandle[];
|
extern String topicHandle[];
|
||||||
extern String oldMsg[];
|
extern String oldMsg[];
|
||||||
|
@ -149,7 +149,7 @@ void setup()
|
|||||||
/*异步线程*/
|
/*异步线程*/
|
||||||
tksendinfo.attach(1, sendinfo); // 发送状态
|
tksendinfo.attach(1, sendinfo); // 发送状态
|
||||||
pubTicker.attach(1, pubThread); // 定时 发布主题
|
pubTicker.attach(1, pubThread); // 定时 发布主题
|
||||||
mavTicker.attach(10, mavThread); // 定时 指定飞控mavlink 串口返回的数据类别 防止飞控启动滞后
|
mavTicker.attach(50, mavThread); // 定时 指定飞控mavlink 串口返回的数据类别 防止飞控启动滞后
|
||||||
// flashTicker.start(); // 监听 按flash键时 主动发布对频主题
|
// flashTicker.start(); // 监听 按flash键时 主动发布对频主题
|
||||||
/////////////////////////////////MQTT_语音_MAVLINK 部分结束
|
/////////////////////////////////MQTT_语音_MAVLINK 部分结束
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user