yincheng.zhong
2024-02-29 69228ec57fb8539f6bf9f3f085fde635bb71499f
Src/application/dw_mbx_tag.c
@@ -264,21 +264,18 @@
u8 flag_getwgresp;
void LoraHeartBeartPoll(void)
{
    LoraReportFreqPoll();
    flag_getwgresp = 0;
    SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]);
    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);
    memcpy(&lora_sendbuffer[HB_UWBPOWER_IDX],&g_com_map[POWER],2);
    memcpy(&lora_sendbuffer[HB_LORAPOWER_IDX],&g_com_map[POWER],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);
    Radio.Send(lora_sendbuffer,16);
}
uint16_t heatbeat_count = 3598;
uint16_t heatbeat_count = 3600;
#define HEATBEAT_UPDATE_TIME   3600
void LoraReportPoll(void)
{
@@ -288,6 +285,7 @@
    
    LoraReportFreqPoll();
    flag_getwgresp = 0;
  //  wg_report_freq = REPORT_MANGE_CHANNEL_FRQ;
    SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]);
   if(heatbeat_count++>HEATBEAT_UPDATE_TIME && WG_Connected == wg_state) //如果心跳包到达上传时间,并且网关处于链接状态,就上传心跳包
    {
@@ -297,10 +295,12 @@
    }
#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
    lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+30;
    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++;