This commit is contained in:
AIR 2023-07-05 15:29:07 +08:00
parent 748d892146
commit b33bba3dd2

View File

@ -21,10 +21,10 @@ String topicSub[] = { "questAss", "setPlaneState", "getPlaneState", "resetState"
int topicSubCount = sizeof(topicSub) / sizeof(topicSub[0]); //订阅主题总数
/*有更新主动发送 主题*/
//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", "planeState", "pingNet", "getPlaneMode","loadweight","hookstatus","altitude" };
int topicPubCount = sizeof(topicPub) / sizeof(topicPub[0]);  //发送主题总数
String topicPubMsg[16];                                      //发送数据存放 对应topicPub
String oldMsg[16];                                           //记录旧的数据 用来对比有没有更新
String topicPub[] = { "heartBeat", "voltagBattery", "currentBattery", "batteryRemaining", "positionAlt", "groundSpeed", "satCount", "latitude", "longitude", "fixType", "planeState", "pingNet", "getPlaneMode", "loadweight", "hookstatus", "altitude" };
int topicPubCount = sizeof(topicPub) / sizeof(topicPub[0]); //发送主题总数
String topicPubMsg[16]; //发送数据存放 对应topicPub
String oldMsg[16]; //记录旧的数据 用来对比有没有更新
/*触发发送 主题*/
//0:对频信息
String topicHandle[] = { "crosFrequency" };
@ -163,10 +163,10 @@ void mqtt_receiveCallback(char* topic, byte* payload, unsigned int length) {
DynamicJsonDocument doc(0x2FFF);
deserializeJson(doc, topicStr);
JsonObject obj = doc.as<JsonObject>();
int8_t item=obj["item"];
int8_t val=obj["val"];
int8_t pitch=obj["pitch"];
int8_t yaw=obj["yaw"];
int8_t item = obj["item"];
int8_t val = obj["val"];
int8_t pitch = obj["pitch"];
int8_t yaw = obj["yaw"];
//相机控制
if (item == 0) { //0:一键回中
uint8_t command[] = { 0x55, 0x66, 0x01, 0x01, 0x00, 0x00, 0x00, 0x08, 0x01 };
@ -245,7 +245,7 @@ void writeRoute(String topicStr) {
double y = obj["tasks"][fc.writeSeq]["y"];
double z = obj["tasks"][fc.writeSeq]["z"];
String str = obj["tasks"][fc.writeSeq]["sound"];
if(str != "" ){
if (str != "") {
fc.questVoiceStr = str;
}
fc.logln("frame--");