与APP协议通讯验证,并添加获取与修改wifi、ble设置命令

This commit is contained in:
OPTOC
2025-09-19 14:51:49 +08:00
parent 6f6438f544
commit 7df60a6505
8 changed files with 76 additions and 51 deletions

View File

@@ -151,7 +151,7 @@ void mavlik_packet_processing(mavlink_device_t* mavlink_device, mavlink_message_
{
//printf("MAVLINK_MSG_ID_ATTITUDE\n");
mavlink_msg_attitude_decode(message, &(mavlink_device->current_messages.attitude));
printf("pitch %f roll %f yaw %f\n", mavlink_device->current_messages.attitude.pitch * 180 / 3.1415926, mavlink_device->current_messages.attitude.roll * 180 / 3.1415926, mavlink_device->current_messages.attitude.yaw * 180 / 3.1415926);
// printf("pitch %f roll %f yaw %f\n", mavlink_device->current_messages.attitude.pitch * 180 / 3.1415926, mavlink_device->current_messages.attitude.roll * 180 / 3.1415926, mavlink_device->current_messages.attitude.yaw * 180 / 3.1415926);
break;
}

View File

@@ -213,7 +213,13 @@ int resend_send_data(resend_device_t *resend_device, uint8_t cmd, void* data, ui
resend_device->tx_frame.retry_cnt ++;
// 接收数据
resend_recv_data(resend_device, timeout);
uint16_t timeout_lat = timeout + 1;
while(timeout_lat --)
{
if(resend_recv_data(resend_device, 0) > 0)
break;
os_thread_sleep(1);
}
// 超过允许的等待次数
if(resend_device->tx_frame.retry_cnt > RESEND_MAX_RETRY_CNT)
{
@@ -232,26 +238,20 @@ int resend_parse_data(resend_device_t *resend_device)
{
switch(resend_device->rx_frame.cmd){
case RESEND_CMD_DATA:
for (size_t i = 0; i < resend_device->rx_frame.len; i++)
{
printf("%02X ", resend_device->rx_frame.payload[i]);
}
printf("\r\n");
break;
case RESEND_CMD_ACK:
printf("ACK\n");
resend_device->status.ack_flag = 0;
break;
case RESEND_CMD_GET_STATUS:
resend_send_cmd(resend_device, RESEND_CMD_ACK, 0);
resend_device->handle_flag = RESEND_CMD_GET_STATUS;
break;
case RESEND_CMD_STATUS:
case RESEND_CMD_PARAM:
resend_set(resend_device);
resend_send_cmd(resend_device, RESEND_CMD_ACK, 0);
break;
case RESEND_CMD_SET_STATUS:
case RESEND_CMD_GET_PARAM:
resend_send_cmd(resend_device, RESEND_CMD_ACK, 0);
resend_device->handle_flag = RESEND_CMD_GET_PARAM;
break;
case RESEND_CMD_SET_PARAM:
break;
case RESEND_CMD_DATA_ACK:
for (size_t i = 0; i < resend_device->rx_frame.len; i++)

View File

@@ -4,7 +4,10 @@
#include <stdint.h>
#include <string.h>
#include "resend_crc.h"
#include "os/os.h"
#include "os/os_common.h"
#include "console.h"
#include "shell/sh_vset.h"
// 帧数据量
#define RESEND_HEADER_SIZE 2
#define RESEND_CMD_SIZE 1
@@ -25,9 +28,9 @@ typedef enum
{
RESEND_CMD_DATA = 0x01,
RESEND_CMD_ACK = 0x02,
RESEND_CMD_GET_STATUS = 0x03,
RESEND_CMD_STATUS = 0x04,
RESEND_CMD_SET_STATUS = 0x05,
RESEND_CMD_PARAM = 0x03,
RESEND_CMD_GET_PARAM = 0x04,
RESEND_CMD_SET_PARAM = 0x05,
RESEND_CMD_DATA_ACK = 0x06,