| | |
| | | extern uint8_t stationary_flag; |
| | | extern uint8_t SOS_KEY_STATE; |
| | | uint32_t LORA_POLL_COUNT=0; |
| | | uint8_t test1,test2; |
| | | #define GET_USERKEY gpio_pin_get_val(SOS_PIN) |
| | | void LoraReportPoll(void) |
| | | { |
| | |
| | | LoraReportFreqPoll(); |
| | | flag_getwgresp = 0; |
| | | // wg_report_freq = REPORT_MANGE_CHANNEL_FRQ; |
| | | SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]); |
| | | //LOG_INFO(TRACE_MODULE_APP," 切换2\r\n"); |
| | | //test1++; |
| | | SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,22); |
| | | if(heatbeat_count++>HEATBEAT_UPDATE_TIME && WG_Connected == wg_state) //如果心跳包到达上传时间,并且网关处于链接状态,就上传心跳包 |
| | | { |
| | | heatbeat_count = 0; |
| | |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2); |
| | | checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum+ANCID_IDX); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*4],&checksum,2); |
| | | // test2++; |
| | | Radio.Send(lora_sendbuffer,ANCID_IDX+report_ancnum*4+2); |
| | | |
| | | |
| | |
| | | { |
| | | // gpio_pin_set(IO_PIN_5); |
| | | |
| | | |
| | | // if(lora_send_count++%10==0||lora_jianting_flag) |
| | | if(lora_send_count++%10==0||lora_jianting_flag) |
| | | { |
| | | sum_count++; |
| | |
| | | if(!no_rx_flag) |
| | | { |
| | | if(lora_jianting_flag&&LoraUp_flag==0) |
| | | { |
| | | { //LOG_INFO(TRACE_MODULE_APP," 切换2\r\n"); |
| | | SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | Radio.Rx(0); |
| | | } |
| | |
| | | Radio.Standby(); |
| | | if(lora_jianting_flag) |
| | | { |
| | | //LOG_INFO(TRACE_MODULE_APP," 切换3\r\n"); |
| | | SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | Radio.Rx(0); |
| | | } |
| | |
| | | |
| | | if(lora_jianting_flag) |
| | | { |
| | | //LOG_INFO(TRACE_MODULE_APP," 切换4\r\n"); |
| | | SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | Radio.Rx(0); |
| | | } |
| | |
| | | Radio.Standby(); |
| | | if(lora_jianting_flag) |
| | | { |
| | | //LOG_INFO(TRACE_MODULE_APP," 切换5\r\n"); |
| | | SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | Radio.Rx(0); |
| | | } |