| | |
| | | int32_t target_count; |
| | | extern uint16_t motor_keeptime; |
| | | uint8_t shengji_flag; |
| | | |
| | | void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ) |
| | | { uint16_t checksum1; |
| | | BufferSize = size; |
| | |
| | | lora_up_rec_flag=1; |
| | | if(RX_Buffer[MSG_TYPE_IDX]==LORA_MSGTYPE_RANGEPOLL) |
| | | { |
| | | |
| | | // HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET); |
| | | UWB_Wkup(); |
| | | // HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_SET); |
| | | MbxTagUwbRec(); |
| | | // HAL_GPIO_WritePin(RADIO_NSS_GPIO_Port, RADIO_NSS_Pin, GPIO_PIN_RESET); //片选lora有效 |
| | | Radio.Rx(0); |
| | | // Radio.Rx(0); |
| | | } |
| | | if(RX_Buffer[MSG_TYPE_IDX]==LORA_MSGTYPE_WGRESPTAG) |
| | | { |
| | |
| | | while(target_count>=32768) |
| | | target_count-=32768; |
| | | __HAL_LPTIM_COMPARE_SET(&hlptim1, target_count); |
| | | rx_count = HAL_LPTIM_ReadCounter(&hlptim1); |
| | | // rx_count = HAL_LPTIM_ReadCounter(&hlptim1); |
| | | // printf("tx %d,rx %d,delay %d",current_count>>5,rx_count>>5,rec_delaytime); |
| | | break; |
| | | case WGRSP_RWTAG_READ: |
| | |
| | | {}//文件过大,超出范围 |
| | | else |
| | | { |
| | | memcpy(&wangguan_up_id,&RX_Buffer[SOURCE_ID_IDX],2);//网关ID 占用2个字节 |
| | | shengji_flag=1; |
| | | LoraUp_flag=1; |
| | | imu_enable=0; |
| | | memcpy(&wangguan_up_id,&RX_Buffer[SOURCE_ID_IDX],2);//网关ID 占用2个字节 |
| | | shengji_flag=1; |
| | | LoraUp_flag=1; |
| | | imu_enable=0; |
| | | } |
| | | // LoraUp_Poll(); |
| | | break; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | if(!no_rx_flag) |
| | | { |
| | | if(lora_jianting_flag&&LoraUp_flag==0) |
| | |
| | | Radio.Rx(0); |
| | | } |
| | | } |
| | | } |
| | | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET); |
| | | |
| | | } |
| | |
| | | if(shengji_flag) |
| | | { |
| | | // memcpy(&wangguan_up_id,&RX_Buffer[SOURCE_ID_IDX],2);//网关ID 占用2个字节 |
| | | send_lora_data[MSG_TYPE_IDX]=LORA_MSGTYPE_UPDATE_CONFIRM; |
| | | send_lora_data[MSG_TYPE_IDX]=LORA_MSGTYPE_UPDATE_CONFIRM2; |
| | | memcpy(&send_lora_data[SOURCE_ID_IDX],&dev_id,2);//网关ID 占用2个字节 |
| | | memcpy(&send_lora_data[DEST_ID_IDX],&wangguan_up_id,2);//标签或者基站的设备ID 2个字节 |
| | | // send_lora_data[MUQIAN_BAG]=0xFF; |