From 3b7f39134908d81041e9550f75169d671f95d0e5 Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期五, 06 六月 2025 15:57:29 +0800 Subject: [PATCH] V1.1铁鞋专属升级工卡,修改uwb配置参数为64len并且修改回包时间让其能测距升级 --- keil/uwb_app.c | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 44 insertions(+), 7 deletions(-) diff --git a/keil/uwb_app.c b/keil/uwb_app.c index c70881a..adb1757 100644 --- a/keil/uwb_app.c +++ b/keil/uwb_app.c @@ -78,7 +78,7 @@ #define RANGING_PERIOD_MS (1000) /* This is the delay from Frame RX POLL frame to send RESP Frame */ -#define POLL_RX_TO_RESP_TX_DLY_US 550U //yuan600 success 并且不卡busy +#define POLL_RX_TO_RESP_TX_DLY_US 1100U //yuan600 success 并且不卡busy #define RESP_TX_TO_FINAL_RX_DLY_US 500U @@ -116,14 +116,14 @@ uint8_t phy_work_mode; /* PHY_TX / PHY_RX / PHT_TX|PHY_RX */ struct UWB_CONFIG_T phy_cfg; }; - +extern uint8_t uwb_ch; static struct mk_uwb_configure config = { .phy_work_mode = (uint8_t)(PHY_TX | PHY_RX), .phy_cfg.ch_num = 5, /* Channel number. */ .phy_cfg.code_index = 9, /* TRX preamble code */ .phy_cfg.mean_prf = MEAN_PRF_64M, /* Mean prf 64/128/256M */ .phy_cfg.data_bit_rate = DATA_BR_6M8, /* Data rate 6.8M */ - .phy_cfg.sync_sym = PREAM_LEN_128, /* Preamble duration, length of preamble 128 */ + .phy_cfg.sync_sym = PREAM_LEN_64, /* Preamble duration, length of preamble 128 */ .phy_cfg.sfd_sym = NON_STD_NSFD5_8, /* Identifier for SFD sequence */ .phy_cfg.ranging_bit = 1, /* ranging bit set 1 */ .phy_cfg.trx_mode = TRX_MODE_15_4A, /* IEEE802.15.4z - BPRF mode */ @@ -230,6 +230,8 @@ extern uint16_t mubiao_anchor_ID; uint8_t Lora_qingqiu_flag; extern uint16_t Lora_qingqiu_bao; +uint8_t shengji_flag; +extern uint8_t Dtu_shengji_jindu[20]; static void rx_int_callback(struct MAC_HW_REPORT_T *rx_report) { uint8_t valid_sts=0; uint16_t checksum1 = 0,dest_id; @@ -251,7 +253,8 @@ rssi = rx_report->rssi; receive_flag=1; // uart_send(UART_ID0, rx_buf,rx_length, NULL); - if(rx_buf[MESSAGE_TYPE_IDX]==MBX_POLL) + gpio_pin_toggle(IO_PIN_4); + if(rx_buf[MESSAGE_TYPE_IDX]==MBX_POLL&&!shengji_flag) { Anchor_App(); } @@ -264,6 +267,7 @@ { if(!memcmp(&dev_id,&dest_id,2)/*||dest_id==0xffff||(dest_id==0xfffe&&get_channel==5)*/) { + shengji_flag=1; switch(rx_buf[MSG_TYPE_IDX]) { case LORA_MSGTYPE_UPDATE_CONFIRM: @@ -285,8 +289,13 @@ break; case 0x99: - LOG_INFO(TRACE_MODULE_APP, "收到结束升级请求\r\n",Lora_qingqiu_bao); - delay_ms(500); +// LOG_INFO(TRACE_MODULE_APP, "收到结束升级请求\r\n",Lora_qingqiu_bao); + delay_ms(200); + Dtu_shengji_jindu[4]=100; + memcpy(&Dtu_shengji_jindu[5],&mubiao_anchor_ID,2); + uart_send(UART_ID0, Dtu_shengji_jindu,9, NULL); + + delay_ms(1000); // Lora_upanc_flag=0; Lora_qingqiu_flag=0; NVIC_SystemReset(); @@ -317,7 +326,7 @@ // } } } - + #ifdef STS_MODE valid_sts= sts_valid_check(); if (valid_sts) @@ -649,6 +658,33 @@ if(HIDO_TimerGetTick()-uwbtasktimer >=1) { + + for(uint16_t i=0;i<taglist_num-1;i++) + { + for(uint16_t j=0;j<taglist_num-1-i;j++) + { + if(tagdist_list[j]>tagdist_list[j+1]) + { + uint16_t id,dist,version; + uint8_t bat; + id = tagid_list[j]; + dist = tagdist_list[j]; + version = anchordata_version[j]; + tagid_list[j] = tagid_list[j+1]; + tagdist_list[j] = tagdist_list[j+1]; + anchordata_version[j] = anchordata_version[j+1]; + tagid_list[j+1] = id; + tagdist_list[j+1] = dist; + anchordata_version[j+1] = version; + } + } + + } + + if(taglist_num>6) + { + taglist_num=6; + } uwbtasktimer = HIDO_TimerGetTick(); UWBOneSecondTask(); uwbsend[0]=0x55; @@ -885,6 +921,7 @@ phy_rx_ant_mode_set(RX_ANT_PORTS_COMBINATION); #endif // Set calibration parameters +// config.phy_cfg.ch_num=g_com_map[NEARBASE_ID1]; uwb_calibration_params_set(config.phy_cfg.ch_num); #ifndef STS_MODE // set advanced parameters -- Gitblit v1.9.3