连接server并发送数据成功

This commit is contained in:
lmx
2025-12-17 18:24:50 +08:00
parent d029d273f8
commit 537cb1f099
11 changed files with 4409 additions and 1183 deletions

View File

@ -258,11 +258,11 @@ void contol_key_task(void){
static u16 Xout_adc = 0;
static u16 Yout_adc = 0;
static u8 key1_state = 1;
u8 ble_data_buff[13] = {0xBE, 0xBB, 0x0A, 0x01, //0-3
u8 ble_data_buff[12] = {0xBE, 0xBB, 0x0A, 0x01, //0-3
0x00, 0x00, 0x00, 0x00, //4-7 遥感值:上下、左右
0x00, 0x00, //8、9 两个按键
0x00, 0x00, //10、11 vbat adc值
0x0C}; //12 校验和
0x00, //10 电量百分比
0x0C}; //11 校验和
control_key_init(); //遥感按键初始化
@ -279,8 +279,7 @@ void contol_key_task(void){
ble_data_buff[8] = key1_state;
ble_data_buff[9] = 0x01;
ble_data_buff[10] = (u8)(vbat_value & 0xFF);
ble_data_buff[11] = (u8)((vbat_value >> 8) & 0xFF);
ble_data_buff[10] = get_vbat_percent();
g_send_data_to_ble_server(ble_data_buff, sizeof(ble_data_buff));
os_time_dly(5);