zhangbo
2025-03-13 367aa5722f83a17dcfe586726af74fef72db0081
keil/include/main/main.c
@@ -275,7 +275,7 @@
        MinuteTask();
    }
    //UWB更新列表
    TagListUpdate();
//    TagListUpdate();
    //GPS_Poll();
      gps_power_state=1;//测试gps长开
    //UWB状态检测
@@ -297,7 +297,7 @@
        }
    }
//    HIDO_TimerTick();
    HIDO_TimerTick();
    nomove_count++;
}
uint8_t flag_sleeptimer,flag_secondtask,secondtask_count;
@@ -306,13 +306,14 @@
static void sleep_timer_callback(void *dev, uint32_t time)
{
    g_start_send_flag=1;
//     HIDO_TimerGetTick();
     HIDO_TimerTick();
   //      #ifdef DEBUG_BOXING
////      gpio_pin_clr(IO_PIN_5);//测试
   //   gpio_pin_set(IO_PIN_5);//测试
     // lora_wg_up=1;
      
      lora_tx_flag=1;
      lora_tx_flag++;
//      lora_qiehuan++;
//    IO_control_init();
//    UWBPoll();
@@ -384,7 +385,6 @@
//    g_com_map[GROUP_ID]=1;
    dev_id=g_com_map[DEV_ID];//这里不太对
    group_id=g_com_map[GROUP_ID];//组ID
     g_com_map[LORA_POWER]=22;
    tag_frequency = 1000/g_com_map[COM_INTERVAL];//测距频率这个存的是测距时间
    memcpy(&disoffset,&g_com_map[DIST_OFFSET],2);
//    g_com_map[ALARM_DISTANCE1] = 40;
@@ -556,7 +556,31 @@
/********************************************************************************************************/
/********************************************************************************************************/
/********************************************************************************************************/
//static uint16_t delaytime = 771;
//extern uint16_t wg_report_freq,wg_report_id;
//extern uint32_t wg_lost_count;
//extern uint8_t shengji_flag;
//extern uint8_t lora_jianting_flag,report_ancnum;
//uint8_t imu_enable,motor_enable;
//uint32_t time_flag_lorarx=0;
//uint32_t lora_huanxing_count=0;
//uint16_t Lora_wangguanid=0;
//wg_state_enum wg_state = WG_Lost;
//uint16_t wangguan_up_id;
//uint8_t LoraUp_flag;
//uint16_t rec_wenjian_daxiao;
//uint16_t recnum[3];
//uint16_t recv_flag=0;
//uint16_t tx_flag=0;
//uint16_t CRC16=0;
//uint16_t DEST_ID=0;
//uint16_t rec_value,rec_delaytime,rx_count,datalen_offset;
//uint16_t Loratx_flag=0;
//uint16_t Lorarx_flag=0;
//uint16_t Lorarx_time_out_flag=0;
//uint8_t tx_buf[5]={0,1,0,1,1};
//uint32_t sleep_time_count=0;
//uint32_t uwb_ceju_count=0;
wg_state_enum wg_state = WG_Lost;
/********************************************************************************************************/
static void Lora_irq_handler(enum IO_PIN_T pin)
@@ -564,17 +588,12 @@
   RadioIrqProcess();            
}
void Board_LORA_NVIC_Init(GPIO_IRQ_HANDLER_T irq_handler)  //LORA 中断配置
{
//        io_pin_mux_set(_4G_USART_RX_Pin,IO_FUNC0);//把原先io 变为普通GPIO
      gpio_pin_set_dir(LORA_DIO , GPIO_DIR_IN, 0);
      io_pull_set(LORA_DIO, IO_HIGH_Z, IO_PULL_UP_NONE);
        gpio_enable_irq(LORA_DIO, GPIO_IRQ_TYPE_RISING_EDGE, irq_handler);
    gpio_enable_irq(LORA_DIO, GPIO_IRQ_TYPE_RISING_EDGE, irq_handler);
}
extern uint8_t pca9555writedata_input[10];//暂存输入寄存器所有配置的数组
static void pca_handler(enum IO_PIN_T pin)
@@ -588,7 +607,6 @@
uint8_t TXBuffer[8]={0,1,2,3,4,5,6,7};
uint8_t test_buf[10]={0,1,1,1,1,1,1,1,1,1};
int main(void)
{
    board_clock_run();
      //  boot_deinit();
@@ -610,21 +628,19 @@
    Accelerometer_Init();
      PCA9555_init();
      Lora_1268_Init();
//    SwitchLoraSettings(473,7,0);
    SwitchLoraSettings(478,7,22);
      Program_Init();
    sleep_timer_open(true, SLEEP_TIMER_MODE_RELOAD, sleep_timer_callback);
      sleep_timer_start(__MS_TO_32K_CNT(1000));//测试
    
    Uwbinit();
      OpenUWB();
    while (1)
    { 
       Lora_Tx_Poll();
//         uwb_app_poll();
         uwb_app_poll();
      IdleTask();
    }
}