yincheng.zhong
2024-03-08 d67d922c6345042cb3dfaedd621a2120fe808b70
Src/application/beep_logic_app.c
@@ -15,66 +15,66 @@
int32_t min_dist;
void main_logic(void)   //主逻辑在这里执行
{
   static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime;
   int16_t i;
   //除UWB之外的其他代码...
   static uint16_t beep_judge_cnt = 0;
   if(beep_judge_cnt++ >= 100)
   {
      beep_judge_cnt = 0;
      min_dist=0x7fffff;
      for(i = 0; i < 255;i++)
      {
         if(g_Tagdist[i] < min_dist)
         {
            min_dist=g_Tagdist[i];
         }
      }
      if(min_dist <= g_com_map[ALARM_DISTANCE1])
      {
         beep_ontime = ONTIME1;
         beep_offtime = OFFTIME1;
         beep_state=1;
         RELAY1_ON;
         RELAY2_ON;
      }
      else if (min_dist <= g_com_map[ALARM_DISTANCE2])
      {
         beep_ontime = ONTIME2;
         beep_offtime = OFFTIME2;
         beep_state=1;
         RELAY2_ON;
      }
      //else if (min_dist <= g_com_map[ALARM_DISTANCE3])
    static uint8_t beep_state,timer_state,beep_timer,beep_ontime,beep_offtime;
    int16_t i;
    //除UWB之外的其他代码...
    static uint16_t beep_judge_cnt = 0;
    if(beep_judge_cnt++ >= 100)
    {
        beep_judge_cnt = 0;
        min_dist=0x7fffff;
        for(i = 0; i < 255; i++)
        {
            if(g_Tagdist[i] < min_dist)
            {
                min_dist=g_Tagdist[i];
            }
        }
        if(min_dist <= g_com_map[ALARM_DISTANCE1])
        {
            beep_ontime = ONTIME1;
            beep_offtime = OFFTIME1;
            beep_state=1;
            RELAY1_ON;
            RELAY2_ON;
        }
        else if (min_dist <= g_com_map[ALARM_DISTANCE2])
        {
            beep_ontime = ONTIME2;
            beep_offtime = OFFTIME2;
            beep_state=1;
            RELAY2_ON;
        }
        //else if (min_dist <= g_com_map[ALARM_DISTANCE3])
//      {
//         beep_ontime = ONTIME3;
//         beep_offtime = OFFTIME3;
//         beep_state=1;
//      }
      else{
         beep_state=0;
      }
      if (min_dist >= g_com_map[ALARM_DISTANCE1]+20)
      {
         RELAY1_OFF;
      }
      if (min_dist >= g_com_map[ALARM_DISTANCE2]+20)
      {
         RELAY2_OFF;
      }
//
        else {
            beep_state=0;
        }
        if (min_dist >= g_com_map[ALARM_DISTANCE1]+20)
        {
            RELAY1_OFF;
        }
        if (min_dist >= g_com_map[ALARM_DISTANCE2]+20)
        {
            RELAY2_OFF;
        }
//
//      if(beep_state==1)
//      {
//         if(timer_state==1)
//         {
//            if(beep_timer++ < beep_ontime)
//            {
//               switch(g_com_map[ALARM_DEV])
//               switch(g_com_map[ALARM_DEV])
//                     {
//                        case 0:
//                           BEEP2_ON;
@@ -96,7 +96,7 @@
//                           BEEP_ON;
//                           OUT2_ON;
//                           break;
//                     }
//                     }
//            }else{
//               timer_state=0;
//               beep_timer=0;
@@ -104,7 +104,7 @@
//         }else{
//             if(beep_timer++ < beep_offtime)
//               {
//                  switch(g_com_map[ALARM_DEV])
//                  switch(g_com_map[ALARM_DEV])
//                     {
//                        case 0:
//                           BEEP2_OFF;
@@ -125,11 +125,11 @@
//                     timer_state=1;
//                     beep_timer=0;
//               }
//
//
//         }
//
//
//      }   else {
//         switch(g_com_map[ALARM_DEV])
//         switch(g_com_map[ALARM_DEV])
//         {
//            case 0:
//               BEEP2_OFF;
@@ -147,8 +147,8 @@
//               break;
//         }
//      }
   }
}
    }
}