| | |
| | | #include "lora_3029.h" |
| | | #include "mk_spi.h" |
| | | #include "global_param.h" |
| | | #include "pan_port.h" |
| | | #include "pan_rf.h" |
| | | #include "dw_app_anchor.h" |
| | | //#include "WS2812.h" |
| | | //#include "lora_3029.h" |
| | | //#include "mk_spi.h" |
| | | //#include "global_param.h" |
| | | //#include "pan_port.h" |
| | | //#include "pan_param.h" |
| | | //#include "pan_rf.h" |
| | | //#define RX_TIMEOUT_VALUE 1000 |
| | | //extern LPTIM_HandleTypeDef hlptim1; |
| | | /***lora接收,发送变量定义******/ |
| | | #define RX_TIMEOUT_VALUE 0 |
| | | #define BUFFER_SIZE 255 // Define the payload size here |
| | | uint16_t BufferSize = BUFFER_SIZE; |
| | | uint8_t TX_Buffer[BUFFER_SIZE]; |
| | | uint8_t RX_Buffer[BUFFER_SIZE]; |
| | | |
| | | int8_t RssiValue = 0; |
| | | int8_t SnrValue = 0; |
| | | extern uint32_t current_count; |
| | | |
| | | extern uint32_t dev_id; |
| | | uint8_t yuyin_no_sleep_flag,no_rx_flag; |
| | | uint8_t lora_up_rec_flag; |
| | | static uint16_t source_id; |
| | | /***lora接收,发送变量定义******/ |
| | | uint32_t wg_lost_count = 10; |
| | | static uint8_t tx_buf[10] = {0x55, 0x44, 0x33, 0x22, 0x11}; |
| | | static uint8_t rx_buf[10] = {0x00}; |
| | | //extern uint32_t uwbled,gpsled,loraled,powerled; |
| | | extern uint8_t bat_percent,taglist_num; |
| | | //uint8_t report_ancnum; |
| | | //uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM]; |
| | | extern void spi_transfer_callback(void *dev, uint32_t err_code); |
| | | extern uint16_t ancidlist_rec[TAG_NUM_IN_SYS],ancidlist_send[TAG_NUM_IN_SYS],rec_ancidlist[TAG_NUM_IN_SYS]; |
| | | extern uint8_t report_ancnum; |
| | | extern uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM]; |
| | | void Lora_init(void) |
| | | { |
| | | // rf_write_reg(0x04, 0x55); |
| | | // rf_port.spi_readwrite(0x09); |
| | | // uint8_t rx_data = 0; // 用于存储接收的数据 |
| | | // spi_transfer(SPI_ID0, 0x09, rx_buf, 1, spi_transfer_callback); |
| | | uint32_t ret = 0; |
| | | uint32_t cnt = 0; |
| | | ret=rf_init(); |
| | | |
| | | set_test_mode1_reg(); |
| | | if(ret== 1) |
| | | { |
| | | //printf("LORA Init Fail"); |
| | | while(1); |
| | | } |
| | | else |
| | | { |
| | | //printf("LORA Init OK\r\n"); |
| | | } |
| | | |
| | | } |
| | | //#include "dw_app_anchor.h" |
| | | //#include "HIDO_TypeDef.h" |
| | | ////#include "WS2812.h" |
| | | ////#include "pan_port.h" |
| | | ////#include "pan_param.h" |
| | | ////#include "pan_rf.h" |
| | | ////#define RX_TIMEOUT_VALUE 1000 |
| | | ////extern LPTIM_HandleTypeDef hlptim1; |
| | | ///***lora接收,发送变量定义******/ |
| | | |
| | | |
| | | //void TagListUpdate(void) |
| | | //extern uint32_t current_count; |
| | | |
| | | //extern uint32_t dev_id; |
| | | //uint8_t yuyin_no_sleep_flag,no_rx_flag; |
| | | //uint8_t lora_up_rec_flag; |
| | | //static uint16_t source_id; |
| | | ///***lora接收,发送变量定义******/ |
| | | //uint32_t wg_lost_count = 10; |
| | | //static uint8_t tx_buf[10] = {0x55, 0x44, 0x33, 0x22, 0x11}; |
| | | //static uint8_t rx_buf[10] = {0x00}; |
| | | ////extern uint32_t uwbled,gpsled,loraled,powerled; |
| | | //extern uint8_t bat_percent,taglist_num; |
| | | ////uint8_t report_ancnum; |
| | | ////uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM]; |
| | | //extern void spi_transfer_callback(void *dev, uint32_t err_code); |
| | | //extern uint16_t ancidlist_rec[TAG_NUM_IN_SYS],ancidlist_send[TAG_NUM_IN_SYS],rec_ancidlist[TAG_NUM_IN_SYS]; |
| | | //extern uint8_t report_ancnum; |
| | | //extern uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM]; |
| | | ////extern u8 active_flag; |
| | | ////void LoraInit(void) |
| | | ////{ |
| | | //// RadioEvents.TxDone = OnTxDone; |
| | | //// RadioEvents.RxDone = OnRxDone; |
| | | //// RadioEvents.TxTimeout = OnTxTimeout; |
| | | //// RadioEvents.RxTimeout = OnRxTimeout; |
| | | //// RadioEvents.RxError = OnRxError; |
| | | |
| | | //// Radio.Init( &RadioEvents ); |
| | | //// SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); //切换lora接收频点 |
| | | //// if(active_flag) |
| | | //// { |
| | | //// Radio.Rx( 0 ); |
| | | //// }else{ |
| | | //// Radio.Sleep(); |
| | | //// } |
| | | ////// Radio.SetRxDutyCycle(RxDutyCycle_RX_time,RxDutyCycle_SLEEP_time); |
| | | //// |
| | | ////} |
| | | //void Lora_init(void) |
| | | //{ |
| | | // uint16_t i,j=0,k=0,temp[TAG_NUM_IN_SYS]; |
| | | // for(i=0; i<taglist_num; i++) |
| | | //// rf_write_reg(0x04, 0x55); |
| | | //// rf_port.spi_readwrite(0x09); |
| | | //// uint8_t rx_data = 0; // 用于存储接收的数据 |
| | | //// spi_transfer(SPI_ID0, 0x09, rx_buf, 1, spi_transfer_callback); |
| | | // uint32_t ret = 0; |
| | | // uint32_t cnt = 0; |
| | | // ret=rf_init(); |
| | | // |
| | | // set_test_mode1_reg(); |
| | | // if(ret== 1) |
| | | // { |
| | | // if(tagofflinetime[i]++<REPORT_TAG_KEEPTIMES) |
| | | // //printf("LORA Init Fail"); |
| | | // while(1); |
| | | // } |
| | | // else |
| | | // { |
| | | // //printf("LORA Init OK\r\n"); |
| | | // } |
| | | |
| | | //} |
| | | |
| | | |
| | | ////void TagListUpdate(void) |
| | | ////{ |
| | | //// uint16_t i,j=0,k=0,temp[TAG_NUM_IN_SYS]; |
| | | //// for(i=0; i<taglist_num; i++) |
| | | //// { |
| | | //// if(tagofflinetime[i]++<REPORT_TAG_KEEPTIMES) |
| | | //// { |
| | | //// report_ancid[k]=tagid_list[i]; |
| | | //// report_ancdist[k++]=tagdist_list[i]; |
| | | //// } |
| | | //// if(tagofflinetime[i]++<TAG_KEEPTIMES) |
| | | //// { |
| | | //// tagid_list[j]=tagid_list[i]; |
| | | //// tagdist_list[j] = tagdist_list[i]; |
| | | //// tagofflinetime[j++]=tagofflinetime[i]; |
| | | //// } |
| | | //// } |
| | | //// report_ancnum = k; |
| | | //// taglist_num=j; |
| | | ////} |
| | | //extern wg_state_enum wg_state; |
| | | //uint8_t lora_sendbuffer[200]; |
| | | //uint8_t seq_num; |
| | | //extern uint16_t lora_up_uwb_flag; |
| | | ////extern uint8_t wg_lost_count; |
| | | //uint16_t wg_report_freq,wg_report_id; |
| | | //uint8_t wg_report_sf; |
| | | //#define WG_LOST_SWITCH_THRES 3 |
| | | //#define WG_LOST_NOUWB_COUNT 60 |
| | | //#define DEFAULT_WG_ID 0xFFFF |
| | | //#define DEFAULT_LR_WG_ID 0xFFFE |
| | | //uint8_t lora_jianting_flag = 1; |
| | | //void LoraReportFreqPoll(void) |
| | | //{ |
| | | // // wg_state = WG_Lost; |
| | | // if(wg_lost_count++>WG_LOST_NOUWB_COUNT) |
| | | // { |
| | | // lora_jianting_flag = 0; |
| | | // } else { |
| | | // lora_jianting_flag = 1; |
| | | // } |
| | | // if(wg_state==WG_Lost) |
| | | // { |
| | | // static uint8_t channel_switch_count = 0; |
| | | // // channel_switch_count = 10; |
| | | // if(channel_switch_count++>1) |
| | | // { |
| | | // report_ancid[k]=tagid_list[i]; |
| | | // report_ancdist[k++]=tagdist_list[i]; |
| | | //// channel_switch_count = 0; |
| | | //// wg_report_id = DEFAULT_LR_WG_ID; |
| | | //// wg_report_freq = LR_DATA_CHANNEL_FRQ; //如果丢失链接就进入WG管理信道。 |
| | | //// wg_report_sf = LR_DATA_CHANNEL_SF; |
| | | // } |
| | | // if(tagofflinetime[i]++<TAG_KEEPTIMES) |
| | | // else |
| | | // { |
| | | // wg_report_id = DEFAULT_WG_ID; |
| | | // wg_report_freq = REPORT_MANGE_CHANNEL_FRQ; //如果丢失链接就进入WG管理信道。 |
| | | // wg_report_sf = REPORT_CHANNEL_SF; |
| | | //// wg_report_freq = TEST_MANAGE_CHANNEL_FRQ; |
| | | //// wg_report_sf = TEST_MANAGE_CHANNEL_SF; |
| | | // } |
| | | // } else { |
| | | // if(wg_lost_count>WG_LOST_SWITCH_THRES) |
| | | // { |
| | | // tagid_list[j]=tagid_list[i]; |
| | | // tagdist_list[j] = tagdist_list[i]; |
| | | // tagofflinetime[j++]=tagofflinetime[i]; |
| | | // wg_state = WG_Lost; |
| | | // } |
| | | // } |
| | | // report_ancnum = k; |
| | | // taglist_num=j; |
| | | //} |
| | | extern wg_state_enum wg_state; |
| | | uint8_t lora_sendbuffer[200]; |
| | | uint8_t seq_num; |
| | | extern uint16_t lora_up_uwb_flag; |
| | | //extern uint8_t wg_lost_count; |
| | | uint16_t wg_report_freq,wg_report_id; |
| | | uint8_t wg_report_sf; |
| | | #define WG_LOST_SWITCH_THRES 3 |
| | | #define WG_LOST_NOUWB_COUNT 60 |
| | | #define DEFAULT_WG_ID 0xFFFF |
| | | #define DEFAULT_LR_WG_ID 0xFFFE |
| | | uint8_t lora_jianting_flag = 1; |
| | | void LoraReportFreqPoll(void) |
| | | { |
| | | // wg_state = WG_Lost; |
| | | if(wg_lost_count++>WG_LOST_NOUWB_COUNT) |
| | | { |
| | | lora_jianting_flag = 0; |
| | | } else { |
| | | lora_jianting_flag = 1; |
| | | } |
| | | if(wg_state==WG_Lost) |
| | | { |
| | | static uint8_t channel_switch_count = 0; |
| | | // channel_switch_count = 10; |
| | | if(channel_switch_count++>1) |
| | | { |
| | | // channel_switch_count = 0; |
| | | // wg_report_id = DEFAULT_LR_WG_ID; |
| | | // wg_report_freq = LR_DATA_CHANNEL_FRQ; //如果丢失链接就进入WG管理信道。 |
| | | // wg_report_sf = LR_DATA_CHANNEL_SF; |
| | | } |
| | | else |
| | | { |
| | | wg_report_id = DEFAULT_WG_ID; |
| | | wg_report_freq = REPORT_MANGE_CHANNEL_FRQ; //如果丢失链接就进入WG管理信道。 |
| | | wg_report_sf = REPORT_CHANNEL_SF; |
| | | // wg_report_freq = TEST_MANAGE_CHANNEL_FRQ; |
| | | // wg_report_sf = TEST_MANAGE_CHANNEL_SF; |
| | | } |
| | | } else { |
| | | if(wg_lost_count>WG_LOST_SWITCH_THRES) |
| | | { |
| | | wg_state = WG_Lost; |
| | | } |
| | | } |
| | | } |
| | | static uint16_t checksum; |
| | | //static uint16_t checksum; |
| | | |
| | | //uint16_t wg_report_freq,wg_report_id; |
| | | uint8_t lora_sendbuffer[200]; |
| | | void LoraHeartBeartPoll(void) |
| | | { |
| | | ////uint16_t wg_report_freq,wg_report_id; |
| | | //uint8_t lora_sendbuffer[200]; |
| | | //void LoraHeartBeartPoll(void) |
| | | //{ |
| | | |
| | | // lora_up_uwb_flag=2; |
| | | // rf_set_default_para(); |
| | | //// lora_up_uwb_flag=2; |
| | | //// rf_set_default_para(); |
| | | |
| | | /*****************************心跳包上传内容************************************/ |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGHEARTBEAT; |
| | | lora_sendbuffer[MSG_LENGTH] = 14; |
| | | memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | memcpy(&lora_sendbuffer[HB_VERSION_IDX],&g_com_map[VERSION],2); |
| | | lora_sendbuffer[HB_UWBPOWER_IDX] = g_com_map[POWER]; |
| | | lora_sendbuffer[HB_LORAPOWER_IDX] = g_com_map[LORA_POWER]; |
| | | checksum = Checksum_u16(lora_sendbuffer,14); |
| | | memcpy(&lora_sendbuffer[14],&checksum,2); |
| | | LORA_3029_SINGLE_SEND(lora_sendbuffer,16,0); |
| | | |
| | | /*****************************心跳包上传内容*************************************/ |
| | | |
| | | } |
| | | #define HEATBEAT_UPDATE_TIME 100 |
| | | uint16_t heatbeat_count = HEATBEAT_UPDATE_TIME-1 ; |
| | | uint16_t flag_getwgresp = 0; |
| | | uint16_t test_temp[10]={0x1306,9688,1000}; |
| | | uint16_t test_temp2[10]={0xff,0xcd,0x19}; |
| | | int16_t intheight; //气压 |
| | | extern uint32_t dangqian_frqe; |
| | | extern uint16_t recnum[3]; |
| | | extern uint32_t freq_list[4]; |
| | | extern uint8_t DMA_RXBuf_BT[200]; |
| | | extern uint8_t report_ancnum; |
| | | extern uint8_t report_ancnum_bt; |
| | | uint32_t BT_SEND_flag=0; |
| | | uint8_t BT_NUM=0; |
| | | void LoraReportPoll(void) |
| | | { |
| | | // delay_ms(100); |
| | | ///*****************************心跳包上传内容************************************/ |
| | | // lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGHEARTBEAT; |
| | | // lora_sendbuffer[MSG_LENGTH] = 14; |
| | | // memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | // memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | // memcpy(&lora_sendbuffer[HB_VERSION_IDX],&g_com_map[VERSION],2); |
| | | // lora_sendbuffer[HB_UWBPOWER_IDX] = g_com_map[POWER]; |
| | | // lora_sendbuffer[HB_LORAPOWER_IDX] = g_com_map[LORA_POWER]; |
| | | // checksum = Checksum_u16(lora_sendbuffer,14); |
| | | // memcpy(&lora_sendbuffer[14],&checksum,2); |
| | | // LORA_3029_SINGLE_SEND(lora_sendbuffer,16,0); |
| | | // |
| | | ///*****************************心跳包上传内容*************************************/ |
| | | // |
| | | //} |
| | | //#define HEATBEAT_UPDATE_TIME 100 |
| | | //uint16_t heatbeat_count = HEATBEAT_UPDATE_TIME-1 ; |
| | | //uint16_t flag_getwgresp = 0; |
| | | //uint16_t test_temp[10]={0x1306,9688,1000}; |
| | | //uint16_t test_temp2[10]={0xff,0xcd,0x19}; |
| | | //int16_t intheight; //气压 |
| | | //extern uint32_t dangqian_frqe; |
| | | //extern uint16_t recnum[3]; |
| | | //extern uint32_t freq_list[4]; |
| | | //extern uint8_t DMA_RXBuf_BT[200]; |
| | | //extern uint8_t report_ancnum; |
| | | //extern uint8_t report_ancnum_bt; |
| | | //uint32_t BT_SEND_flag=0; |
| | | //uint8_t BT_NUM=0; |
| | | //void LoraReportPoll(void) |
| | | //{ |
| | | // // delay_ms(100); |
| | | |
| | | #ifdef _USE_BAR |
| | | GetPressAndHeight(); |
| | | intheight = Height*100; |
| | | #endif |
| | | #ifdef _SMT_TEST |
| | | printf("气压值:%d",intheight); |
| | | #endif |
| | | //#ifdef _USE_BAR |
| | | // GetPressAndHeight(); |
| | | // intheight = Height*100; |
| | | //#endif |
| | | //#ifdef _SMT_TEST |
| | | // printf("气压值:%d",intheight); |
| | | //#endif |
| | | |
| | | TagListUpdate(); |
| | | // TagListUpdate(); |
| | | |
| | | LoraReportFreqPoll(); |
| | | flag_getwgresp = 0; |
| | | // wg_report_freq = REPORT_MANGE_CHANNEL_FRQ; |
| | | //Lora_init(); |
| | | uint32_t para; |
| | | // LoraReportFreqPoll(); |
| | | // flag_getwgresp = 0; |
| | | // // wg_report_freq = REPORT_MANGE_CHANNEL_FRQ; |
| | | // //Lora_init(); |
| | | // uint32_t para; |
| | | |
| | | para=freq_list[2] * 100000; |
| | | // rf_set_freq(wg_report_freq*100000); |
| | | // rf_set_carrier_wave_off(); |
| | | // rf_set_carrier_wave_on(); |
| | | rf_set_freq(para); |
| | | //rf_set_sf(UWB_CHANNEL_SF); |
| | | // rf_set_tx_power(para); |
| | | // rf_set_carrier_wave_freq(freq_list[1] * 100000); |
| | | // rf_set_freq(para); |
| | | rf_set_sf(REPORT_CHANNEL_SF); |
| | | //rf_set_default_para(wg_report_freq,REPORT_CHANNEL_SF); |
| | | // SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]); |
| | | dangqian_frqe=rf_read_freq(); |
| | | if(heatbeat_count++>HEATBEAT_UPDATE_TIME && WG_Connected == wg_state) //如果心跳包到达上传时间,并且网关处于链接状态,就上传心跳包 |
| | | { |
| | | heatbeat_count = 0; |
| | | LoraHeartBeartPoll(); |
| | | return; |
| | | } |
| | | for(uint16_t i=0; i<report_ancnum-1; i++) |
| | | { |
| | | for(uint16_t j=0; j<report_ancnum-1-i; j++) |
| | | { |
| | | if(report_ancdist[j]>report_ancdist[j+1]) |
| | | { |
| | | uint16_t id,dist; |
| | | uint8_t bat; |
| | | id = report_ancid[j]; |
| | | dist = report_ancdist[j]; |
| | | report_ancid[j] = report_ancid[j+1]; |
| | | report_ancdist[j] = report_ancdist[j+1]; |
| | | report_ancid[j+1] = id; |
| | | report_ancdist[j+1] = dist; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(report_ancnum>LORA_REPORT_MAXANC_NUM) //考虑lora传输时间,最多发送10个基站数据。 |
| | | { |
| | | report_ancnum = LORA_REPORT_MAXANC_NUM; |
| | | } |
| | | |
| | | #ifdef USE_GPS |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_GPS; |
| | | lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+30; |
| | | #else |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG; |
| | | lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+ANCID_IDX; |
| | | #endif |
| | | memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | lora_sendbuffer[SEQNUM_IDX] = seq_num++; |
| | | lora_sendbuffer[BAT_IDX] = bat_percent; |
| | | //GET_USERKEY这个是那个lora——busy那个引脚 |
| | | // lora_sendbuffer[STATE_IDX]=0x01; |
| | | // lora_sendbuffer[GATEWAY_CHANL]=0x02; |
| | | // lora_sendbuffer[CHANL_NUM]=0x03; |
| | | // lora_sendbuffer[STATE_IDX] = !GET_USERKEY|stationary_flag<<1; |
| | | #ifdef USE_GPS |
| | | memcpy(&lora_sendbuffer[GPS_JINGDU_IDX],&gps_jingdu,8); |
| | | memcpy(&lora_sendbuffer[GPS_WEIDU_IDX],&gps_jingdu,8); |
| | | memcpy(&lora_sendbuffer[GPS_HEIGHT_IDX],&gps_height,8); |
| | | lora_sendbuffer[GPS_STATE_IDX] = gps_state; |
| | | lora_sendbuffer[GPS_SATEL_NUM_IDX] = gps_satel_num; |
| | | lora_sendbuffer[GPS_SPOWER_IDX] = gps_signalpower; |
| | | lora_sendbuffer[GPS_CHAFENLINGQI] = gps_chafenlingqi; |
| | | #endif |
| | | // memcpy(&lora_sendbuffer[BAR_HEIGHT_IDX],&bar_height,2); |
| | | // memcpy(&report_ancid,test_temp,10); |
| | | // memcpy(&report_ancdist,test_temp2,10); |
| | | // para=freq_list[2] * 100000; |
| | | //// rf_set_freq(wg_report_freq*100000); |
| | | //// rf_set_carrier_wave_off(); |
| | | //// rf_set_carrier_wave_on(); |
| | | // rf_set_freq(para); |
| | | // //rf_set_sf(UWB_CHANNEL_SF); |
| | | //// rf_set_tx_power(para); |
| | | //// rf_set_carrier_wave_freq(freq_list[1] * 100000); |
| | | //// rf_set_freq(para); |
| | | // rf_set_sf(REPORT_CHANNEL_SF); |
| | | // //rf_set_default_para(wg_report_freq,REPORT_CHANNEL_SF); |
| | | // // SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]); |
| | | // dangqian_frqe=rf_read_freq(); |
| | | // if(heatbeat_count++>HEATBEAT_UPDATE_TIME && WG_Connected == wg_state) //如果心跳包到达上传时间,并且网关处于链接状态,就上传心跳包 |
| | | // { |
| | | // heatbeat_count = 0; |
| | | // LoraHeartBeartPoll(); |
| | | // return; |
| | | // } |
| | | // for(uint16_t i=0; i<report_ancnum-1; i++) |
| | | // { |
| | | // for(uint16_t j=0; j<report_ancnum-1-i; j++) |
| | | // { |
| | | // if(report_ancdist[j]>report_ancdist[j+1]) |
| | | // { |
| | | // uint16_t id,dist; |
| | | // uint8_t bat; |
| | | // id = report_ancid[j]; |
| | | // dist = report_ancdist[j]; |
| | | // report_ancid[j] = report_ancid[j+1]; |
| | | // report_ancdist[j] = report_ancdist[j+1]; |
| | | // report_ancid[j+1] = id; |
| | | // report_ancdist[j+1] = dist; |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // if(report_ancnum>LORA_REPORT_MAXANC_NUM) //考虑lora传输时间,最多发送10个基站数据。 |
| | | // { |
| | | // report_ancnum = LORA_REPORT_MAXANC_NUM; |
| | | // } |
| | | // |
| | | //#ifdef USE_GPS |
| | | // lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_GPS; |
| | | // lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+30; |
| | | //#else |
| | | // lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG; |
| | | // lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+ANCID_IDX; |
| | | //#endif |
| | | // memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | // memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | // lora_sendbuffer[SEQNUM_IDX] = seq_num++; |
| | | // lora_sendbuffer[BAT_IDX] = bat_percent; |
| | | // //GET_USERKEY这个是那个lora——busy那个引脚 |
| | | //// lora_sendbuffer[STATE_IDX]=0x01; |
| | | //// lora_sendbuffer[GATEWAY_CHANL]=0x02; |
| | | //// lora_sendbuffer[CHANL_NUM]=0x03; |
| | | // // lora_sendbuffer[STATE_IDX] = !GET_USERKEY|stationary_flag<<1; |
| | | //#ifdef USE_GPS |
| | | // memcpy(&lora_sendbuffer[GPS_JINGDU_IDX],&gps_jingdu,8); |
| | | // memcpy(&lora_sendbuffer[GPS_WEIDU_IDX],&gps_jingdu,8); |
| | | // memcpy(&lora_sendbuffer[GPS_HEIGHT_IDX],&gps_height,8); |
| | | // lora_sendbuffer[GPS_STATE_IDX] = gps_state; |
| | | // lora_sendbuffer[GPS_SATEL_NUM_IDX] = gps_satel_num; |
| | | // lora_sendbuffer[GPS_SPOWER_IDX] = gps_signalpower; |
| | | // lora_sendbuffer[GPS_CHAFENLINGQI] = gps_chafenlingqi; |
| | | //#endif |
| | | // // memcpy(&lora_sendbuffer[BAR_HEIGHT_IDX],&bar_height,2); |
| | | //// memcpy(&report_ancid,test_temp,10); |
| | | //// memcpy(&report_ancdist,test_temp2,10); |
| | | |
| | | lora_sendbuffer[ANCNUM_IDX] = report_ancnum; |
| | | memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2); |
| | | uint8_t LORA_RETRANSNUSSION_BT=0; |
| | | BT_NUM=DMA_RXBuf_BT[0]; |
| | | if(0<BT_NUM&&BT_NUM<11) |
| | | { |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_BT; |
| | | LORA_RETRANSNUSSION_BT=ANCID_IDX+report_ancnum*4; |
| | | //LORA_RETRANSNUSSION_BT report_ancnum_bt |
| | | lora_sendbuffer[LORA_RETRANSNUSSION_BT] = 0x2D; //蓝牙上传标识符 |
| | | memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+1],&DMA_RXBuf_BT[0],BT_NUM*2+1); //基站ID |
| | | memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+BT_NUM*2+2],&DMA_RXBuf_BT[1+BT_NUM*2],BT_NUM*2);//基站距离 |
| | | lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+4*BT_NUM+ANCID_IDX+2; |
| | | } |
| | | if(lora_sendbuffer[LORA_RETRANSNUSSION_BT]==0x2D) |
| | | { |
| | | checksum = Checksum_u16(lora_sendbuffer,4*BT_NUM+4*report_ancnum+ANCID_IDX+2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+BT_NUM*4+report_ancnum*4+2],&checksum,2); |
| | | BT_SEND_flag++; |
| | | } |
| | | else |
| | | { |
| | | checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum+ANCID_IDX); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*4],&checksum,2); |
| | | } |
| | | |
| | | |
| | | LORA_3029_SINGLE_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+4,0); |
| | | memset(DMA_RXBuf_BT, 0,200); |
| | | memset(&lora_sendbuffer[ANCID_IDX],0,200); |
| | | //LED_TB_ON; |
| | | |
| | | |
| | | for(uint8_t i=0;i<3;i++) |
| | | recnum[i] = 0; |
| | | |
| | | } |
| | | |
| | | static uint16_t delaytime = 1200; |
| | | static uint16_t source_id; |
| | | uint8_t rec_index,rec_secdelay; |
| | | //uint16_t rec_value,rec_delaytime,rx_count; |
| | | //uint16_t rec_value,rec_delaytime,rx_count,datalen_offset; |
| | | |
| | | uint8_t shengji_flag,time=5; |
| | | extern uint32_t uwbled,gpsled,loraled,powerled; |
| | | extern struct RxDoneMsg RxDoneParams; |
| | | |
| | | //extern uint8_t Lora_tx_ancnum; |
| | | //extern u8 lora_seq_nb2; |
| | | extern uint16_t lora_yingda_num; |
| | | uint8_t lora_tx_flag=0; |
| | | uint8_t lora_txanchor_power_flag; |
| | | extern uint16_t Lora_tx_ancid[50]; |
| | | extern uint16_t Lora_tx_ancdist[50]; |
| | | extern uint8_t Lora_tx_anc_electricity[50]; |
| | | uint8_t lora_seq_nb1; |
| | | |
| | | extern uint8_t lora_sendbuffer[200]; |
| | | void LoraSendComMap(uint8_t cmd) |
| | | { |
| | | uint8_t data_length = 0x50; |
| | | uint16_t checksum = 0; |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_READPARARESP; |
| | | lora_sendbuffer[MSG_LENGTH] = data_length+11; |
| | | memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | lora_sendbuffer[RP_CMD_IDX] = cmd; |
| | | lora_sendbuffer[RP_INDEX_IDX] = 2; |
| | | lora_sendbuffer[RP_LEN_IDX] = data_length; |
| | | memcpy(&lora_sendbuffer[9], &g_com_map[1], data_length); |
| | | checksum = Checksum_u16(lora_sendbuffer,11+data_length); |
| | | memcpy(&lora_sendbuffer[11+data_length],&checksum,2); |
| | | LORA_3029_SINGLE_SEND(lora_sendbuffer,data_length+13,0); |
| | | //++; |
| | | // Delay_Ms(100); |
| | | } |
| | | void LoraRspWriteCommap(uint8_t index) |
| | | { |
| | | uint8_t data_length = 2; |
| | | uint16_t checksum = 0; |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_READPARARESP; |
| | | lora_sendbuffer[MSG_LENGTH] = data_length+9; |
| | | memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | lora_sendbuffer[RP_CMD_IDX] = WGRSP_RWTAG_WRITE; |
| | | lora_sendbuffer[RP_INDEX_IDX] = index; |
| | | lora_sendbuffer[RP_LEN_IDX] = data_length; |
| | | memcpy(&lora_sendbuffer[7], &g_com_map[index/2], data_length); |
| | | checksum = Checksum_u16(lora_sendbuffer,9+data_length); |
| | | memcpy(&lora_sendbuffer[9+data_length],&checksum,2); |
| | | // Radio.Send(lora_sendbuffer,data_length+11); |
| | | LORA_3029_SINGLE_SEND(lora_sendbuffer,data_length+11,0); |
| | | // Delay_Ms(100); |
| | | } |
| | | uint8_t t22[20],ti; |
| | | uint8_t no_yingdaflag; |
| | | uint8_t aRxBuffer[1]; |
| | | |
| | | extern uint8_t group_id; |
| | | uint16_t lora_send_count; |
| | | uint8_t mode_flag=0; |
| | | uint32_t frqe,dangqian_frqe; |
| | | uint32_t freq_list[4] = {DEFAULT_up_FREQ/100000,4730,4780,4910}; |
| | | |
| | | #define TX_LEN 10 |
| | | extern uint8_t tx_test_buf[TX_LEN]; |
| | | |
| | | void Lora_Tx_Poll() |
| | | { |
| | | |
| | | // if(lora_tx_flag) |
| | | // { |
| | | // OnMaster(); |
| | | //// |
| | | // //rf_enter_continous_rx(); |
| | | // lora_sendbuffer[ANCNUM_IDX] = report_ancnum; |
| | | // memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2); |
| | | // memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2); |
| | | // uint8_t LORA_RETRANSNUSSION_BT=0; |
| | | // BT_NUM=DMA_RXBuf_BT[0]; |
| | | // if(0<BT_NUM&&BT_NUM<11) |
| | | // { |
| | | // lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_BT; |
| | | // LORA_RETRANSNUSSION_BT=ANCID_IDX+report_ancnum*4; |
| | | // //LORA_RETRANSNUSSION_BT report_ancnum_bt |
| | | // lora_sendbuffer[LORA_RETRANSNUSSION_BT] = 0x2D; //蓝牙上传标识符 |
| | | // memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+1],&DMA_RXBuf_BT[0],BT_NUM*2+1); //基站ID |
| | | // memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+BT_NUM*2+2],&DMA_RXBuf_BT[1+BT_NUM*2],BT_NUM*2);//基站距离 |
| | | // lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+4*BT_NUM+ANCID_IDX+2; |
| | | // } |
| | | if(lora_tx_flag) |
| | | { |
| | | // gpio_pin_set(IO_PIN_5); |
| | | |
| | | if(lora_send_count++%10==0||lora_jianting_flag) |
| | | { |
| | | lora_tx_flag=0; |
| | | #ifdef GROUPID_SWITCH |
| | | if(rec_secdelay>0) |
| | | { |
| | | rec_secdelay--; |
| | | // if(lora_jianting_flag) |
| | | // { |
| | | // if(++group_id>GROUP_NUM) |
| | | // { |
| | | // group_id = 1; |
| | | // } |
| | | // t22[ti++] = group_id; |
| | | // if(ti>=20) |
| | | // ti=0; |
| | | // group_min_dist[group_id] = 0xffff; |
| | | // Radio.Standby(); |
| | | // SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | // Radio.Rx(0); |
| | | // } |
| | | return; |
| | | } |
| | | // //找3个小组中最近距离最大的小组,上传报文后切换到这个小组,因为上传报文会时间占用。 |
| | | // if(group_min_dist[1]>group_min_dist[2]) //如果1大于2 |
| | | // if(lora_sendbuffer[LORA_RETRANSNUSSION_BT]==0x2D) |
| | | // { |
| | | // checksum = Checksum_u16(lora_sendbuffer,4*BT_NUM+4*report_ancnum+ANCID_IDX+2); |
| | | // memcpy(&lora_sendbuffer[ANCID_IDX+BT_NUM*4+report_ancnum*4+2],&checksum,2); |
| | | // BT_SEND_flag++; |
| | | // } |
| | | // else |
| | | // { |
| | | // checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum+ANCID_IDX); |
| | | // memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*4],&checksum,2); |
| | | // } |
| | | |
| | | |
| | | // LORA_3029_SINGLE_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+4,0); |
| | | // memset(DMA_RXBuf_BT, 0,200); |
| | | // memset(&lora_sendbuffer[ANCID_IDX],0,200); |
| | | // //LED_TB_ON; |
| | | |
| | | // |
| | | // for(uint8_t i=0;i<3;i++) |
| | | // recnum[i] = 0; |
| | | |
| | | //} |
| | | |
| | | //static uint16_t delaytime = 1200; |
| | | //static uint16_t source_id; |
| | | //uint8_t rec_index,rec_secdelay; |
| | | ////uint16_t rec_value,rec_delaytime,rx_count; |
| | | ////uint16_t rec_value,rec_delaytime,rx_count,datalen_offset; |
| | | |
| | | //uint8_t shengji_flag,time=5; |
| | | //extern uint32_t uwbled,gpsled,loraled,powerled; |
| | | //extern struct RxDoneMsg RxDoneParams; |
| | | |
| | | ////extern uint8_t Lora_tx_ancnum; |
| | | ////extern u8 lora_seq_nb2; |
| | | //extern uint16_t lora_yingda_num; |
| | | //uint8_t lora_tx_flag=0; |
| | | //uint8_t lora_txanchor_power_flag; |
| | | //extern uint16_t Lora_tx_ancid[50]; |
| | | //extern uint16_t Lora_tx_ancdist[50]; |
| | | //extern uint8_t Lora_tx_anc_electricity[50]; |
| | | //uint8_t lora_seq_nb1; |
| | | |
| | | //extern uint8_t lora_sendbuffer[200]; |
| | | //void LoraSendComMap(uint8_t cmd) |
| | | //{ |
| | | // uint8_t data_length = 0x50; |
| | | // uint16_t checksum = 0; |
| | | // lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_READPARARESP; |
| | | // lora_sendbuffer[MSG_LENGTH] = data_length+11; |
| | | // memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | // memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | // lora_sendbuffer[RP_CMD_IDX] = cmd; |
| | | // lora_sendbuffer[RP_INDEX_IDX] = 2; |
| | | // lora_sendbuffer[RP_LEN_IDX] = data_length; |
| | | // memcpy(&lora_sendbuffer[9], &g_com_map[1], data_length); |
| | | // checksum = Checksum_u16(lora_sendbuffer,11+data_length); |
| | | // memcpy(&lora_sendbuffer[11+data_length],&checksum,2); |
| | | // LORA_3029_SINGLE_SEND(lora_sendbuffer,data_length+13,0); |
| | | // //++; |
| | | // // Delay_Ms(100); |
| | | //} |
| | | //void LoraRspWriteCommap(uint8_t index) |
| | | //{ |
| | | // uint8_t data_length = 2; |
| | | // uint16_t checksum = 0; |
| | | // lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_READPARARESP; |
| | | // lora_sendbuffer[MSG_LENGTH] = data_length+9; |
| | | // memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | // memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | // lora_sendbuffer[RP_CMD_IDX] = WGRSP_RWTAG_WRITE; |
| | | // lora_sendbuffer[RP_INDEX_IDX] = index; |
| | | // lora_sendbuffer[RP_LEN_IDX] = data_length; |
| | | // memcpy(&lora_sendbuffer[7], &g_com_map[index/2], data_length); |
| | | // checksum = Checksum_u16(lora_sendbuffer,9+data_length); |
| | | // memcpy(&lora_sendbuffer[9+data_length],&checksum,2); |
| | | // // Radio.Send(lora_sendbuffer,data_length+11); |
| | | // LORA_3029_SINGLE_SEND(lora_sendbuffer,data_length+11,0); |
| | | // // Delay_Ms(100); |
| | | //} |
| | | //uint8_t t22[20],ti; |
| | | //uint8_t no_yingdaflag; |
| | | //uint8_t aRxBuffer[1]; |
| | | |
| | | //extern uint8_t group_id; |
| | | //uint16_t lora_send_count; |
| | | //uint8_t mode_flag=0; |
| | | //uint32_t frqe,dangqian_frqe; |
| | | //uint32_t freq_list[4] = {DEFAULT_up_FREQ/100000,4730,4780,4910}; |
| | | |
| | | //#define TX_LEN 10 |
| | | //extern uint8_t tx_test_buf[TX_LEN]; |
| | | |
| | | //void Lora_Tx_Poll() |
| | | //{ |
| | | // |
| | | //// if(lora_tx_flag) |
| | | //// { |
| | | //// OnMaster(); |
| | | ////// |
| | | //// //rf_enter_continous_rx(); |
| | | //// } |
| | | // if(lora_tx_flag) |
| | | // { |
| | | //// gpio_pin_set(IO_PIN_5); |
| | | // |
| | | // if(lora_send_count++%10==0||lora_jianting_flag) |
| | | // { |
| | | // lora_tx_flag=0; |
| | | //#ifdef GROUPID_SWITCH |
| | | // if(rec_secdelay>0) |
| | | // { |
| | | // group_maxdist_index = group_min_dist[1]>group_min_dist[3]?1:3; //取 1和3 最大值 |
| | | // group_mindist_index = group_min_dist[2]<group_min_dist[3]?2:3;//取 2和3 最小值 |
| | | // |
| | | // }else{ |
| | | // group_maxdist_index = group_min_dist[2]>group_min_dist[3]?2:3; //取 2和3 最大值 |
| | | // group_mindist_index = group_min_dist[1]<group_min_dist[3]?1:3;//取 1和3 最小值 |
| | | // rec_secdelay--; |
| | | //// if(lora_jianting_flag) |
| | | //// { |
| | | //// if(++group_id>GROUP_NUM) |
| | | //// { |
| | | //// group_id = 1; |
| | | //// } |
| | | //// t22[ti++] = group_id; |
| | | //// if(ti>=20) |
| | | //// ti=0; |
| | | //// group_min_dist[group_id] = 0xffff; |
| | | //// Radio.Standby(); |
| | | //// SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | //// Radio.Rx(0); |
| | | //// } |
| | | // return; |
| | | // } |
| | | //// group_id = 1; |
| | | // group_id = group_maxdist_index; |
| | | #endif |
| | | t22[ti++] = group_id; |
| | | if(ti>=20) |
| | | ti=0; |
| | | // group_min_dist[group_id] = 0xffff; |
| | | // Radio.Standby(); |
| | | //rf_antenna_close(); |
| | | // rf_set_mode(RF_MODE_STB3); |
| | | // uint32_t para; |
| | | // frqe=((UWB_CHANNEL_FRQ+group_id)*100000); |
| | | // para=freq_list[1] * 100000; |
| | | //// rf_set_default_para(frqe,UWB_CHANNEL_SF); |
| | | // rf_set_carrier_wave_off(); |
| | | //// rf_set_carrier_wave_on(); |
| | | // rf_set_freq(para); |
| | | // rf_set_sf(5); |
| | | //// rf_set_tx_power(para); |
| | | //// rf_set_carrier_wave_freq(freq_list[1] * 100000); |
| | | // //SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | // dangqian_frqe=rf_read_freq(); |
| | | // LoraSendComMap(WGRSP_RWTAG_READ); |
| | | |
| | | //delay_us(5000); |
| | | // rf_enter_continous_rx(); |
| | | //LedTask(); |
| | | //LoraHeartBeartPoll(); |
| | | // if(rf_continous_tx_send_data(tx_test_buf, TX_LEN) != OK) |
| | | // { |
| | | // while(1); |
| | | // } |
| | | // rf_get_mode(); |
| | | LoraReportPoll(); |
| | | // LedOff_task(); |
| | | //// //找3个小组中最近距离最大的小组,上传报文后切换到这个小组,因为上传报文会时间占用。 |
| | | //// if(group_min_dist[1]>group_min_dist[2]) //如果1大于2 |
| | | //// { |
| | | //// group_maxdist_index = group_min_dist[1]>group_min_dist[3]?1:3; //取 1和3 最大值 |
| | | //// group_mindist_index = group_min_dist[2]<group_min_dist[3]?2:3;//取 2和3 最小值 |
| | | //// |
| | | //// }else{ |
| | | //// group_maxdist_index = group_min_dist[2]>group_min_dist[3]?2:3; //取 2和3 最大值 |
| | | //// group_mindist_index = group_min_dist[1]<group_min_dist[3]?1:3;//取 1和3 最小值 |
| | | //// } |
| | | ////// group_id = 1; |
| | | //// group_id = group_maxdist_index; |
| | | //#endif |
| | | // t22[ti++] = group_id; |
| | | // if(ti>=20) |
| | | // ti=0; |
| | | // // group_min_dist[group_id] = 0xffff; |
| | | // // Radio.Standby(); |
| | | // //rf_antenna_close(); |
| | | //// rf_set_mode(RF_MODE_STB3); |
| | | //// uint32_t para; |
| | | //// frqe=((UWB_CHANNEL_FRQ+group_id)*100000); |
| | | //// para=freq_list[1] * 100000; |
| | | ////// rf_set_default_para(frqe,UWB_CHANNEL_SF); |
| | | //// rf_set_carrier_wave_off(); |
| | | ////// rf_set_carrier_wave_on(); |
| | | //// rf_set_freq(para); |
| | | //// rf_set_sf(5); |
| | | ////// rf_set_tx_power(para); |
| | | ////// rf_set_carrier_wave_freq(freq_list[1] * 100000); |
| | | //// //SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | //// dangqian_frqe=rf_read_freq(); |
| | | // // LoraSendComMap(WGRSP_RWTAG_READ); |
| | | // |
| | | // //delay_us(5000); |
| | | //// rf_enter_continous_rx(); |
| | | // //LedTask(); |
| | | // //LoraHeartBeartPoll(); |
| | | //// if(rf_continous_tx_send_data(tx_test_buf, TX_LEN) != OK) |
| | | //// { |
| | | //// while(1); |
| | | //// } |
| | | // // rf_get_mode(); |
| | | //// LoraReportPoll(); |
| | | // // LedOff_task(); |
| | | |
| | | } |
| | | } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | } |
| | | uint8_t TX_RX_SELECT=0; |
| | | // |
| | | //} |
| | | //uint8_t TX_RX_SELECT=0; |
| | | |
| | | int LORA_3029_SINGLE_SEND(uint8_t *buffer, uint8_t size,uint8_t time) |
| | | { |
| | | if((rf_single_tx_data(lora_sendbuffer,size,time))!= OK) |
| | | { |
| | | while(1); |
| | | } |
| | | rf_delay_us(1); |
| | | |
| | | //rf_enter_single_rx(); |
| | | //rf_enter_single_timeout_rx(700); |
| | | } |
| | | //int LORA_3029_SINGLE_SEND(uint8_t *buffer, uint8_t size,uint8_t time) |
| | | //{ |
| | | // if((rf_single_tx_data(lora_sendbuffer,size,time))!= OK) |
| | | // { |
| | | // while(1); |
| | | // } |
| | | // rf_delay_us(1); |
| | | // |
| | | // //rf_enter_single_rx(); |
| | | // //rf_enter_single_timeout_rx(700); |
| | | //} |
| | | |
| | | int LORA_3029_CONTINOUS_SEND(uint8_t *buffer, uint8_t size) |
| | | { |
| | | //int LORA_3029_CONTINOUS_SEND(uint8_t *buffer, uint8_t size) |
| | | //{ |
| | | |
| | | |
| | | } |
| | | //} |
| | | |
| | | |
| | | |