Просмотр исходного кода

HFR 검수 중 작업 사항

ALC Alarm 발생 시  ALC LIMIT 과 DET 이 같고 ALC ATTEN 과 Main Atten 의 합이 최대치로 먹었을 때만 Alarm 동작 하도록 수정
ALC retry cnt 가 1보다 클 때 ALC 동작 안하도록 수정
UL Level 측정 실시간으로 하도록 수정
PYJ лет назад: 5
Родитель
Сommit
ea4505782a
3 измененных файлов с 109 добавлено и 25 удалено
  1. 107 23
      Bluecell_Src/Bluecell_operate.c
  2. 1 1
      Bluecell_Src/uart.c
  3. 1 1
      STM32F103ZET_JDASMBIC.elf.launch

+ 107 - 23
Bluecell_Src/Bluecell_operate.c

@@ -251,16 +251,12 @@ void Boot_LED_Toggle(void){
251
             }
251
             }
252
             LED_TestCnt++;
252
             LED_TestCnt++;
253
             LedTimerCnt = 0;
253
             LedTimerCnt = 0;
254
-
255
           /*Set LED TEST variable False after 12 flashes*/
254
           /*Set LED TEST variable False after 12 flashes*/
256
           if(LED_TestCnt >= 6){
255
           if(LED_TestCnt >= 6){
257
             bluecell_Currdatastatus.LED_TEST = false;
256
             bluecell_Currdatastatus.LED_TEST = false;
258
             LED_TestCnt = 0;
257
             LED_TestCnt = 0;
259
-
260
           }
258
           }
261
         }
259
         }
262
-
263
-
264
   }
260
   }
265
   
261
   
266
 }
262
 }
@@ -333,6 +329,7 @@ uint8_t MBIC_UL_PE43711_Calc(uint8_t* Table,int16_t MBIC_Val,int16_t MBIC_UserVa
333
     ret = TableAtteGuarantee(Table,ret);//Table Guarantee
329
     ret = TableAtteGuarantee(Table,ret);//Table Guarantee
334
 //    printf("ret2 : %f \r\n",ret);
330
 //    printf("ret2 : %f \r\n",ret);
335
     Result = PE43711_DataToHexConvert(ret);
331
     Result = PE43711_DataToHexConvert(ret);
332
+//    printf("Result %x \r\n",Result);
336
     return Result;
333
     return Result;
337
 }
334
 }
338
 
335
 
@@ -391,7 +388,7 @@ double TableAtteGuarantee(uint8_t* Table,double AttenValue){
391
     }
388
     }
392
     
389
     
393
     Bluecell_StructCpy(&GuaranteeData[0],&Table[0],sizeof(ATT_TABLE_st));
390
     Bluecell_StructCpy(&GuaranteeData[0],&Table[0],sizeof(ATT_TABLE_st));
394
-    
391
+//    printf("cnt : %d \r\n",cnt);
395
 //    printf("H  : %x   L : %x \r\n",GuaranteeData[cnt * 2],GuaranteeData[cnt * 2 + 1]);
392
 //    printf("H  : %x   L : %x \r\n",GuaranteeData[cnt * 2],GuaranteeData[cnt * 2 + 1]);
396
     ret =  GuaranteeData[cnt] * 0.5;
393
     ret =  GuaranteeData[cnt] * 0.5;
397
 //= PE43711_Double(GuaranteeData[cnt * 2],GuaranteeData[cnt * 2 + 1]);
394
 //= PE43711_Double(GuaranteeData[cnt * 2],GuaranteeData[cnt * 2 + 1]);
@@ -926,7 +923,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
926
 //    printf("bluecell_Currdatastatus.ATT_UL3_L : %0x \r\n",bluecell_Currdatastatus.ATT_UL3_L);
923
 //    printf("bluecell_Currdatastatus.ATT_UL3_L : %0x \r\n",bluecell_Currdatastatus.ATT_UL3_L);
927
 //    printf("bluecell_Currdatastatus.bluecell_User_UL3_H : %0x \r\n",bluecell_Currdatastatus.bluecell_User_UL3_H);
924
 //    printf("bluecell_Currdatastatus.bluecell_User_UL3_H : %0x \r\n",bluecell_Currdatastatus.bluecell_User_UL3_H);
928
 //    printf("bluecell_Currdatastatus.bluecell_User_UL3_L : %0x \r\n",bluecell_Currdatastatus.bluecell_User_UL3_L);        
925
 //    printf("bluecell_Currdatastatus.bluecell_User_UL3_L : %0x \r\n",bluecell_Currdatastatus.bluecell_User_UL3_L);        
929
-        printf("%d val = %x \r\n",__LINE__,val);
926
+//        printf("%d val = %x \r\n",__LINE__,val);
930
 
927
 
