蓝牙不开启待查

This commit is contained in:
lmx
2025-10-30 18:30:40 +08:00
parent 1d0eaa037b
commit 517beaa1a8
19 changed files with 158514 additions and 158278 deletions

View File

@ -74,12 +74,7 @@ void send_sensor_data_task(void) {
send_data_to_ble_client(&temp,5);
}
void create_process(u16* pid, const char* name, void *priv, void (*func)(void *priv), u32 msec){
xlog("Create Task: %s, pid=%d\n", name, *pid);
if (*pid != 0) return;
*pid = sys_timer_add(priv, func, msec);
xlog("Task %s is created, pid=%d\n", name, *pid);
}
extern void create_process(u16* pid, const char* name, void *priv, void (*func)(void *priv), u32 msec);
void rcsp_adv_fill_mac_addr(u8 *mac_addr_buf) //by xtell
{
@ -88,15 +83,8 @@ void rcsp_adv_fill_mac_addr(u8 *mac_addr_buf) //by xtell
void xtell_task_create(void){
u8 mac_data[6];
soft_iic_init(0);
extern u8 LIS2DH12_Config(void);
LIS2DH12_Config();
rcsp_adv_fill_mac_addr(mac_data); //读取MAC地址
xlog("xtell BT mac data:%x:%x:%x:%x:%x:%x",mac_data[0],mac_data[1],mac_data[2],mac_data[3],mac_data[4],mac_data[5]);
xlog("xtell_task_create\n");
//开经典蓝牙

View File

@ -14,7 +14,7 @@
#include "bt_profile_cfg.h"
#include "dev_manager/dev_manager.h"
#include "update_loader_download.h"
#include "avctp_user.h"
#define xlog(format, ...) printf("[%s] " format, __func__, ##__VA_ARGS__)
@ -34,6 +34,9 @@ u8 user_at_cmd_send_support = 1;
extern APP_VAR app_var;
u16 close_BL_number=0;
/*
* 2ms timer中断回调函数
@ -73,6 +76,33 @@ static void app_poweron_check(int update)
#endif
}
void create_process(u16* pid,char* name, void *priv, void (*func)(void *priv), u32 msec){
xlog("1 name=%s, pid =%d\n",name,*pid);
if (*pid != 0) return;
*pid = sys_timer_add(priv, func, msec);
xlog("2 name=%s, pid =%d\n",name,*pid);
}
void close_process(u16* pid,char* name){
xlog("name=%s,pid =%d\n",name,*pid);
if (*pid == 0) return;
sys_timer_del(*pid);
*pid = 0;
}
void close_BL(){
/**开机默认关闭 经典蓝牙 */
// close_BL_flag++;
xlog("xtell Classic Bluetooth off\n");
user_send_cmd_prepare(USER_CTRL_DISCONNECTION_HCI, 0, NULL); //断开此时经典蓝牙的连接,经典蓝牙还是可以被发现
delay_2ms(50);
user_send_cmd_prepare(USER_CTRL_WRITE_SCAN_DISABLE, 0, NULL); //关闭蓝牙可发现,已连接时不能操作
delay_2ms(50);
user_send_cmd_prepare(USER_CTRL_WRITE_CONN_DISABLE, 0, NULL); //关闭蓝牙可连接,
// sys_timer_del(close_BL_number); //删除定时器任务
close_process(&close_BL_number,__func__);
}
extern u32 timer_get_ms(void);
void xtell_app_main()
@ -81,7 +111,7 @@ void xtell_app_main()
u32 addr = 0, size = 0;
struct intent it;
xlog("==============xtell_app_main================\n");
xlog("==============xtell_app_main start================\n");
if (!UPDATE_SUPPORT_DEV_IS_NULL()) {
update = update_result_deal();
@ -89,29 +119,54 @@ void xtell_app_main()
app_var_init();
// if (get_charge_online_flag()) {
if (get_charge_online_flag()) {
#if(TCFG_SYS_LVD_EN == 1)
vbat_check_init();
#endif
// init_intent(&it);
// it.name = "idle";
// it.action = ACTION_IDLE_MAIN;
// start_app(&it);
// } else {
xlog("==============idle================\n");
init_intent(&it);
it.name = "idle";
it.action = ACTION_IDLE_MAIN;
start_app(&it);
} else {
xlog("==============handler================\n");
check_power_on_voltage();
app_poweron_check(update);
init_intent(&it);
it.name = "handler";
it.action = ACTION_EARPHONE_MAIN;
start_app(&it);
// }
}
log_info("app_main\n");
app_var.start_time = timer_get_ms();
//////////////////////////////////////////////////
//开机必须延时关闭经典蓝牙,不然底层代码会再次把蓝牙 打开
create_process(&close_BL_number, "close_BL",NULL, close_BL, 3000);
soft_iic_init(0);
extern u8 LIS2DH12_Config(void);
LIS2DH12_Config();
u8 mac_data[6];
rcsp_adv_fill_mac_addr(mac_data); //读取MAC地址
xlog("xtell BT mac data:%x:%x:%x:%x:%x:%x",mac_data[0],mac_data[1],mac_data[2],mac_data[3],mac_data[4],mac_data[5]);
user_send_cmd_prepare(USER_CTRL_WRITE_SCAN_ENABLE, 0, NULL); //打开蓝牙可发现,已连接时不能操作
delay_2ms(50);
user_send_cmd_prepare(USER_CTRL_WRITE_CONN_ENABLE, 0, NULL); //打开蓝牙可连接
delay_2ms(50);
extern void xtell_task_create(void);
xtell_task_create();
xlog("==============xtell_app_end================\n");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6287,17 +6287,29 @@ objs/apps/common/colorful_lights/colorful_lights.c.o
-r=objs/apps/common/colorful_lights/colorful_lights.c.o,usr_timer_del,l
-r=objs/apps/common/colorful_lights/colorful_lights.c.o,spi_dma_set_addr_for_isr,l
objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,xtell_app_main,pl
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,create_process,pl
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,printf,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,sys_timer_add,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,close_process,pl
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,sys_timer_del,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,close_BL,pl
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,user_send_cmd_prepare,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,delay_2ms,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,xtell_app_main,pl
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,update_result_deal,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,app_var_init,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,get_charge_online_flag,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,vbat_check_init,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,check_power_on_voltage,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,start_app,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,check_power_on_voltage,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,log_print,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,timer_get_ms,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,soft_iic_init,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,LIS2DH12_Config,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,rcsp_adv_fill_mac_addr,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,xtell_task_create,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,cpu_reset_by_soft,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,close_BL_number,pl
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,config_update_mode,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,log_tag_const_i_APP,l
-r=objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o,app_var,l
@ -6363,15 +6375,12 @@ objs/apps/earphone//xtell_Sensor/send_data.c.o
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,printf,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,send_sensor_data_task,pl
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,send_data_to_ble_client,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,create_process,pl
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,sys_timer_add,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,rcsp_adv_fill_mac_addr,pl
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,swapX,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,bt_get_mac_addr,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,xtell_task_create,pl
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,soft_iic_init,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,LIS2DH12_Config,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,circle_buffer_init,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,create_process,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,xtell_i2c_test,l
-r=objs/apps/earphone//xtell_Sensor/send_data.c.o,puts,l
objs/apps/earphone//xtell_Sensor/circle_buffer.c.o

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -133,4 +133,6 @@ objs/apps/earphone//xtell_Sensor/xtell_app_main.c.o: \
apps/earphone/include\app_power_manage.h \
apps/earphone/include\app_charge.h \
apps/common\dev_manager/dev_manager.h \
include_lib/update\update_loader_download.h include_lib/system\debug.h
include_lib/update\update_loader_download.h \
include_lib/btstack\avctp_user.h include_lib/btstack/btstack_typedef.h \
include_lib/system\debug.h