| | |
| | | uint8_t Lora_rx_open_flag; |
| | | extern u32 Loratx_frequency; |
| | | |
| | | uint8_t flag_writepara_needreset = 0,wg_lost_count; |
| | | uint8_t flag_writepara_needreset = 0; |
| | | uint32_t wg_lost_count; |
| | | uint32_t lora_zhuangtai; |
| | | uint16_t current_count; |
| | | extern wg_state_enum wg_state; |
| | |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader |
| | | } |
| | | Radio.Standby(); |
| | | Radio.Rx( 10 ); |
| | | if(wg_lost_count++>3) |
| | | { |
| | | wg_state = WG_Lost; |
| | | } |
| | | Radio.Rx( 50 ); |
| | | LED_TB_OFF; |
| | | } |
| | | extern LPTIM_HandleTypeDef hlptim1; |
| | | uint16_t current_time,start_time,end_time; |
| | |
| | | Radio.Send(lora_sendbuffer,data_length+11); |
| | | // Delay_Ms(100); |
| | | } |
| | | static uint16_t delaytime = 1125; |
| | | static uint16_t delaytime = 1050; |
| | | static uint16_t source_id; |
| | | uint8_t rec_index; |
| | | uint16_t rec_value,rec_delaytime,target_count,rx_count; |
| | | uint16_t rec_value,rec_delaytime,rx_count; |
| | | int16_t target_count; |
| | | void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ) |
| | | { |
| | | BufferSize = size; |
| | |
| | | current_count = HAL_LPTIM_ReadCounter(&hlptim1); |
| | | wg_report_freq = RX_Buffer[POLL_FREQ_IDX]+400; |
| | | memcpy(&rec_delaytime,&RX_Buffer[NEXTPOLL_TIME_IDX],2); |
| | | target_count = current_count + rec_delaytime*32.8 - delaytime; |
| | | target_count = current_count + rec_delaytime*3.2768 - delaytime; |
| | | if(target_count>=32768) |
| | | target_count-=32768; |
| | | __HAL_LPTIM_COMPARE_SET(&hlptim1, target_count); |
| | |
| | | void OnRxTimeout( void ) |
| | | { |
| | | Radio.Standby(); |
| | | current_count = HAL_LPTIM_ReadCounter(&hlptim1); |
| | | target_count-=current_count%3276; |
| | | if(target_count<0) |
| | | target_count+=32768; |
| | | __HAL_LPTIM_COMPARE_SET(&hlptim1, target_count); |
| | | SwitchLoraSettings(UWB_CHANNEL_FRQ+g_com_map[GROUP_ID],UWB_CHANNEL_SF,0); |
| | | Radio.Rx(0); |
| | | } |
| | | |
| | | void OnRxError( void ) |