Sfoglia il codice sorgente

FRBT 위치 변경 , AGC/ ALC 동작 알고리즘 수정 / 반올림 함수 추가 /

PYJ 4 anni fa
parent
commit
689eb6deb6
3 ha cambiato i file con 126 aggiunte e 64 eliminazioni
  1. 120 61
      Bluecell_Src/Bluecell_operate.c
  2. 5 2
      Bluecell_Src/uart.c
  3. 1 1
      Src/main.c

+ 120 - 61
Bluecell_Src/Bluecell_operate.c

@@ -1717,7 +1717,7 @@ void MBIC_TableSave(uint8_t* data,uint8_t type){
1717 1717
             Temp_DL1.Table_Length= data[MBIC_PAYLOADSTART + MBIC_TableIndex_Length];
1718 1718
             EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_DET_UL4_TABLE_ADDRESDS),&Temp_DL1.Table_1_Temp,sizeof(TEMP_TABLE_st));                    
1719 1719
             MBIC_TableHeaderCopy(&data[MBIC_PAYLOADSTART + 5],sizeof(ATT_TABLE_st));   
1720
-            printf("Temp_DL1 Length : %d \r\n",data[MBIC_PAYLOADSTART + MBIC_TableIndex_Length]);
1720
+//            printf("Temp_DL1 Length : %d \r\n",data[MBIC_PAYLOADSTART + MBIC_TableIndex_Length]);
1721 1721
 
1722 1722
             break;
1723 1723
         case DLI_P2_ATT_Temp_guarantee_Table_Number:
@@ -2056,7 +2056,8 @@ void SelfTest_Operate(uint8_t onoff){
2056 2056
         Prev_PathStatus[ATT_UL_PATH4] = bluecell_Currdatastatus.ATT_UL4_PATH;        
2057 2057
         bluecell_Currdatastatus.Carrier_ON_OFF = onoff; 
2058 2058
 //        printf("ALC AGC OFF\r\n");
2059
-    }else{
2059
+    }
2060
+    else{
2060 2061
         bluecell_Currdatastatus.ULO_ALC_ON_OFF = Prev_ALC_OnOff;
2061 2062
         bluecell_Currdatastatus.DLI_AGC_ON_OFF = Prev_AGC_OnOff;
2062 2063
         bluecell_Currdatastatus.DLI_Shutdown_ON_OFF = Prev_DL_Shutdown_OnOff;
@@ -2077,9 +2078,10 @@ void SelfTest_Operate(uint8_t onoff){
2077 2078
           bluecell_Currdatastatus.ULO_Shutdown_Retry_Count1 = Prev_ShutdownCnt[ATT_UL_ShutdownCnt1];
2078 2079
           bluecell_Currdatastatus.ULO_Shutdown_Retry_Count2 = Prev_ShutdownCnt[ATT_UL_ShutdownCnt2];
2079 2080
           bluecell_Currdatastatus.ULO_Shutdown_Retry_Count3 = Prev_ShutdownCnt[ATT_UL_ShutdownCnt3];
2080
-          bluecell_Currdatastatus.ULO_Shutdown_Retry_Count4 = Prev_ShutdownCnt[ATT_UL_ShutdownCnt4];        
2081
+          bluecell_Currdatastatus.ULO_Shutdown_Retry_Count4 = Prev_ShutdownCnt[ATT_UL_ShutdownCnt4];   
2081 2082
     }
2082 2083
     Path_Ctrl(onoff,&Prev_PathStatus);
2084
+    
2083 2085
 }
2084 2086
 
2085 2087
 bool Bluecell_Operate(uint8_t* data){
@@ -5137,7 +5139,7 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
5137 5139
 //    Alarm_ReportData[MBIC_PAYLOADSTART + 1] = Alarm_type;    
5138 5140
 //    Alarm_ReportData[MBIC_PAYLOADSTART + 2] = val;        
5139 5141
     
5140
-    printf("%s \r\n",&Alarm_ReportData[MBIC_PAYLOADSTART + 22]);
5142
+//    printf("%s \r\n",&Alarm_ReportData[MBIC_PAYLOADSTART + 22]);
5141 5143
 //    printf("Type : %x  size length : %d \r\n",Alarm_type,sizeof(Alarm_ReportData));
5142 5144
 //    MBIC_HeaderMergeFunction(Alarm_ReportData,ALARM_REPORT_LENGTH);
5143 5145
     Alarm_ReportData[MBIC_PREAMBLE_0] = MBIC_PREAMBLE0;
@@ -5186,7 +5188,7 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
5186 5188
     Alarm_ReportData[MBIC_PAYLOADSTART + 44] = 0x03; 
5187 5189
 //        printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 43] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 43]);    
5188 5190
     Uart1_Data_Send(&Alarm_ReportData[0],sizeof(Alarm_ReportData));
5189
-    printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 42] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 42]);
5191
+//    printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 42] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 42]);
5190 5192
 }
