【类 型】:
【原 因】: 【过 程】: 【影 响】:
This commit is contained in:
parent
37b8918e93
commit
d86e4cb811
@ -34,7 +34,7 @@ uint32_t udpServerPort = 37260; // 云台相机端口
|
||||
FoodCube fc(ssid, password, mqttServer, mqttPort, mqttName, mqttPassword, mavlinkSerial, voiceSerial, udpServerIP, udpServerPort); // 创建项目对象
|
||||
/* 发布 主题 ps:以下是登记发布json内容的组成元素 */
|
||||
// 登记 json成员名字
|
||||
// 0:心跳信息 1:电压信息 2:电流信息 3:电池电量 4:相对高度信息 5:对地速度 6:卫星数量 7:纬度 8:经度 9:定位状态 10:飞机状态 11:网速测试 12:飞机模式 13:重量 14:钩子状态 15:{经度,维度,海拔高度} 16:电池总容量 17:返航点 18:文本信息
|
||||
// 0:心跳信息 1:电压信息 2:电流信息 3:电池电量 4:海拔高度 5:对地速度 6:卫星数量 7:纬度 8:经度 9:定位状态 10:飞机状态 11:网速测试 12:飞机模式 13:重量 14:钩子状态 15:{经度,维度,相对高度} 16:电池总容量 17:返航点 18:文本信息
|
||||
const String topicPub[] = {"heartBeat", "voltagBattery", "currentBattery", "batteryRemaining", "positionAlt", "groundSpeed", "satCount", "latitude", "longitude", "fixType", "state", "pingNet", "getPlaneMode", "loadweight", "hookstatus", "position", "battCapacity", "homePosition", "statusText"};
|
||||
const int topicPubCount = sizeof(topicPub) / sizeof(topicPub[0]); // 登记 json成员总数
|
||||
String topicPubMsg[topicPubCount] = {""}; // 登记 json成员的值 对应topicPub
|
||||
@ -375,11 +375,11 @@ void mavlink_receiveCallback(uint8_t c)
|
||||
{
|
||||
mavlink_gps_global_origin_t gps_org; // 解构的数据放到这个对象
|
||||
mavlink_msg_gps_global_origin_decode(&msg, &gps_org); // 解构msg数据
|
||||
// 精 维 高
|
||||
// home点经纬高
|
||||
sprintf(buf, "{\"lng\":%d,\"lat\":%d,\"alt\":%.2f}",
|
||||
gps_org.latitude,
|
||||
gps_org.longitude,
|
||||
(double)gps_org.altitude);
|
||||
(double)gps_org.altitude / 1000);
|
||||
|
||||
if (topicPubMsg[17] != buf)
|
||||
{
|
||||
@ -519,18 +519,18 @@ void mavlink_receiveCallback(uint8_t c)
|
||||
{
|
||||
mavlink_global_position_int_t global_position_int;
|
||||
mavlink_msg_global_position_int_decode(&msg, &global_position_int);
|
||||
// 高度
|
||||
sprintf(buf, "%.2f", (double)global_position_int.relative_alt / 1000);
|
||||
// 海拔高度
|
||||
sprintf(buf, "%.2f", (double)global_position_int.alt / 1000);
|
||||
|
||||
if (topicPubMsg[4] != buf)
|
||||
{
|
||||
topicPubMsg[4] = buf;
|
||||
}
|
||||
// 经纬 海拔高度
|
||||
// 经纬高
|
||||
sprintf(buf, "{\"lng\":%d,\"lat\":%d,\"alt\":%.2f}",
|
||||
global_position_int.lon,
|
||||
global_position_int.lat,
|
||||
(double)global_position_int.alt / 1000);
|
||||
(double)global_position_int.relative_alt / 1000);
|
||||
|
||||
if (topicPubMsg[15] != buf)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user