From c6fa6a33bb24e67f78165f137a2c2309a189ebe9 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期二, 08 八月 2023 11:17:18 +0800 Subject: [PATCH] 气压基站V2.1 --- Src/application/dw_app.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 39 insertions(+), 1 deletions(-) diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c index 493981e..ac8e732 100644 --- a/Src/application/dw_app.c +++ b/Src/application/dw_app.c @@ -81,7 +81,7 @@ SINGLEPOLL, }tag_state=STARTPOLL; dwt_config_t config = { - 2, /* Channel number. */ + 5, /* Channel number. */ DWT_PRF_64M, /* Pulse repetition frequency. */ DWT_PLEN_128, /* Preamble length. */ DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ @@ -1271,6 +1271,38 @@ u32 id,error_times=0; extern float Height; extern float Altitude; +void QiyaJizhan_Send(void) +{ + GetPressAndHeight(); + intheight =Altitude*100; + nearbase_num = 0; + mainbase_id = 0x1234; + usart_send[0] = 0x55; + usart_send[1] = 0xaa; + usart_send[2] = 0x0c;//正常模式 + usart_send[3] = 15+8*(nearbase_num+1);//数据段长度 + memcpy(&usart_send[4],&dev_id,2); + usart_send[6] = frame_seq_nb; + usart_send[7] = frame_seq_nb++>>8; + usart_send[8] = bat_percent; + usart_send[9] = tx_near_msg[BUTTON_IDX]; + + memcpy(&usart_send[10],&intheight,2); + usart_send[12] = tag_frequency; + usart_send[13] = tagslotpos; + usart_send[14] = 0; + usart_send[15] = 0; + usart_send[16] = nearbase_num+1; + memcpy(&usart_send[17],&mainbase_id,2); + memcpy(&usart_send[19],&nearbaseid_list,2*nearbase_num); + memcpy(&usart_send[19+nearbase_num*2],&nearbase_distlist,4*nearbase_num+4); + memcpy(&usart_send[19+nearbase_num*6+4],&rec_anc_signalpower,2*nearbase_num+2); + + checksum = Checksum_u16(&usart_send[2],23+8*nearbase_num); + memcpy(&usart_send[25+8*nearbase_num],&checksum,2); + USART_puts(usart_send,27+8*nearbase_num); + //HexToAsciiSendUDP(usart_send,27+8*nearbase_num); +} void Tag_App(void)//发送模式(TAG标签) { @@ -1290,6 +1322,9 @@ // SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader // } // } +#ifdef QIYA_JIZHAN +QiyaJizhan_Send(); +#else Dw1000_Init(); error_times = 0; switch(tag_state) @@ -1324,10 +1359,13 @@ // Poll(); break; } + GetPressAndHeight(); + intheight =Altitude*100; userkey_state = !GET_USERKEY; dwt_forcetrxoff(); dwt_setinterrupt( DWT_INT_RFCG | (DWT_INT_ARFE | DWT_INT_RFSL | DWT_INT_SFDT | DWT_INT_RPHE | DWT_INT_RFCE | DWT_INT_RFTO | DWT_INT_RXPTO), 1); dwt_setrxtimeout(0);//设定接收超时时间,0位没有超时时间 dwt_rxenable(0); +#endif //dwt_entersleep(); } -- Gitblit v1.9.3