chen
6 天以前 93598c8946047bddd783f761c9238a9c227b876c
修复lora只有很近才能有信号问题,g_com_map[power]值设置不对
已修改2个文件
16 ■■■■ 文件已修改
keil/include/main/main.c 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/src/Radio/lora_1268.c 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/main/main.c
@@ -491,6 +491,7 @@
        LOG_INFO(TRACE_MODULE_APP,"固件版本:MK_免布线模式 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
        uart0_Init_normal();
        Lora_1268_Init();
//         LOG_INFO(TRACE_MODULE_APP," 切换6\r\n");
        SwitchLoraSettings(478,7,22);
        Uwb_init();//默认为我们测距配置
        OpenUWB();
keil/include/src/Radio/lora_1268.c
@@ -184,6 +184,7 @@
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)
{
@@ -200,7 +201,9 @@
    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;
@@ -253,6 +256,7 @@
    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);
@@ -340,8 +344,8 @@
    {
//            gpio_pin_set(IO_PIN_5);
            
        if(lora_send_count++%10==0||lora_jianting_flag)
// if(lora_send_count++%10==0||lora_jianting_flag)
       if(lora_send_count++%10==0||lora_jianting_flag)
        {
                    sum_count++;
            lora_tx_flag=0;
@@ -592,7 +596,7 @@
    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);
        }
@@ -605,6 +609,7 @@
    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);
    }
@@ -616,6 +621,7 @@
    
    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);
    }
@@ -628,6 +634,7 @@
    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);
    }