Procházet zdrojové kódy

Version 00.01.13
AGC 이상동작 수정

PYJ před 4 roky
rodič
revize
4faaa3e4f5
1 změnil soubory, kde provedl 40 přidání a 5 odebrání
  1. 40 5
      Bluecell_Src/Bluecell_operate.c

+ 40 - 5
Bluecell_Src/Bluecell_operate.c

@@ -8390,6 +8390,17 @@ int8_t AGC_Calc(int8_t threshold,int8_t CurrDet){
8390 8390
 //    printf("Attenret : %d \r\n",Attenret);
8391 8391
     return Attenret;
8392 8392
 }
8393
+int16_t New_AGC_Calc(int16_t threshold,int16_t CurrDet){
8394
+    int16_t Attenret = 0;
8395
+    if(threshold == CurrDet  )
8396
+        return Attenret;
8397
+    
8398
+    if(threshold != CurrDet){
8399
+        Attenret = (threshold - CurrDet) * -1;
8400
+    }
8401
+//    printf("Attenret : %d \r\n",Attenret);
8402
+    return Attenret;
8403
+}
8393 8404
 
8394 8405
 
8395 8406
 //bool AGC_AlarmTimerSet[AGC_Alarm_DL_Index_MAX] = {false,};
@@ -8467,9 +8478,16 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8467 8478
             if(AGC_Table[i] == ResdBm)
8468 8479
                 break;
8469 8480
         }
8470
-        IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
8481
+        if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL)
8482
+            IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
8483
+        if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
8484
+            IwillgiveAtten = New_AGC_Calc(Limitdata,ResdBm);
8485
+            if(IwillgiveAtten == CurrAtten)
8486
+                IwillgiveAtten = 0;
8487
+        }
8488
+        
8471 8489
         IwillgiveAtten *= -1;
8472
-#if 0 // PYJ.2020.09.14_BEGIN -- 
8490
+#if 0// PYJ.2020.09.14_BEGIN -- 
8473 8491
         printf("==================================\r\n");
8474 8492
         printf("Curr ATTEN %d \r\n",CurrAtten );
8475 8493
         printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
@@ -8477,12 +8495,29 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8477 8495
         printf("I WILL GIVE YOU ATTEN  : %d\r\n",IwillgiveAtten);
8478 8496
         printf("AGC  : %d\r\n",Limitdata);
8479 8497
 #endif // PYJ.2020.09.14_END -- 
8480
-        if((CurrAtten) < IwillgiveAtten)
8498
+        if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL && (CurrAtten) < IwillgiveAtten)
8481 8499
             IwillgiveAtten = (CurrAtten );
8482 8500
         if(IwillgiveAtten < -15)
8483 8501
             IwillgiveAtten = -15;
8484 8502
 
8485
-        if((ResdBm + CurrAtten) > Limitdata &&  DL_PrevIwillgiveAtten[Tableindex] > IwillgiveAtten){
8503
+            
8504
+        if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
8505
+             if(Limitdata != ResdBm){
8506
+                if(CurrAtten + ResdBm <= Limitdata - 1)
8507
+                    IwillgiveAtten = ((CurrAtten) + 1);
8508
+                if(CurrAtten == 0)
8509
+                    if(IwillgiveAtten > 0)
8510
+                        IwillgiveAtten = 0;
8511
+//                IwillgiveAtten = ((CurrAtten) + 1);
8512
+//                printf("DLI_FRBT_Status == FRBT_IDEL\r\n");
8513
+                DL_PrevIwillgiveAtten[Tableindex] = IwillgiveAtten;
8514
+                DL_MainAtten[DLI_AGC_H] = ((((IwillgiveAtten)  * 10) & 0xFF00) >> 8) ;
8515
+                DL_MainAtten[DLI_AGC_L] = ((((IwillgiveAtten) * 10) & 0x00FF));  
8516
+//                printf("Apply 2 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 |  DL_MainAtten[DLI_AGC_L]));
8517
+                CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);            
8518
+            }
8519
+        }
8520
+        else if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL && (ResdBm + CurrAtten) > Limitdata &&  DL_PrevIwillgiveAtten[Tableindex] > IwillgiveAtten){
8486 8521
 //            printf("IwillgiveAtten : %d \r\n",IwillgiveAtten);
8487 8522
             DL_PrevIwillgiveAtten[Tableindex] = IwillgiveAtten;
8488 8523
 //            IwillgiveAtten = (DL_AGC_StartAtten[Tableindex]*0.1) + IwillgiveAtten;
@@ -8627,7 +8662,7 @@ void AGC_Function(){//DL
8627 8662
                             &bluecell_Currdatastatus.DLI_Level1_H,
8628 8663
                             &Det_DL1.Table_Det5_dBm_H                        ,
8629 8664
                             &bluecell_Currdatastatus.DLI_FRBT_Atten1_H);
8630
-#if 1 // PYJ.2020.09.15_BEGIN -- 
8665
+#if 1// PYJ.2020.09.15_BEGIN -- 
8631 8666
         AGC_Package_Operate(&bluecell_Currdatastatus.DLI_AGC_Threshold_H,
8632 8667
                             &bluecell_Currdatastatus.ATT_DL2_H,
8633 8668
                             AGC_Alarm_DL2_Index,