Ver código fonte

- FRBT Tracking 상태 / AGC ON 상태에서 DL Atten 이상 동작 문제 수정

음수/ 양수 처리 부분에서 이상 동작
이전 Atten 저장을 현재 어텐 으로 변경
PYJ 4 anos atrás
pai
commit
d1b6ec7256
1 arquivos alterados com 55 adições e 19 exclusões
  1. 55 19
      Bluecell_Src/Bluecell_operate.c

+ 55 - 19
Bluecell_Src/Bluecell_operate.c

@@ -7885,13 +7885,17 @@ void ALC_Function(){ //DL
7885 7885
 //-15 ~ -5
7886 7886
 int8_t AGC_Calc(int8_t threshold,int8_t CurrDet){
7887 7887
     int8_t Attenret = 0;
7888
-    if(threshold > CurrDet)
7889
-        return Attenret;
7890 7888
     
7891
-    if(threshold != CurrDet){
7889
+    if(threshold - CurrDet >= 5){
7890
+        Attenret = 5;
7891
+    }
7892
+    else if(threshold - CurrDet >= 0){
7893
+        Attenret = (threshold - CurrDet);
7894
+    }
7895
+    else if(threshold != CurrDet){
7892 7896
         Attenret = (threshold - CurrDet) * -1;
7893 7897
     }
7894
-//    printf("Attenret : %d \r\n",Attenret);
7898
+//    printf("2  %s :threshold : %d  CurrDet : %d Ret : %d \r\n",__func__,threshold,CurrDet,Attenret);    
7895 7899
     return Attenret;
7896 7900
 }
7897 7901
 int16_t New_AGC_Calc(int16_t threshold,int16_t CurrDet){
@@ -7988,6 +7992,7 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
7988 7992
         int16_t FRBT_Atten = 0;
7989 7993
         //static int16_t RefValue[AGC_Alarm_DL_Index_MAX] = {0,};
7990 7994
         //static float Ref_F_Value[AGC_Alarm_DL_Index_MAX] = {0,};
7995
+//         printf("===================%d =====================\r\n",Tableindex);
7991 7996
         FRBT_Atten =  FRBT[DLI_AGC_H] << 8 | FRBT[DLI_AGC_L];   
7992 7997
         FRBT_Atten *= 0.1;
7993 7998
         
@@ -8017,13 +8022,16 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8017 8022
         }
8018 8023
         if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL){
8019 8024
             IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
8020
-            IwillgiveAtten *= -1;
8025
+            if(Limitdata - ResdBm < 0){
8026
+                IwillgiveAtten *= -1;
8027
+            }
8021 8028
         }
8022 8029
 
8023 8030
         if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
8024 8031
             int16_t Ref_A = Limitdata - CurrAtten;
8025 8032
             float Ref_Ret = 0;
8026 8033
 #if AGC_PRINT // PYJ.2020.10.23_BEGIN --         
8034
+            
8027 8035
             printf("Ref_A : %d \r\n",Ref_A);
8028 8036
             printf("CurrAtten : %d \r\n",CurrAtten);
8029 8037
 #endif            
@@ -8055,6 +8063,8 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8055 8063
        
8056 8064
           
8057 8065
 #if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8066
+       
8067
+
8058 8068
         printf("Result Curr ATTEN %d \r\n",CurrAtten );
8059 8069
         printf("ResdBm : %d\r\n",ResdBm);
8060 8070
         printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
@@ -8076,9 +8086,17 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8076 8086
             DL_MainAtten[DLI_AGC_H] = ((((IwillgiveAtten)  * 10) & 0xFF00) >> 8) ;
8077 8087
             DL_MainAtten[DLI_AGC_L] = ((((IwillgiveAtten) * 10) & 0x00FF));      
8078 8088
             CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);  
8089
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8090
+            
8091
+            printf("FRBT_IDEL \r\n");
8092
+#endif
8079 8093
 
8080 8094
         }
8081
-        else if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL && (ResdBm + CurrAtten) > Limitdata &&  DL_PrevIwillgiveAtten[Tableindex] > IwillgiveAtten){
8095
+        else if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL //Tracking
8096
+            && (ResdBm + CurrAtten) > Limitdata  // - 8 + 5 > -10
8097
+//            &&  (DL_PrevIwillgiveAtten[Tableindex] > IwillgiveAtten || )){
8098
+            &&  CurrAtten > IwillgiveAtten){
8099
+
8082 8100
 //            printf("IwillgiveAtten : %d \r\n",IwillgiveAtten);
8083 8101
             DL_PrevIwillgiveAtten[Tableindex] = IwillgiveAtten;
8084 8102
 //            IwillgiveAtten = (DL_AGC_StartAtten[Tableindex]*0.1) + IwillgiveAtten;
@@ -8089,6 +8107,13 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8089 8107
             DL_MainAtten[DLI_AGC_L] = (((IwillgiveAtten * 10) & 0x00FF));   
8090 8108
 //            printf("Apply 1 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 |  DL_MainAtten[DLI_AGC_L]));
8091 8109
             CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
8110
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8111
+
8112
+            printf("FRBT TRACKING \r\n");
8113
+            printf("Curr Atten %d ==== Prev Giveattne : %d ==== Give Atten %d \r\n",CurrAtten,DL_PrevIwillgiveAtten[Tableindex],IwillgiveAtten);
8114
+
8115
+#endif
8116
+
8092 8117
         }