931
             PE43711_atten_ctrl(ALL_ATT.ATT_UL3,val);
928
             PE43711_atten_ctrl(ALL_ATT.ATT_UL3,val);
932
     }
929
     }
@@ -959,6 +956,9 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
959
             MBIC_Val = Curr.ATT_UL4_H << 8 | Curr.ATT_UL4_L;
956
             MBIC_Val = Curr.ATT_UL4_H << 8 | Curr.ATT_UL4_L;
960
             MBIC_ALC_Val = Curr.MBIC_ULO_ALC_Atten4_H << 8 | Curr.MBIC_ULO_ALC_Atten4_L;
957
             MBIC_ALC_Val = Curr.MBIC_ULO_ALC_Atten4_H << 8 | Curr.MBIC_ULO_ALC_Atten4_L;
961
             MBIC_UserVal = Curr.bluecell_User_UL4_H << 8 | Curr.bluecell_User_UL4_L;
958
             MBIC_UserVal = Curr.bluecell_User_UL4_H << 8 | Curr.bluecell_User_UL4_L;
959
+//            printf("UL 4MBIC_Val : %02X \r\n",MBIC_Val);
960
+//            printf("UL 4MBIC_UserVal : %02X \r\n",MBIC_UserVal);
961
+//            printf("UL 4MBIC_ALC_Val : %02X \r\n",MBIC_ALC_Val);            
962
             val = MBIC_UL_PE43711_Calc(&Att_UL4.Table_0_0_dBm,// Table Offset
962
             val = MBIC_UL_PE43711_Calc(&Att_UL4.Table_0_0_dBm,// Table Offset
963
                                 MBIC_Val,// Hidden Atten Low bit
963
                                 MBIC_Val,// Hidden Atten Low bit
964
                                MBIC_UserVal,
964
                                MBIC_UserVal,
@@ -2919,7 +2919,7 @@ bool Bluecell_Operate(uint8_t* data){
2919
         else if(CurrAtten <= -50 )
2919
         else if(CurrAtten <= -50 )
2920
             CurrAtten = - 50;    
2920
             CurrAtten = - 50;    
2921
         
2921
         
2922
-        printf("LINE : %d Curr ATTEN : %d \r\n",__LINE__,CurrAtten);        
2922
+//        printf("LINE : %d Curr ATTEN : %d \r\n",__LINE__,CurrAtten);        
2923
     
2923
     
2924
         CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
2924
         CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
2925
         break;
2925
         break;
@@ -2936,10 +2936,14 @@ bool Bluecell_Operate(uint8_t* data){
2936
     case Bluecell_DLI_AGC_ON_OFF:                             
2936
     case Bluecell_DLI_AGC_ON_OFF:                             
2937
         printf("AGC ON OFF SET : %d \r\n",bluecell_Currdatastatus.DLI_AGC_ON_OFF);
2937
         printf("AGC ON OFF SET : %d \r\n",bluecell_Currdatastatus.DLI_AGC_ON_OFF);
2938
         bluecell_Currdatastatus.DLI_AGC_ON_OFF = data[BLUECELL_DATA + i];
2938
         bluecell_Currdatastatus.DLI_AGC_ON_OFF = data[BLUECELL_DATA + i];
2939
+        if(bluecell_Currdatastatus.DLI_AGC_ON_OFF == 0)
2940
+            bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm = 0;
2939
         break;
2941
         break;
2940
     case Bluecell_ULO_ALC_ON_OFF:                             
2942
     case Bluecell_ULO_ALC_ON_OFF:                             
2941
         printf("ALC ON OFF SET : %d \r\n",bluecell_Currdatastatus.ULO_ALC_ON_OFF);
2943
         printf("ALC ON OFF SET : %d \r\n",bluecell_Currdatastatus.ULO_ALC_ON_OFF);
2942
         bluecell_Currdatastatus.ULO_ALC_ON_OFF = data[BLUECELL_DATA + i];
2944
         bluecell_Currdatastatus.ULO_ALC_ON_OFF = data[BLUECELL_DATA + i];
2945
+        if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == 0)
2946
+            bluecell_Currdatastatus.ALARM_ULO_ALC_Alarm = 0;    
2943
         break;
2947
         break;
2944
     case Bluecell_DLI_AGC_Threshold:                          
2948
     case Bluecell_DLI_AGC_Threshold:                          
2945
         bluecell_Currdatastatus.DLI_AGC_Threshold_H = data[BLUECELL_DATA + i++];
2949
         bluecell_Currdatastatus.DLI_AGC_Threshold_H = data[BLUECELL_DATA + i++];
@@ -3255,9 +3259,9 @@ typedef enum{
3255
         PrevMBIC_DL_ShutdownCount[i] = 0xFF;        
3259
         PrevMBIC_DL_ShutdownCount[i] = 0xFF;        
3256
     }
3260
     }
3257
 
3261
 
3258
-//  printf("Type %x  Ready....\r\n",bluecell_Currdatastatus.Type);
3262
+  printf("Type %x  Ready....\r\n",bluecell_Currdatastatus.Type);
3259
 
3263
 
3260
-  //  printf("bluecell_Currdatastatus.Type : %02x \r\n",bluecell_Currdatastatus.Type);
3264
+    printf("bluecell_Currdatastatus.Type : %02x \r\n",bluecell_Currdatastatus.Type);
3261
 #if 1 // PYJ.2020.06.17_BEGIN -- 
3265
 #if 1 // PYJ.2020.06.17_BEGIN -- 
3262
     HAL_GPIO_WritePin(PATH_EN_DL1_GPIO_Port,PATH_EN_DL1_Pin,bluecell_Currdatastatus.ATT_DL1_PATH);   
3266
     HAL_GPIO_WritePin(PATH_EN_DL1_GPIO_Port,PATH_EN_DL1_Pin,bluecell_Currdatastatus.ATT_DL1_PATH);   
3263
     HAL_GPIO_WritePin(PATH_EN_DL2_GPIO_Port,PATH_EN_DL2_Pin,bluecell_Currdatastatus.ATT_DL2_PATH);   
3267
     HAL_GPIO_WritePin(PATH_EN_DL2_GPIO_Port,PATH_EN_DL2_Pin,bluecell_Currdatastatus.ATT_DL2_PATH);   
@@ -4405,6 +4409,7 @@ bool MBIC_Operate(uint8_t* data){
4405
                     AGC_AlarmSet[AGC_Alarm_DL2_Index] = false;
4409
                     AGC_AlarmSet[AGC_Alarm_DL2_Index] = false;
4406
                     AGC_AlarmSet[AGC_Alarm_DL3_Index] = false;
4410
                     AGC_AlarmSet[AGC_Alarm_DL3_Index] = false;
4407
                     AGC_AlarmSet[AGC_Alarm_DL4_Index] = false;
4411
                     AGC_AlarmSet[AGC_Alarm_DL4_Index] = false;
4412
+                    bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm = 0;
4408
                 }
4413
                 }
4409
                 DL_AGC_StartAtten[AGC_Alarm_DL1_Index] 
4414
                 DL_AGC_StartAtten[AGC_Alarm_DL1_Index] 
4410
                     = bluecell_Currdatastatus.ATT_DL1_H << 8 | bluecell_Currdatastatus.ATT_DL1_L;
4415
                     = bluecell_Currdatastatus.ATT_DL1_H << 8 | bluecell_Currdatastatus.ATT_DL1_L;
@@ -4620,7 +4625,8 @@ bool MBIC_Operate(uint8_t* data){
4620
                 break;
4625
                 break;
4621
             case  ULO_ALC_ON_OFF                   :
4626
             case  ULO_ALC_ON_OFF                   :
4622
                 bluecell_Currdatastatus.ULO_ALC_ON_OFF = data[MBIC_PAYLOADSTART + 3]; 
4627
                 bluecell_Currdatastatus.ULO_ALC_ON_OFF = data[MBIC_PAYLOADSTART + 3]; 
4623
-
4628
+                if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == 0)
4629
+                    bluecell_Currdatastatus.ALARM_ULO_ALC_Alarm = 0;
4624
 
4630
 
4625
                 break;
4631
                 break;
4626
             case  ULO_ALC_Threshold                       :
4632
             case  ULO_ALC_Threshold                       :
@@ -5148,6 +5154,7 @@ void DET_LevelAlarmCheck(){
5148
         else{
5154
         else{
5149
             if(LimitData_UL_High - 2 >= Res_UL_dBm[DET_Alarm_UL1_Index + i])
5155
             if(LimitData_UL_High - 2 >= Res_UL_dBm[DET_Alarm_UL1_Index + i])
5150
                 ADC_Alarm_UL_Set[DET_Alarm_UL1_Index + i] = false;
5156
                 ADC_Alarm_UL_Set[DET_Alarm_UL1_Index + i] = false;
5157
+            DET_UL_On_AlarmTimerCnt[DET_Alarm_UL1_Index + i] = 0;
5151
 //            printf("OFF _Limit : %d   UL%d : %d  ADC_Alarm_UL_Set %d ,Value : %d\r\n",LimitData_UL_High,i+1,Res_UL_dBm[DET_Alarm_UL1_Index + i],DET_Alarm_UL1_Index + i,ADC_Alarm_UL_Set[DET_Alarm_UL1_Index + i]);            
5158
 //            printf("OFF _Limit : %d   UL%d : %d  ADC_Alarm_UL_Set %d ,Value : %d\r\n",LimitData_UL_High,i+1,Res_UL_dBm[DET_Alarm_UL1_Index + i],DET_Alarm_UL1_Index + i,ADC_Alarm_UL_Set[DET_Alarm_UL1_Index + i]);            
5152
         }
5159
         }
5153
 #if 1 // PYJ.2020.06.22_BEGIN -- 
5160
 #if 1 // PYJ.2020.06.22_BEGIN -- 
@@ -5875,13 +5882,21 @@ int16_t ALC_Calc(uint8_t num,double CurrAtten ,int8_t threshold,double CurrDet){
5875
 void ALC_Alarm_TimerSet(uint8_t num,int16_t threshold,int16_t CurrDet,int16_t Atten,int16_t MainAtten){
5882
 void ALC_Alarm_TimerSet(uint8_t num,int16_t threshold,int16_t CurrDet,int16_t Atten,int16_t MainAtten){
5876
     int16_t ret =0;
5883
     int16_t ret =0;
5877
     int16_t CurrAtten = 0;
5884
     int16_t CurrAtten = 0;
5885
+    double M_Atten = 0;
5886
+    M_Atten = (MainAtten*0.1);
5878
     CurrAtten = Atten * 0.1;
5887
     CurrAtten = Atten * 0.1;
5879
-        if(threshold < CurrDet){
5888
+        if(CurrAtten + M_Atten >= -18){
5889
+            ALC_AlarmSet[num] = false;
5890
+//            printf("Alarm 3 \r\n");                
5891
+        }    
5892
+        else if(threshold <= CurrDet){
5880
             ret = CurrDet - threshold ;
5893
             ret = CurrDet - threshold ;
5881
             ret = Bluecell_TestPro(ret +( CurrAtten * 0.1 * -1));
5894
             ret = Bluecell_TestPro(ret +( CurrAtten * 0.1 * -1));
5882
             ret *= -1;  
5895
             ret *= -1;  
5883
-            if(CurrAtten + (MainAtten*0.1) <= -20)
5896
+            if(CurrAtten + M_Atten <= -20){
5884
                 ALC_AlarmSet[num] = true;
5897
                 ALC_AlarmSet[num] = true;
5898
+//                printf("Alarm 1 \r\n");
5899
+            }
5885
         }
5900
         }
5886
         else if(threshold -2 > CurrDet){
5901
         else if(threshold -2 > CurrDet){
5887
             if(CurrAtten < 0){
5902
             if(CurrAtten < 0){
@@ -5889,14 +5904,43 @@ void ALC_Alarm_TimerSet(uint8_t num,int16_t threshold,int16_t CurrDet,int16_t At
5889
                 ret = Bluecell_TestPro(ret);
5904
                 ret = Bluecell_TestPro(ret);
5890
                 ret += CurrAtten;
5905
                 ret += CurrAtten;
5891
                 ALC_AlarmSet[num] = false; 
5906
                 ALC_AlarmSet[num] = false; 
5907
+//                printf("Alarm 2 \r\n");                
5892
             }
5908
             }
5893
         }
5909
         }
5910
+//        printf("threshold : %d \r\n",threshold);
5911
+//        printf("Curr Atten : %d    Main Atten : %d    Thre : %d    CurrDet : %d \r\n",
5912
+//        CurrAtten,MainAtten,threshold,CurrDet);
5913
+//        printf("ALC_AlarmSet[%d] %d \r\n",num,ALC_AlarmSet[num]);
5914
+}
5915
+double HFR_CntUpCalc(double ret){
5916
+    double origin = ret;
5917
+    int16_t calctmp = 0;
5918
+//    printf("+++++++++++++++++++++++++++++++++++++++++\r\n");
5919
+    ret *= -1;
5920
+//    printf("CALC VALUE : %f \r\n",ret);
5921
+    ret *= 10;
5922
+    calctmp = ret;
5923
+//    printf("1. ret : %f \r\n",ret);
5924
+    calctmp %= 10;
5925
+//    printf("2. ret : %f \r\n",ret);
5926
+    
5927
+    
5928
+    if(calctmp >= 5){
5929
+//        printf("minus return \r\n");
5930
+        origin = (origin -1) + (calctmp  * 0.1);
5931
+    }else{
5932
+        origin += (calctmp  * 0.1);
5933
+//        printf("ZERO return \r\n");        
5934
+    }
5935
+//    printf("HFR RET : %f \r\n",origin);
5936
+    return origin;
5894
 }
5937
 }
5895
 typedef enum{
5938
 typedef enum{
5896
     ULO_ALC_H = 0,
5939
     ULO_ALC_H = 0,
5897
     ULO_ALC_L,
5940
     ULO_ALC_L,
5898
 };
5941
 };
5899
-void ALC_Package_Operate(uint8_t*ULO_ADC_Level,uint8_t* ULO_Level,DET_TABLEUL_st*      UL_Table,uint8_t TableIndex,uint8_t* ALC_Atten,uint8_t* UL_Main_Atten,uint8_t* GainOffset ){
5942
+   
5943
+void ALC_Package_Operate(uint8_t*ULO_ADC_Level,uint8_t* ULO_Level,DET_TABLEUL_st*      UL_Table,uint8_t TableIndex,uint8_t* ALC_Atten,uint8_t* UL_Main_Atten,uint8_t* GainOffset,uint8_t* retrycnt ){
5900
     /*static int16_t PrevLimitdata[ALC_Alarm_UL_Index_MAX] = {0,};
5944
     /*static int16_t PrevLimitdata[ALC_Alarm_UL_Index_MAX] = {0,};
5901
     static int8_t* ALC_Table;
5945
     static int8_t* ALC_Table;
5902
     int16_t tmpcalc = 0;
5946
     int16_t tmpcalc = 0;
@@ -5912,6 +5956,9 @@ void ALC_Package_Operate(uint8_t*ULO_ADC_Level,uint8_t* ULO_Level,DET_TABLEUL_st
5912
     int16_t Main_Atten = 0;
5956
     int16_t Main_Atten = 0;
5913
     int16_t GiveAttenPlusULAtten = 0;
5957
     int16_t GiveAttenPlusULAtten = 0;
5914
 
5958
 
5959
+    if(*retrycnt > 0)
5960
+        return;
5961
+    
5915
     UL_Atten = ALC_Atten[ULO_ALC_H] << 8 | ALC_Atten[ULO_ALC_L];
5962
     UL_Atten = ALC_Atten[ULO_ALC_H] << 8 | ALC_Atten[ULO_ALC_L];
5916
     Main_Atten = UL_Main_Atten[ULO_ALC_H] << 8 | UL_Main_Atten[ULO_ALC_L];
5963
     Main_Atten = UL_Main_Atten[ULO_ALC_H] << 8 | UL_Main_Atten[ULO_ALC_L];
5917
     Gain_Atten = GainOffset[ULO_ALC_H] << 8 | GainOffset[ULO_ALC_L];
5964
     Gain_Atten = GainOffset[ULO_ALC_H] << 8 | GainOffset[ULO_ALC_L];
@@ -5928,22 +5975,27 @@ void ALC_Package_Operate(uint8_t*ULO_ADC_Level,uint8_t* ULO_Level,DET_TABLEUL_st
5928
     ResdBm = AutoControl_ADC_Compare(ret,&UL_Table->Table_Det_15_dBm_H,UL_Table->Table_Length * 2,&UL_DET_Table_ref[TableIndex][TABLE_MAX_VALUE]);
5975
     ResdBm = AutoControl_ADC_Compare(ret,&UL_Table->Table_Det_15_dBm_H,UL_Table->Table_Length * 2,&UL_DET_Table_ref[TableIndex][TABLE_MAX_VALUE]);
5929
     //ret 현재 Voltage 값 출력
5976
     //ret 현재 Voltage 값 출력
5930
     //ret 에 따른 현재 DBM 구현
5977
     //ret 에 따른 현재 DBM 구현
5931
-    ResultData = ResdBm;
5978
+
5932
     CurrentATTENVALUE = PE43711_Double(ALC_Atten[ULO_ALC_H],ALC_Atten[ULO_ALC_L]);
5979
     CurrentATTENVALUE = PE43711_Double(ALC_Atten[ULO_ALC_H],ALC_Atten[ULO_ALC_L]);
5933
-    ULO_Level[ULO_ALC_H] = (ResultData & 0xFF00) >> 8;
5934
-    ULO_Level[ULO_ALC_L] = (ResultData & 0x00FF);
5980
+
5935
 //    printf("=============ALC ON =====START================\r\n");
5981
 //    printf("=============ALC ON =====START================\r\n");
5936
 //    printf("Current UL ADC VALUE : %f \r\n",ret);
5982
 //    printf("Current UL ADC VALUE : %f \r\n",ret);
5937
 //    printf("ResdBm : UL%d : %f \r\n",TableIndex + 1,ResdBm);    
5983
 //    printf("ResdBm : UL%d : %f \r\n",TableIndex + 1,ResdBm);    
5938
 //    printf("ORIGIN ResdBm : %f  %d\r\n",ResdBm,Main_Atten);
5984
 //    printf("ORIGIN ResdBm : %f  %d\r\n",ResdBm,Main_Atten);
5939
 //    printf("After ResdBm : %f \r\n",ResdBm);
5985
 //    printf("After ResdBm : %f \r\n",ResdBm);
5986
+    ResdBm = HFR_CntUpCalc(ResdBm);
5987
+    ResultData = ResdBm;
5988
+//    printf("HFR CALC RET : %d \r\n",ResultData);
5989
+    ULO_Level[ULO_ALC_H] = (ResultData & 0xFF00) >> 8;
5990
+    ULO_Level[ULO_ALC_L] = (ResultData & 0x00FF);    
5940
     Limitdata += (Main_Atten * 0.1);
5991
     Limitdata += (Main_Atten * 0.1);
5941
-    ALC_Alarm_TimerSet(TableIndex,Limitdata,ResdBm,UL_Atten,Main_Atten);
5992
+//    printf("Limitdata : %d | ResultData : %d \r\n",Limitdata,ResultData);
5993
+    ALC_Alarm_TimerSet(TableIndex,Limitdata,ResultData,UL_Atten,Main_Atten);
5942
     IwillGiveAtten = ALC_Calc(TableIndex,CurrentATTENVALUE,Limitdata,ResdBm);
5994
     IwillGiveAtten = ALC_Calc(TableIndex,CurrentATTENVALUE,Limitdata,ResdBm);
5943
 //    printf("STEP 1 : I WILL GIVE ATTEN  %d \r\n",IwillGiveAtten);
5995
 //    printf("STEP 1 : I WILL GIVE ATTEN  %d \r\n",IwillGiveAtten);
5944
     IwillGiveAtten += UL_Atten;
5996
     IwillGiveAtten += UL_Atten;
5945
 //    printf("STEP 2 : I WILL GIVE ATTEN PLUS  ALC ATTEN  %d \r\n",IwillGiveAtten);    
5997
 //    printf("STEP 2 : I WILL GIVE ATTEN PLUS  ALC ATTEN  %d \r\n",IwillGiveAtten);    
5946
-    if(ResdBm <= (Limitdata - 3)){
5998
+    if(ResdBm <= (Limitdata - 1)){
5947
         if(IwillGiveAtten <= -10){
5999
         if(IwillGiveAtten <= -10){
5948
             IwillGiveAtten += 10;
6000
             IwillGiveAtten += 10;
5949
         }
6001
         }
@@ -5983,9 +6035,17 @@ int16_t ResultData = 0;
5983
     ResdBm = AutoControl_ADC_Compare(ret,&UL_Table->Table_Det_15_dBm_H,UL_Table->Table_Length * 2,&UL_DET_Table_ref[TableIndex][TABLE_MAX_VALUE]);
6035
     ResdBm = AutoControl_ADC_Compare(ret,&UL_Table->Table_Det_15_dBm_H,UL_Table->Table_Length * 2,&UL_DET_Table_ref[TableIndex][TABLE_MAX_VALUE]);
5984
     //ret 현재 Voltage 값 출력
6036
     //ret 현재 Voltage 값 출력
5985
     //ret 에 따른 현재 DBM 구현
6037
     //ret 에 따른 현재 DBM 구현
6038
+    ResdBm = HFR_CntUpCalc(ResdBm);
5986
     ResultData = ResdBm;
6039
     ResultData = ResdBm;
6040
+//    printf("HFR CALC RET : %d \r\n",ResultData);
5987
     ULO_Level[ULO_ALC_H] = (ResultData & 0xFF00) >> 8;
6041
     ULO_Level[ULO_ALC_H] = (ResultData & 0xFF00) >> 8;
5988
-    ULO_Level[ULO_ALC_L] = (ResultData & 0x00FF);
6042
+    ULO_Level[ULO_ALC_L] = (ResultData & 0x00FF);  
6043
+
6044
+
6045
+//    
6046
+//    ResultData = ResdBm;
6047
+//    ULO_Level[ULO_ALC_H] = (ResultData & 0xFF00) >> 8;
6048
+//    ULO_Level[ULO_ALC_L] = (ResultData & 0x00FF);
5989
 //    printf("============ALC_OFF======START================\r\n");
6049
 //    printf("============ALC_OFF======START================\r\n");
5990
 //    printf("Current UL ADC VALUE : %f \r\n",ret);
6050
 //    printf("Current UL ADC VALUE : %f \r\n",ret);
5991
 //    printf("ResdBm : UL1 : %f \r\n",ResdBm);
6051
 //    printf("ResdBm : UL1 : %f \r\n",ResdBm);
@@ -6143,29 +6203,35 @@ void ALC_Function(){ //DL
6143
                             ALC_Alarm_UL1_Index,
6203
                             ALC_Alarm_UL1_Index,
6144
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten1_H,
6204
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten1_H,
6145
                             &bluecell_Currdatastatus.ATT_UL1_H,
6205
                             &bluecell_Currdatastatus.ATT_UL1_H,
6146
-                            &bluecell_Currdatastatus.bluecell_User_UL1_H);
6206
+                            &bluecell_Currdatastatus.bluecell_User_UL1_H,
6207
+                            &bluecell_Currdatastatus.ULO_Shutdown_Retry_Count1);
6208
+#if 1 // PYJ.2020.07.01_BEGIN -- 
6147
         ALC_Package_Operate(&bluecell_Currdatastatus.ULO_P2_Level2_H,
6209
         ALC_Package_Operate(&bluecell_Currdatastatus.ULO_P2_Level2_H,
6148
                             &bluecell_Currdatastatus.ULO_Level2_H,
6210
                             &bluecell_Currdatastatus.ULO_Level2_H,
6149
                             &Det_UL2.Table_Det_15_dBm_H,
6211
                             &Det_UL2.Table_Det_15_dBm_H,
6150
                             ALC_Alarm_UL2_Index,
6212
                             ALC_Alarm_UL2_Index,
6151
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten2_H,
6213
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten2_H,
6152
                             &bluecell_Currdatastatus.ATT_UL2_H,
6214
                             &bluecell_Currdatastatus.ATT_UL2_H,
6153
-                            &bluecell_Currdatastatus.bluecell_User_UL2_H);
6215
+                            &bluecell_Currdatastatus.bluecell_User_UL2_H,
6216
+                            &bluecell_Currdatastatus.ULO_Shutdown_Retry_Count2);
6154
         ALC_Package_Operate(&bluecell_Currdatastatus.ULO_P3_Level3_H,
6217
         ALC_Package_Operate(&bluecell_Currdatastatus.ULO_P3_Level3_H,
6155
                             &bluecell_Currdatastatus.ULO_Level3_H,
6218
                             &bluecell_Currdatastatus.ULO_Level3_H,
6156
                             &Det_UL3.Table_Det_15_dBm_H,
6219
                             &Det_UL3.Table_Det_15_dBm_H,
6157
                             ALC_Alarm_UL3_Index,
6220
                             ALC_Alarm_UL3_Index,
6158
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten3_H,
6221
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten3_H,
6159
                             &bluecell_Currdatastatus.ATT_UL3_H,
6222
                             &bluecell_Currdatastatus.ATT_UL3_H,
6160
-                            &bluecell_Currdatastatus.bluecell_User_UL3_H);
6223
+                            &bluecell_Currdatastatus.bluecell_User_UL3_H,
6224
+                            &bluecell_Currdatastatus.ULO_Shutdown_Retry_Count3);
6161
         ALC_Package_Operate(&bluecell_Currdatastatus.ULO_P4_Level4_H,
6225
         ALC_Package_Operate(&bluecell_Currdatastatus.ULO_P4_Level4_H,
6162
                             &bluecell_Currdatastatus.ULO_Level4_H,
6226
                             &bluecell_Currdatastatus.ULO_Level4_H,
6163
                             &Det_UL4.Table_Det_15_dBm_H,
6227
                             &Det_UL4.Table_Det_15_dBm_H,
6164
                             ALC_Alarm_UL4_Index,
6228
                             ALC_Alarm_UL4_Index,
6165
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_H,
6229
                             &bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_H,
6166
                             &bluecell_Currdatastatus.ATT_UL4_H,
6230
                             &bluecell_Currdatastatus.ATT_UL4_H,
6167
-                            &bluecell_Currdatastatus.bluecell_User_UL4_H);
6231
+                            &bluecell_Currdatastatus.bluecell_User_UL4_H,
6232
+                            &bluecell_Currdatastatus.ULO_Shutdown_Retry_Count4);
6168
         
6233
         
6234
+#endif // PYJ.2020.07.01_END -- 
6169
         
6235
         
6170
 
6236
 
6171
 
6237
 
@@ -6508,6 +6574,7 @@ void ALC_Function(){ //DL
6508
             printf("==================END================\r\n");
6574
             printf("==================END================\r\n");
6509
 #endif // PYJ.2020.06.20_END -- 
6575
 #endif // PYJ.2020.06.20_END -- 
6510
 #else
6576
 #else
6577
+#if 0 // PYJ.2020.07.01_BEGIN -- 
6511
             UL_Curr_Level(&bluecell_Currdatastatus.ULO_P1_Level1_H,
6578
             UL_Curr_Level(&bluecell_Currdatastatus.ULO_P1_Level1_H,
6512
                           &bluecell_Currdatastatus.ULO_Level1_H,
6579
                           &bluecell_Currdatastatus.ULO_Level1_H,
6513
                           &Det_UL1.Table_Det_15_dBm_H,
6580
                           &Det_UL1.Table_Det_15_dBm_H,
@@ -6524,6 +6591,7 @@ void ALC_Function(){ //DL
6524
                           &bluecell_Currdatastatus.ULO_Level4_H,
6591
                           &bluecell_Currdatastatus.ULO_Level4_H,
6525
                           &Det_UL4.Table_Det_15_dBm_H,
6592
                           &Det_UL4.Table_Det_15_dBm_H,
6526
                            ALC_Alarm_UL4_Index);            
6593
                            ALC_Alarm_UL4_Index);            
6594
+#endif // PYJ.2020.07.01_END -- 
6527
 
6595
 
6528
 
6596
 
6529
 #endif // PYJ.2020.06.21_END -- 
6597
 #endif // PYJ.2020.06.21_END -- 
@@ -6605,6 +6673,22 @@ void ALC_Function(){ //DL
6605
 #endif // PYJ.2020.06.20_END -- 
6673
 #endif // PYJ.2020.06.20_END -- 
6606
 
6674
 
6607
         }
6675
         }
6676
+        UL_Curr_Level(&bluecell_Currdatastatus.ULO_P1_Level1_H,
6677
+                      &bluecell_Currdatastatus.ULO_Level1_H,
6678
+                      &Det_UL1.Table_Det_15_dBm_H,
6679
+                       ALC_Alarm_UL1_Index);
6680
+        UL_Curr_Level(&bluecell_Currdatastatus.ULO_P2_Level2_H,
6681
+                      &bluecell_Currdatastatus.ULO_Level2_H,
6682
+                      &Det_UL2.Table_Det_15_dBm_H,
6683
+                       ALC_Alarm_UL2_Index);
6684
+        UL_Curr_Level(&bluecell_Currdatastatus.ULO_P3_Level3_H,
6685
+                      &bluecell_Currdatastatus.ULO_Level3_H,
6686
+                      &Det_UL3.Table_Det_15_dBm_H,
6687
+                       ALC_Alarm_UL3_Index);
6688
+        UL_Curr_Level(&bluecell_Currdatastatus.ULO_P4_Level4_H,
6689
+                      &bluecell_Currdatastatus.ULO_Level4_H,
6690
+                      &Det_UL4.Table_Det_15_dBm_H,
6691
+                       ALC_Alarm_UL4_Index);             
6608
     }
6692
     }
6609
 }
6693
 }
6610
 //-15 ~ -5
6694
 //-15 ~ -5

+ 1 - 1
Bluecell_Src/uart.c

@@ -120,7 +120,7 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
120
                if(Chksum_Check(uart_buf,MBIC_HEADER_SIZE - 4,uart_buf[MBIC_CHECKSHUM_INDEX]))
120
                if(Chksum_Check(uart_buf,MBIC_HEADER_SIZE - 4,uart_buf[MBIC_CHECKSHUM_INDEX]))
121
                {
121
                {
122
                     Length = ((uart_buf[MBIC_LENGTH_0] << 8) | uart_buf[MBIC_LENGTH_1]);
122
                     Length = ((uart_buf[MBIC_LENGTH_0] << 8) | uart_buf[MBIC_LENGTH_1]);
123
-                    CrcChk = ((uart_buf[MBIC_PAYLOADSTART + Length + 1] << 8) | (uart_buf[MBIC_PAYLOADSTART + Length + 2]));
123
+                    CrcChk = ((uart_buf[MBIC_PAYLOADSTART + Length ] << 8) | (uart_buf[MBIC_PAYLOADSTART + Length + 1]));
124
                     if(CRC16_Check(&uart_buf[MBIC_PAYLOADSTART], Length,CrcChk))
124
                     if(CRC16_Check(&uart_buf[MBIC_PAYLOADSTART], Length,CrcChk))
125
                         MBIC_Operate(uart_buf);
125
                         MBIC_Operate(uart_buf);
126
                     else
126
                     else

+ 1 - 1
STM32F103ZET_JDASMBIC.elf.launch

@@ -57,5 +57,5 @@
57
 </listAttribute>
57
 </listAttribute>
58
 <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
58
 <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
59
 <stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
59
 <stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
60
-<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="uart_buf,0x08005000,0x8005000,Bank2data,data,Currdata,Currdata[MBIC_BOOT_VERSION + 2],Bank1data,retrycnt,MBIC_DL_ShutdownCount,MBIC_DL_ShutdownCount[3],MBIC_DL_ShutdownCount[0],MBIC_DL_ShutdownCount[1],MBIC_DL_ShutdownCount[2],MBIC_DL_ShutdownCount[4]"/>
60
+<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x08005000,0x8005000,Bank2data,data,Currdata,Currdata[MBIC_BOOT_VERSION + 2],Bank1data,retrycnt,MBIC_DL_ShutdownCount,MBIC_DL_ShutdownCount[3],MBIC_DL_ShutdownCount[0],MBIC_DL_ShutdownCount[1],MBIC_DL_ShutdownCount[2],MBIC_DL_ShutdownCount[4],ALC_AlarmSet"/>
61
 </launchConfiguration>
61
 </launchConfiguration>