| | |
| | | Radio.Send(lora_sendbuffer,data_length+11); |
| | | // Delay_Ms(100); |
| | | } |
| | | extern u8 lora_jianting_flag; |
| | | static uint16_t delaytime = 1050; |
| | | extern u8 lora_jianting_flag,report_ancnum; |
| | | static uint16_t delaytime = 771; |
| | | static uint16_t source_id; |
| | | uint8_t rec_index; |
| | | uint16_t rec_value,rec_delaytime,rx_count; |
| | | uint16_t rec_value,rec_delaytime,rx_count,datalen_offset; |
| | | int32_t target_count; |
| | | extern uint16_t motor_keeptime; |
| | | void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ) |
| | | { |
| | | { uint16_t checksum1; |
| | | BufferSize = size; |
| | | memcpy( RX_Buffer, payload, BufferSize ); |
| | | RssiValue = rssi; |
| | |
| | | } |
| | | if(RX_Buffer[MSG_TYPE_IDX]==LORA_MSGTYPE_WGRESPTAG) |
| | | { |
| | | checksum1=Checksum_u16(RX_Buffer,BufferSize-2); |
| | | |
| | | if(!memcmp(&checksum1,&RX_Buffer[BufferSize-2],2)) |
| | | if(!memcmp(&dev_id,&RX_Buffer[DEST_ID_IDX],2)) |
| | | { |
| | | memcpy(&source_id,&RX_Buffer[SOURCE_ID_IDX],2); |
| | |
| | | case WGRSP_RWTAG_NONE: |
| | | 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*3.2768 - delaytime; |
| | | memcpy(&rec_delaytime,&RX_Buffer[NEXTPOLL_TIME_IDX],2); |
| | | if(report_ancnum<2) |
| | | { |
| | | datalen_offset = report_ancnum*85; |
| | | }else{ |
| | | datalen_offset = (report_ancnum-1)*46+85; |
| | | } |
| | | |
| | | target_count = current_count + rec_delaytime*3.2768 - delaytime-datalen_offset; |
| | | while(target_count>=32768) |
| | | target_count-=32768; |
| | | __HAL_LPTIM_COMPARE_SET(&hlptim1, target_count); |