Bladeren bron

Temperature Offset 주는 함수 생성
규격을 넘는 값이 생성 되었을 경우 Max치 Min값으로 적용

PYJ 4 jaren geleden
bovenliggende
commit
c1623ec426
2 gewijzigde bestanden met toevoegingen van 49 en 12 verwijderingen
  1. 2 2
      Bluecell_Inc/Bluecell_operate.h
  2. 47 10
      Bluecell_Src/Bluecell_operate.c

+ 2 - 2
Bluecell_Inc/Bluecell_operate.h

@@ -798,7 +798,7 @@ typedef struct{
798 798
     uint8_t ATT_UL2_PATH;
799 799
     uint8_t ATT_UL3_PATH;
800 800
     uint8_t ATT_UL4_PATH;
801
-    uint8_t ATT_DL1_H;
801
+    uint8_t ATT_DL1_H;/*Real Level*/
802 802
     uint8_t ATT_DL1_L;
803 803
     uint8_t ATT_DL2_H;
804 804
     uint8_t ATT_DL2_L;
@@ -814,7 +814,7 @@ typedef struct{
814 814
     uint8_t ATT_UL3_L;
815 815
     uint8_t ATT_UL4_H;
816 816
     uint8_t ATT_UL4_L;
817
-    uint8_t ULO_P1_Level1_H;
817
+    uint8_t ULO_P1_Level1_H;/*ADC Value*/
818 818
     uint8_t ULO_P1_Level1_L;
819 819
     uint8_t ULO_P2_Level2_H;
820 820
     uint8_t ULO_P2_Level2_L;

+ 47 - 10
Bluecell_Src/Bluecell_operate.c

@@ -113,6 +113,8 @@ void TimeSetting(uint8_t* data);
113 113
 void Temp_Shutdown_ONOFF(uint8_t val);
114 114
 
115 115
 void UL_Path_OnOff(uint8_t Index,uint8_t value,uint8_t* path,uint8_t* PrevAtten,uint8_t* retrycnt,uint8_t* PrevRetryCnt);
116
+int16_t Temperature_Offset_Get(int8_t* Temp_Table,int8_t CurrTemp);
117
+
116 118
 /***************************************************************************************/
117 119
 /*                                  Valuable                                           */
118 120
 /***************************************************************************************/
@@ -4832,9 +4834,9 @@ void Carrier_ONOFF(uint8_t val){
4832 4834
     }
4833 4835
 }
4834 4836
 void Temp_Shutdown_ONOFF(uint8_t val){
4835
-    printf("val :%d \r\n",val);
4836
-    printf("Path_TempShutdown_Set : %d \r\n",bluecell_Currdatastatus.Path_TempShutdown_Set);    
4837
-    printf(" bluecell_Currdatastatus.Path_TempSave_Bit : %x \r\n", bluecell_Currdatastatus.Path_TempSave_Bit);
4837
+//    printf("val :%d \r\n",val);
4838
+//    printf("Path_TempShutdown_Set : %d \r\n",bluecell_Currdatastatus.Path_TempShutdown_Set);    
4839
+//    printf(" bluecell_Currdatastatus.Path_TempSave_Bit : %x \r\n", bluecell_Currdatastatus.Path_TempSave_Bit);
4838 4840
     if(val == 1){// ON //Path ON
4839 4841
 #if 0 // PYJ.2020.08.14_BEGIN -- 
4840 4842
          bluecell_Currdatastatus.ATT_DL1_PATH= TempShutdown_DL_SaveData[0];    
@@ -4885,7 +4887,7 @@ void Temp_Shutdown_ONOFF(uint8_t val){
4885 4887
             bluecell_Currdatastatus.ATT_UL4_PATH = true;
4886 4888
         else
4887 4889
             bluecell_Currdatastatus.ATT_UL4_PATH = false;
4888
-          printf("Path ON \r\n");
4890
+//          printf("Path ON \r\n");
4889 4891
 
4890 4892
     }
4891 4893
     else{// OFF
@@ -4910,7 +4912,7 @@ void Temp_Shutdown_ONOFF(uint8_t val){
4910 4912
         bluecell_Currdatastatus.ATT_UL2_PATH = false;    
4911 4913
         bluecell_Currdatastatus.ATT_UL3_PATH = false;    
4912 4914
         bluecell_Currdatastatus.ATT_UL4_PATH = false;   
4913
-        printf("Path OOF \r\n");
4915
+//        printf("Path OFF \r\n");
4914 4916
         bluecell_Currdatastatus.ALARM_TEMP_HIGH = 0;
4915 4917
         bluecell_Currdatastatus.ALARM_DLI_Level = 0;
4916 4918
         bluecell_Currdatastatus.ALARM_DLI_SHTUTDOWN = 0;
@@ -5373,10 +5375,10 @@ bool MBIC_Operate(uint8_t* data){
5373 5375
                 break;
5374 5376
             case Temp_Shutdown_Path_ON_OFF:
5375 5377
                 bluecell_Currdatastatus.Path_TempShutdown_Set = data[MBIC_PAYLOADSTART + 3];
5376
-                printf("bluecell_Currdatastatus.Path_TempShutdown_Set : %d \r\n",bluecell_Currdatastatus.Path_TempShutdown_Set);
5378
+//                printf("bluecell_Currdatastatus.Path_TempShutdown_Set : %d \r\n",bluecell_Currdatastatus.Path_TempShutdown_Set);
5377 5379
                 Temp_Shutdown_ONOFF(bluecell_Currdatastatus.Path_TempShutdown_Set);
5378
-                printf("bluecell_Currdatastatus.Path_TempShutdown_Set : %d \r\n",bluecell_Currdatastatus.Path_TempShutdown_Set);                
5379
-                printf(" bluecell_Currdatastatus.ATT_DL1_PATH : %d \r\n", bluecell_Currdatastatus.ATT_DL1_PATH);
5380
+//                printf("bluecell_Currdatastatus.Path_TempShutdown_Set : %d \r\n",bluecell_Currdatastatus.Path_TempShutdown_Set);                
5381
+//                printf(" bluecell_Currdatastatus.ATT_DL1_PATH : %d \r\n", bluecell_Currdatastatus.ATT_DL1_PATH);
5380 5382
                 break;
5381 5383
             case  Carrier_ON_OFF                          :
5382 5384
                 bluecell_Currdatastatus.Carrier_ON_OFF = data[MBIC_PAYLOADSTART + 3]; 
@@ -8156,7 +8158,12 @@ int16_t ResultData = 0;
8156 8158
     //ret 현재 Voltage 값 출력
8157 8159
     //ret 에 따른 현재 DBM 구현
8158 8160
     ResdBm = HFR_CntUpCalc(ResdBm);
8161
+    ResdBm += Temperature_Offset_Get(&Temp_UL1.Table_1_Temp,bluecell_Currdatastatus.DET_TEMP);
8159 8162
     ResultData = ResdBm;// + bluecell_Currdatastatus.UL_Det_Path_Offset[TableIndex];
8163
+    if(ResultData < -60)
8164
+        ResultData = -60;
8165
+    else if(ResultData > -15)
8166
+        ResultData = -15;    
8160 8167
 //    printf("HFR CALC RET : %d \r\n",ResultData);
8161 8168
     ULO_Level[ULO_ALC_H] = (ResultData & 0xFF00) >> 8;
8162 8169
     ULO_Level[ULO_ALC_L] = (ResultData & 0x00FF);  
@@ -8412,6 +8419,32 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
8412 8419
 
8413 8420
 }
8414 8421
 #endif // PYJ.2020.06.27_END -- 
8422
+
8423
+/*
8424
+
8425
+bluecell_Currdatastatus.DET_TEMP
8426
+
8427
+*/
8428
+int16_t Temperature_Offset_Get(int8_t* Temp_Table,int8_t CurrTemp){
8429
+    int8_t Ref_Temperature = -10;
8430
+    int16_t Curr_Level_Offset_ret = 0;
8431
+    uint8_t index = 0;
8432
+    for(int i = Ref_Temperature; i < 60; i += 5){
8433
+//            printf("about Temp : %d \r\n",i);
8434
+        if(CurrTemp >= i && CurrTemp < i + 5){
8435
+//            printf("Origin Temp : %d    Aboud Temp : %d,index : %d \r\n",CurrTemp,i,index);
8436
+            Curr_Level_Offset_ret = (int8_t)(Temp_Table[index]/ 4);// (Temp_Table[(index  * 2)] << 8 | Temp_Table[(index  * 2) + 1]) / 4;
8437
+        }
8438
+        index++;
8439
+    }
8440
+//    printf("Curr_Level_Offset_ret : %x \r\n",Curr_Level_Offset_ret);
8441
+    return Curr_Level_Offset_ret;
8442
+//    printf("Curr Temperature : %d \r\n",CurrTemp);    
8443
+//    printf(",Temp_Table[0] : %x \r\n",Temp_Table[0]);
8444
+//    printf(",Temp_Table[1] : %x \r\n",Temp_Table[1]);        
8445
+//    printf("Temp Table : %x \r\n",Temp_Table[0] << 8 | Temp_Table[1]);
8446
+
8447
+}
8415 8448
 typedef enum{
8416 8449
     DL_Level_H,
8417 8450
     DL_Level_L,        
@@ -8426,7 +8459,13 @@ void DL_Det_Function(uint8_t Table_Num,uint8_t* CurrADC_Level,DET_TABLEDL_st* DL
8426 8459
     Levelret = (int16_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&DL_Table->Table_Det5_dBm_H,DL_Table->Table_Length,AGC_Table));
8427 8460
 //    Levelret += bluecell_Currdatastatus.DL_Det_ALL_Offset;
8428 8461
 
8462
+    Levelret += Temperature_Offset_Get(&Temp_DL1.Table_1_Temp,bluecell_Currdatastatus.DET_TEMP);
8463
+    if(Levelret < -25)
8464
+        Levelret = -25;
8465
+    else if(Levelret > 7)
8466
+        Levelret = 7;
8429 8467
 //    printf("Levelret %d : %d \r\n",Table_Num + 1,Levelret);
8468
+
8430 8469
     Level[DL_Level_H] = (Levelret & 0xFF00) >> 8;
8431 8470
     Level[DL_Level_L] = (Levelret & 0x00FF);
8432 8471
     
@@ -8449,8 +8488,6 @@ void AGC_Function(){//DL
8449 8488
     };
8450 8489
          
8451 8490
     if(AGCTimerCnt > 500){
8452
-        
8453
-
8454 8491
         if(bluecell_Currdatastatus.DLI_AGC_ON_OFF == true){
8455 8492
             
8456 8493
             Limitdata = (( bluecell_Currdatastatus.DLI_AGC_Threshold_H << 8) & 0xFF00) ;