5191 5193
 
5192 5194
 bool MBIC_Operate(uint8_t* data){
@@ -5758,7 +5760,7 @@ bool MBIC_Operate(uint8_t* data){
5758 5760
                     UL_ALC_GainAttenSet[ALC_Alarm_UL4_Index] = true;
5759 5761
                     ALC_Level_Save[ALC_Alarm_UL4_Index] = bluecell_Currdatastatus.ULO_Level4_H << 8 | bluecell_Currdatastatus.ULO_Level4_L  ;                      
5760 5762
                 }
5761
-                printf("data ctrl\r\n");
5763
+//                printf("data ctrl\r\n");
5762 5764
                 CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
5763 5765
 
5764 5766
                 break;
@@ -7521,6 +7523,8 @@ void ADC_Check(void){
7521 7523
     uint16_t MIN_ADC[ADC3_CNT] = {0,};
7522 7524
     uint16_t cnt[ADC3_CNT] = {0,};
7523 7525
     double temp;
7526
+    if(bluecell_Currdatastatus.SelfTest == true)
7527
+        return;
7524 7528
     
7525 7529
 //    if(AdcTimerCnt > 10){
7526 7530
     // 정렬할 배열, 요소 개수, 요소 크기, 비교 함수를 넣어줌
@@ -8260,29 +8264,18 @@ void ALC_Alarm_TimerSet(uint8_t num,int16_t threshold,double CurrDet,int16_t Att
8260 8264
 //        CurrAtten,MainAtten,threshold,CurrDet);
8261 8265
 //        printf("ALC_AlarmSet[%d] %d \r\n",num,ALC_AlarmSet[num]);
8262 8266
 }
8263
-double HFR_CntUpCalc(double ret){
8264
-    double origin = ret;
8265
-    int16_t calctmp = 0;
8266
-//    printf("+++++++++++++++++++++++++++++++++++++++++\r\n");
8267
-    ret *= -1;
8268
-//    printf("CALC VALUE : %f \r\n",ret);
8269
-    ret *= 10;
8270
-    calctmp = ret;
8271
-//    printf("1. ret : %f \r\n",ret);
8272
-    calctmp %= 10;
8273
-//    printf("2. ret : %f \r\n",ret);
8274
-    
8267
+#if 1 // PYJ.2020.10.23_BEGIN -- 
8268
+int HFR_CntUpCalc(double ret){
8269
+
8270
+    if(ret > 0)
8271
+        ret += 0.4;
8272
+    else
8273
+        ret -= 0.4;
8275 8274
     
8276
-    if(calctmp >= 6){
8277
-//        printf("minus return \r\n");
8278
-        origin = (origin -1) + (calctmp  * 0.1);
8279
-    }else{
8280
-        origin += (calctmp  * 0.1);
8281
-//        printf("ZERO return \r\n");        
8282
-    }
8283
-//    printf("HFR RET : %f \r\n",origin);
8284
-    return origin;
8275
+
8276
+    return ret;
8285 8277
 }
8278
+#endif // PYJ.2020.10.23_END -- 
8286 8279
 typedef enum{
8287 8280
     ULO_ALC_H = 0,
8288 8281
     ULO_ALC_L,
@@ -8304,7 +8297,7 @@ void ALC_Package_Operate(uint8_t*ULO_ADC_Level,uint8_t* ULO_Level,DET_TABLEUL_st
8304 8297
     int16_t UL_Atten = 0;
8305 8298
     int16_t Main_Atten = 0;
8306 8299
     int16_t GiveAttenPlusULAtten = 0;
8307
-
8300
+    int16_t Plus_ResultData = 0;
8308 8301
     if(*retrycnt > 0)
8309 8302
         return;
8310 8303
     
@@ -8334,11 +8327,13 @@ void ALC_Package_Operate(uint8_t*ULO_ADC_Level,uint8_t* ULO_Level,DET_TABLEUL_st
8334 8327
     printf("=============ALC ON =====START================\r\n");
8335 8328
     printf("Current UL ADC VALUE : %f \r\n",ret);
8336 8329
     printf("ResdBm : UL%d : %f \r\n",TableIndex + 1,ResdBm);    
8337
-    printf("ORIGIN ResdBm : %f  %d\r\n",ResdBm,Main_Atten);
8338
-    printf("After ResdBm : %f \r\n",ResdBm);
8330
+//    printf("ORIGIN ResdBm : %f  %d\r\n",ResdBm,Main_Atten);
8331
+//    printf("After ResdBm : %f \r\n",ResdBm);
8339 8332
 #endif // PYJ.2020.10.19_END -- 
8340 8333
     
8341
-    ResultData = HFR_CntUpCalc(ResdBm); 
8334
+    ResultData = Bluecell_RoundCalc(ResdBm); 
8335
+    Plus_ResultData = HFR_CntUpCalc(ResdBm);
8336
+
8342 8337
     int HFR_Dot5 = ((int)(ResdBm * 10) % 10);
8343 8338
 
8344 8339
     
@@ -8363,7 +8358,9 @@ void ALC_Package_Operate(uint8_t*ULO_ADC_Level,uint8_t* ULO_Level,DET_TABLEUL_st
8363 8358
 //    printf("STEP 2 : I WILL GIVE ATTEN PLUS  ALC ATTEN  %d \r\n",IwillGiveAtten);    
8364 8359
 //    printf("STEP 3 :ResdBm : %f (Limitdata - 1) : %d   HFR_Dot5  %d \r\n",ResdBm,(Limitdata - 1),HFR_Dot5);    
8365 8360
     
8366
-    if((ResultData <= (Limitdata - 1)) ) {
8361
+    if((Plus_ResultData <= (Limitdata - 2 )) ) {
8362
+//        printf("ResultData : %d \r\n",Plus_ResultData);
8363
+//        printf("(Limitdata - 2 - 0.1) : %f \r\n",(Limitdata - 2));
8367 8364
         if(IwillGiveAtten <= -10){
8368 8365
             IwillGiveAtten += 10;
8369 8366
         }
@@ -8472,7 +8469,7 @@ void ALC_Function(){ //DL
8472 8469
 //    Bluecell_StructCpy(&AutoControl_Save[0],&UL_DET_Table_ref[TABLE_MAX_VALUE],sizeof(ALC_dBm_t));
8473 8470
 //    Bluecell_StructCpy(&tempadc[0],&Det_UL1.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
8474 8471
     if(ALCTimerCnt > 500){
8475
-        if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true){
8472
+        if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true && bluecell_Currdatastatus.SelfTest == false){
8476 8473
             UL_Atten[ALC_Alarm_UL1_Index] = bluecell_Currdatastatus.MBIC_ULO_ALC_Atten1_H << 8 | bluecell_Currdatastatus.MBIC_ULO_ALC_Atten1_L;
8477 8474
             UL_Atten[ALC_Alarm_UL2_Index] = bluecell_Currdatastatus.MBIC_ULO_ALC_Atten2_H << 8 | bluecell_Currdatastatus.MBIC_ULO_ALC_Atten2_L;
8478 8475
             UL_Atten[ALC_Alarm_UL3_Index] = bluecell_Currdatastatus.MBIC_ULO_ALC_Atten3_H << 8 | bluecell_Currdatastatus.MBIC_ULO_ALC_Atten3_L;
@@ -8618,22 +8615,38 @@ void AGC_Alarm_Check(uint8_t Path_Index,double AGC_Det,uint8_t* AGC_Table,uint16
8618 8615
 }
8619 8616
 
8620 8617
 
8618
+int Bluecell_RoundCalc(double data){
8619
+    int ret = 0;
8620
+    if(data > 0){
8621
+        ret = data + 0.5;
8622
+    }
8623
+    else{
8624
+        ret = data - 0.5;
8625
+    }
8626
+
8627
+    return ret;
8628
+}
8629
+#define AGC_PRINT 0
8621 8630
 #if 1 // PYJ.2020.06.27_BEGIN -- 
8622 8631
 void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tableindex,uint8_t* DLI_ADC_Level,uint8_t* DLI_Level,DET_TABLEDL_st* DL_Table,uint8_t* FRBT){
8623 8632
         double ret = 0;
8633
+        int Round_ResdBm_Ret =0;
8624 8634
         int16_t ResdBm = 0;
8625 8635
         double Temp_ResdBm = 0;
8636
+        static double Prev_ResdBm = 0;
8637
+        static uint8_t Prev_Dcrease_Increase_Status = 0;        
8638
+        static uint8_t Dcrease_Increase_Status = 0;
8626 8639
         int16_t CurrAtten = 0;
8627 8640
         int16_t Levelret = 0;
8628 8641
         int i = 0;
8629 8642
         int16_t Limitdata = 0;
8630 8643
         int16_t IwillgiveAtten = 0;
8644
+        static int16_t PrevIwillgiveAtten = 0;        
8631 8645
         int16_t ResultData = 0;
8632 8646
         int8_t* AGC_Table;// = &DL_DET_Table_ref[MBIC_Table_DL1_INDEX][TABLE_MAX_VALUE];
8633 8647
         int16_t FRBT_Atten = 0;
8634
-
8635
-
8636
-        
8648
+        static int16_t RefValue = 0;
8649
+        static int8_t Gurantee = 0;
8637 8650
         FRBT_Atten =  FRBT[DLI_AGC_H] << 8 | FRBT[DLI_AGC_L];   
8638 8651
         FRBT_Atten *= 0.1;
8639 8652
         
@@ -8648,10 +8661,13 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8648 8661
 
8649 8662
         CurrAtten = (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 |  DL_MainAtten[DLI_AGC_L]);
8650 8663
         CurrAtten *= 0.1;
8664
+//        printf("Apply 1 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 |  DL_MainAtten[DLI_AGC_L]));        
8651 8665
         ResdBm = (int16_t)(DLI_Level[DLI_AGC_H] << 8 |  DLI_Level[DLI_AGC_L]) * 10;//(int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&DL_Table->Table_Det5_dBm_H,DL_Table->Table_Length,AGC_Table));
8652 8666
         Temp_ResdBm = ResdBm *0.01 ;
8653 8667
 //        printf("ResdBm %d \r\n",ResdBm);
8654 8668
         ResdBm = (int16_t)Bluecell_TestPro(ResdBm/10);
8669
+        int HFR_Dot5 = ((int)(Temp_ResdBm * 10) % 10);
8670
+
8655 8671
 //        DLI_Level[DLI_AGC_H] = ((int16_t)ResdBm & 0xFF00) >> 8;
8656 8672
 //        DLI_Level[DLI_AGC_L] = ((int16_t)ResdBm & 0x00FF);
8657 8673
         for(i = 0; i < sizeof(AGC_dBm_t); i++){
@@ -8660,38 +8676,82 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8660 8676
         }
8661 8677
         if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL){
8662 8678
             IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
8679
+        }
8680
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8681
+        printf("==================================\r\n");       
8682
+#endif // PYJ.2020.10.23_END -- 
8683
+        if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
8684
+            ResdBm = Round_ResdBm_Ret = Bluecell_RoundCalc(Temp_ResdBm);
8685
+            IwillgiveAtten = New_AGC_Calc(Limitdata,ResdBm);
8686
+//            if(IwillgiveAtten )
8663 8687
 
8688
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8689
+            printf("222 WILL GIVE YOU ATTEN  : %d\r\n",IwillgiveAtten);
8664 8690
 
8691
+            printf("Round_ResdBm_Ret : %d \r\n",Round_ResdBm_Ret);
8692
+            printf("RefValue : %d \r\n",RefValue);            
8693
+#endif // PYJ.2020.10.23_END -- 
8665 8694
 
8666
-        }
8667
-      
8668
-        if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
8669
-           if(Limitdata < ResdBm){
8670
-                int HFR_Dot5 = ((int)(Temp_ResdBm * 10) % 10);
8671
-                if(HFR_Dot5 == -5){
8672
-                    ResdBm = Limitdata + (CurrAtten * -1);
8673
-                }
8674
-            }           
8675
-//            printf("3ResdBm : DL%d : %d \r\n",Tableindex+1,ResdBm);
8695
+            if(Round_ResdBm_Ret < RefValue + 0.5 && RefValue != 0){
8696
+                
8697
+                
8698
+            }else{
8699
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8700
+                        printf("1Curr ATTEN %d \r\n",CurrAtten );
8701
+                        printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
8702
+                        printf("Temp_ResdBm : DL%d : %f \r\n",Tableindex+1,Temp_ResdBm);
8703
+                        printf("I WILL GIVE YOU ATTEN  : %d\r\n",IwillgiveAtten);
8704
+                        printf("AGC  : %d\r\n",Limitdata);
8705
+#endif // PYJ.2020.10.23_END -- 
8706
+                RefValue = Round_ResdBm_Ret;
8707
+                return;
8708
+            }
8709
+            if(Round_ResdBm_Ret > RefValue - 1.5  && RefValue != 0){
8710
+                if(CurrAtten < (IwillgiveAtten * -1)){
8711
+                    if(((Limitdata + (CurrAtten * -1)) - 1.5) <= Temp_ResdBm){
8712
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8713
+                        printf("4Curr ATTEN %d \r\n",CurrAtten );
8714
+                        printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
8715
+                        printf("Temp_ResdBm : DL%d : %f \r\n",Tableindex+1,Temp_ResdBm);
8716
+                        printf("I WILL GIVE YOU ATTEN  : %d\r\n",IwillgiveAtten* -1);
8717
+                        printf("AGC  : %d\r\n",Limitdata);
8718
+#endif // PYJ.2020.10.23_END --                           
8719
+                        return;
8720
+                    }
8721
+                }                
8722
+            }
8723
+            else
8724
+            {
8725
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8726
+        printf("2Curr ATTEN %d \r\n",CurrAtten );
8727
+        printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
8728
+        printf("Temp_ResdBm : DL%d : %f \r\n",Tableindex+1,Temp_ResdBm);
8729
+        printf("I WILL GIVE YOU ATTEN  : %d\r\n",IwillgiveAtten);
8730
+        printf("AGC  : %d\r\n",Limitdata);
8731
+#endif // PYJ.2020.10.23_END --                 
8732
+                RefValue = Round_ResdBm_Ret;
8733
+                return;
8676 8734
 
8677
-            IwillgiveAtten = New_AGC_Calc(Limitdata,ResdBm);
8735
+            }
8736
+
8737
+            
8678 8738
             if(Limitdata == ResdBm){
8679 8739
                 IwillgiveAtten = CurrAtten;
8680 8740
             }
8681 8741
             if(IwillgiveAtten == CurrAtten)
8682
-                IwillgiveAtten = 0;
8683
-            
8742
+                    IwillgiveAtten = 0;            
8743
+//            RefValue = Round_ResdBm_Ret;
8684 8744
         }
8685
-        
8745
+       
8686 8746
         IwillgiveAtten *= -1;
8687
-#if 0// PYJ.2020.09.14_BEGIN -- 
8688
-        printf("==================================\r\n");         
8689
-        printf("Curr ATTEN %d \r\n",CurrAtten );
8747
+          
8748
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8749
+        printf("3Curr ATTEN %d \r\n",CurrAtten );
8690 8750
         printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
8691 8751
         printf("Temp_ResdBm : DL%d : %f \r\n",Tableindex+1,Temp_ResdBm);
8692 8752
         printf("I WILL GIVE YOU ATTEN  : %d\r\n",IwillgiveAtten);
8693 8753
         printf("AGC  : %d\r\n",Limitdata);
8694
-#endif // PYJ.2020.09.14_END -- 
8754
+#endif // PYJ.2020.10.23_END -- 
8695 8755
 
8696 8756
 
8697 8757
         if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL && (CurrAtten) < IwillgiveAtten){
@@ -8702,9 +8762,8 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8702 8762
             IwillgiveAtten = -15;
8703 8763
 
8704 8764
             
8705
-        if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
8765
+        if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL && bluecell_Currdatastatus.DLI_FRBT_D_Day == 0){
8706 8766
              if(Limitdata != ResdBm){
8707
-         
8708 8767
                 if(CurrAtten + ResdBm <= Limitdata - 1)
8709 8768
                     IwillgiveAtten = ((CurrAtten) + 1);
8710 8769
                 if(CurrAtten == 0)
@@ -8715,7 +8774,7 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8715 8774
                 DL_PrevIwillgiveAtten[Tableindex] = IwillgiveAtten;
8716 8775
                 DL_MainAtten[DLI_AGC_H] = ((((IwillgiveAtten)  * 10) & 0xFF00) >> 8) ;
8717 8776
                 DL_MainAtten[DLI_AGC_L] = ((((IwillgiveAtten) * 10) & 0x00FF));  
8718
-                printf("Apply 2 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 |  DL_MainAtten[DLI_AGC_L]));
8777
+//                printf("Apply 2 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 |  DL_MainAtten[DLI_AGC_L]));
8719 8778
                 CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);            
8720 8779
             }else{
8721 8780
                 if(Limitdata == ResdBm){
@@ -8843,7 +8902,7 @@ void AGC_Function(){//DL
8843 8902
     };
8844 8903
          
8845 8904
     if(AGCTimerCnt > 500){
8846
-        if(bluecell_Currdatastatus.DLI_AGC_ON_OFF == true){
8905
+        if(bluecell_Currdatastatus.DLI_AGC_ON_OFF == true && bluecell_Currdatastatus.SelfTest == false){
8847 8906
             
8848 8907
             Limitdata = (( bluecell_Currdatastatus.DLI_AGC_Threshold_H << 8) & 0xFF00) ;
8849 8908
             Limitdata +=  bluecell_Currdatastatus.DLI_AGC_Threshold_L ;
@@ -9540,12 +9599,12 @@ uint8_t DLI_FRBT_Status;
9540 9599
 void FRBT_Tracking_Package(uint8_t Index, uint8_t* FRBT,uint8_t* DL_MainAtten,uint8_t path){
9541 9600
     int16_t DL_Atten = 0;
9542 9601
     int16_t FRBT_Atten = 0;
9543
-
9544
-    if(path == false)
9545
-        return;
9546 9602
     
9547 9603
     FRBT_Atten = FRBT[FRBT_H] << 8 | FRBT[FRBT_L];    
9548 9604
     DL_Atten = DL_MainAtten[FRBT_H] << 8 | DL_MainAtten[FRBT_L];
9605
+
9606
+    if(path == false || DL_Atten > 0 || FRBT_Atten <= DL_Atten)
9607
+        return;
9549 9608
     if(FRBT_Atten == DL_Atten){
9550 9609
 //        printf("Tracking Return %d \r\n ");
9551 9610
 //        printf("FRBT_Atten : %d DL_Atten :  %d \r\n",FRBT_Atten,DL_Atten);        

+ 5 - 2
Bluecell_Src/uart.c

@@ -14,6 +14,9 @@
14 14
 #include "CRC.h"
15 15
 
16 16
 
17
+#define DEBUG_PRINT 0
18
+
19
+
17 20
 UARTQUEUE TerminalQueue;
18 21
 UARTQUEUE WifiQueue;
19 22
 uart_hal_tx_type uart_hal_tx;
@@ -102,7 +105,7 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
102 105
 //        printf("data cnt zero !!!  \r\n");
103 106
         //RF_Ctrl_Main(&uart_buf[Header]);
104 107
 //        HAL_UART_Transmit(dst, &temp_buf[BLUECELL_HEADER00], 11, 3000);
105
-#if 1// PYJ.2019.07.15_BEGIN --
108
+#if DEBUG_PRINT// PYJ.2019.07.15_BEGIN --
106 109
             printf("\r\n[RX]");
107 110
             for(int i = 0; i < cnt; i++){
108 111
                 printf("%02x ",uart_buf[i]);
@@ -155,7 +158,7 @@ void Uart1_Data_Send(uint8_t* data,uint16_t size){
155 158
   //HAL_UART_Transmit_IT(&hTerminal, &data[0],size);
156 159
 //    printf("data[278] : %x \r\n",data[278]);
157 160
 ////    HAL_Delay(1);   
158
-#if 1 // PYJ.2020.07.19_BEGIN -- 
161
+#if DEBUG_PRINT // PYJ.2020.07.19_BEGIN -- 
159 162
     printf("\r\n [TX] : ");
160 163
     for(int i = 0; i< size; i++)
161 164
         printf("%02x ",data[i]);

+ 1 - 1
Src/main.c

@@ -359,8 +359,8 @@ int main(void)
359 359
     ALC_Function();    /*ALC Function*/
360 360
     AGC_Function();    /*AGC Function*/
361 361
     Alarm_Check();     /*Function to check all alarm status variables*/
362
-    FRBT_Operate();
363 362
     SelfTestTimer_Operate();
363
+    FRBT_Operate();
364 364
     AlarmLog_Report();
365 365
     HAL_IWDG_Refresh(&hiwdg);
366 366
 #if 0 // PYJ.2020.08.11_BEGIN --