From 6e5211bf6d6279e343cf0f8fca0341b78a29de9e Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期四, 15 五月 2025 18:04:17 +0800 Subject: [PATCH] 初步能连接上,但是直接停止无任何测距版本 --- keil/include/components/app/src/ranging_fira.c | 51 ++++++++++----------------------------------------- 1 files changed, 10 insertions(+), 41 deletions(-) diff --git a/keil/include/components/app/src/ranging_fira.c b/keil/include/components/app/src/ranging_fira.c index 004015d..e369e61 100644 --- a/keil/include/components/app/src/ranging_fira.c +++ b/keil/include/components/app/src/ranging_fira.c @@ -136,7 +136,8 @@ // This function will be called by uwbapi_session_init() void app_session_init(void) -{ +{ + normal_uwb_change_to_fira();//变为fira配置的uwb // register process handler for MAC TX done and RX done mac_register_process_handler(ranging_tx_process, ranging_rx_process); @@ -145,7 +146,7 @@ void ranging_configure(void) { - normal_uwb_change_to_fira();//变为fira配置的uwb + fira_keys_generate(); aes_update_key(AES_ID0, &fira_key.devPayKey.ukey.keyByte[0]); @@ -308,7 +309,7 @@ .phy_cfg.rx_ant_id = UWB_RX_ANT_3, /* UWB RX antenna port */ }; #endif -uint8_t normal_flag; +uint8_t normal_flag=1; void uwb_fira_init(void) { uwb_open(); @@ -341,51 +342,19 @@ } void uwb_normal_init(void) { - // The following peripherals will be initialized in the uwb_open function - // phy/mac/aes/lsp/phy timers initialized - uwb_open(); -#ifdef STS_MODE - // Set STS key and IV - phy_sts_key_configure(&sts_iv_key); -#endif - // Set calibration parameters - uwb_calibration_params_set(config.phy_cfg.ch_num); -#ifdef STS_MODE - - // set advanced parameters - struct PHY_ADV_CONFIG_T adv_config = { - .thres_fap_detect = 40, - .nth_scale_factor = 4, - .ranging_performance_mode = 3, - .skip_weakest_port_en = 0, - }; -#else - // set advanced parameters - struct PHY_ADV_CONFIG_T adv_config = { - .thres_fap_detect = 40, - .nth_scale_factor = 4, - .ranging_performance_mode = 0, - .skip_weakest_port_en = 0, - }; -#endif - phy_adv_params_configure(&adv_config); - - // uwb configure - uwb_configure(config.phy_work_mode, board_param.tx_power_fcc[CALIB_CH(config.phy_cfg.ch_num)], &config.phy_cfg); -#if (defined STS_MODE) || (defined MK_MODE) - ranging_lib_init(); -#endif - ranging_frame_type_set(config.phy_cfg.sts_pkt_cfg); +Uwb_init(); } void fira_uwb_change_to_normal(void) { -uwb_close(); +//uwb_close(); + CloseUWB(); uwb_normal_init(); normal_flag=1; } -void normal_uwb_change_to_fira(void) +void normal_uwb_change_to_fira(void)//少个回调设置 { -uwb_close(); +//uwb_close(); + CloseUWB(); uwb_fira_init(); normal_flag=0; } -- Gitblit v1.9.3