8093 8118
         else if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_RUNNING){
8094 8119
             if(CurrAtten == FRBT_Atten)
@@ -8103,6 +8128,17 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8103 8128
 //                printf("Apply 2 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 |  DL_MainAtten[DLI_AGC_L]));
8104 8129
                 CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);            
8105 8130
             }
8131
+            
8132
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN -- 
8133
+            printf("FRBT Runngin \r\n");
8134
+#endif
8135
+        }else{
8136
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
8137
+//            DL_PrevIwillgiveAtten[Tableindex] > IwillgiveAttsen
8138
+
8139
+            printf("Prev Giveattne : %d //// Give Atten %d \r\n",DL_PrevIwillgiveAtten[Tableindex],IwillgiveAtten);
8140
+            printf("FRBT Tracking \r\n");
8141
+#endif
8106 8142
         }
8107 8143
 }
8108 8144
 #endif // PYJ.2020.06.27_END -- 
@@ -8213,7 +8249,7 @@ void AGC_Function(){//DL
8213 8249
 //            if(k != 0) continue;
8214 8250
             ResdBm = (int16_t)(DLI_Level[DLI_AGC_H + (k * 2)] << 8 |  DLI_Level[DLI_AGC_L + ((k * 2))]) * 10;
8215 8251
 //            printf("============================================\r\n");
8216
-//            printf("Limitdata : %d   ResdBm : %d \r\n",Limitdata * 100,ResdBm);
8252
+//            printf("%d : Limitdata : %d   ResdBm : %d \r\n",k,Limitdata * 100,ResdBm);
8217 8253
             if(DL_Curr_Atten[AGC_Alarm_DL1_Index+k] <= -150)
8218 8254
                 DL_Curr_Atten[AGC_Alarm_DL1_Index+k] = -150;
8219 8255
 //            printf("DL_Curr_Atten%d : %d \r\n",k+1,DL_Curr_Atten[AGC_Alarm_DL1_Index+k] * 0.1);
@@ -8239,12 +8275,12 @@ void AGC_Function(){//DL
8239 8275
 //            printf("AGC_AlarmSet : %d \r\n",AGC_AlarmSet[AGC_Alarm_DL1_Index+k]);
8240 8276
         }
8241 8277
         AGC_Package_Operate(&bluecell_Currdatastatus.DLI_AGC_Threshold_H,
8242
-                            &bluecell_Currdatastatus.ATT_DL2_H,
8243
-                            AGC_Alarm_DL2_Index,
8244
-                            &bluecell_Currdatastatus.DLI_P2_Level2_H,
8245
-                            &bluecell_Currdatastatus.DLI_Level2_H,
8246
-                            &Det_DL2.Table_Det5_dBm_H                        ,
8247
-                            &bluecell_Currdatastatus.DLI_FRBT_Atten2_H);
8278
+                            &bluecell_Currdatastatus.ATT_DL3_H,
8279
+                            AGC_Alarm_DL3_Index,
8280
+                            &bluecell_Currdatastatus.DLI_P3_Level3_H,
8281
+                            &bluecell_Currdatastatus.DLI_Level3_H,
8282
+                            &Det_DL3.Table_Det5_dBm_H                        ,
8283
+                            &bluecell_Currdatastatus.DLI_FRBT_Atten3_H);
8248 8284
 #if (AGC_PRINT == 0)// PYJ.2020.09.15_BEGIN -- 
8249 8285
         AGC_Package_Operate(&bluecell_Currdatastatus.DLI_AGC_Threshold_H,
8250 8286
                             &bluecell_Currdatastatus.ATT_DL1_H,
@@ -8254,12 +8290,12 @@ void AGC_Function(){//DL
8254 8290
                             &Det_DL1.Table_Det5_dBm_H                        ,
8255 8291
                             &bluecell_Currdatastatus.DLI_FRBT_Atten1_H);
8256 8292
         AGC_Package_Operate(&bluecell_Currdatastatus.DLI_AGC_Threshold_H,
8257
-                            &bluecell_Currdatastatus.ATT_DL3_H,
8258
-                            AGC_Alarm_DL3_Index,
8259
-                            &bluecell_Currdatastatus.DLI_P3_Level3_H,
8260
-                            &bluecell_Currdatastatus.DLI_Level3_H,
8261
-                            &Det_DL3.Table_Det5_dBm_H                        ,
8262
-                            &bluecell_Currdatastatus.DLI_FRBT_Atten3_H);
8293
+                            &bluecell_Currdatastatus.ATT_DL2_H,
8294
+                            AGC_Alarm_DL2_Index,
8295
+                            &bluecell_Currdatastatus.DLI_P2_Level2_H,
8296
+                            &bluecell_Currdatastatus.DLI_Level2_H,
8297
+                            &Det_DL2.Table_Det5_dBm_H                        ,
8298
+                            &bluecell_Currdatastatus.DLI_FRBT_Atten2_H);
8263 8299
         AGC_Package_Operate(&bluecell_Currdatastatus.DLI_AGC_Threshold_H,
8264 8300
                             &bluecell_Currdatastatus.ATT_DL4_H,
8265 8301
                             AGC_Alarm_DL4_Index,