|
@@ -2099,7 +2099,10 @@ bool Bluecell_Operate(uint8_t* data){
|
2099
|
2099
|
uint16_t Length = 0;
|
2100
|
2100
|
switch(datatype){
|
2101
|
2101
|
case BLUECELL_SOFTWARERESET:
|
2102
|
|
-// printf("Bluecell Reset \r\n");
|
|
2102
|
+// for(int i = 0; i < 20; i++){
|
|
2103
|
+// printf("%02x ",data[i]);
|
|
2104
|
+// }
|
|
2105
|
+ printf("Bluecell Reset \r\n");
|
2103
|
2106
|
// Table_Init();
|
2104
|
2107
|
Table_LengSet();
|
2105
|
2108
|
// Table_LengSet();
|
|
@@ -7619,7 +7622,7 @@ void ADC_Check(void){
|
7619
|
7622
|
double ADC1DoubleRet[4];
|
7620
|
7623
|
double ADC3DoubleRet[5];
|
7621
|
7624
|
uint32_t ADC1_Average_value[ADC1_CNT];
|
7622
|
|
- static uint32_t HFR_ADC1_Average_value[ADC1_CNT];
|
|
7625
|
+ //static uint32_t HFR_ADC1_Average_value[ADC1_CNT];
|
7623
|
7626
|
uint32_t ADC3_Average_value[ADC3_CNT];
|
7624
|
7627
|
uint16_t MIN_ADC[ADC3_CNT] = {0,};
|
7625
|
7628
|
uint16_t cnt[ADC3_CNT] = {0,};
|
|
@@ -8588,7 +8591,7 @@ void ALC_Function(){ //DL
|
8588
|
8591
|
&bluecell_Currdatastatus.ATT_UL1_H,
|
8589
|
8592
|
&bluecell_Currdatastatus.bluecell_User_UL1_H,
|
8590
|
8593
|
&bluecell_Currdatastatus.ULO_Shutdown_Retry_Count1);
|
8591
|
|
-#if 0 // PYJ.2020.07.16_BEGIN --
|
|
8594
|
+#if 1 // PYJ.2020.07.16_BEGIN --
|
8592
|
8595
|
ALC_Package_Operate(&bluecell_Currdatastatus.ULO_P2_Level2_H,
|
8593
|
8596
|
&bluecell_Currdatastatus.ULO_Level2_H,
|
8594
|
8597
|
&Det_UL2.Table_Det_15_dBm_H,
|
|
@@ -8676,6 +8679,21 @@ int16_t New_AGC_Calc(int16_t threshold,int16_t CurrDet){
|
8676
|
8679
|
// printf("Attenret : %d \r\n",Attenret);
|
8677
|
8680
|
return Attenret;
|
8678
|
8681
|
}
|
|
8682
|
+int16_t HFR_AGC_Calc(int16_t threshold,double CurrDet){
|
|
8683
|
+ double Attenret = CurrDet;
|
|
8684
|
+ int16_t ret = 0;
|
|
8685
|
+ if(CurrDet < 0){
|
|
8686
|
+ ret = CurrDet + 0.6; //current Atten
|
|
8687
|
+ ret = threshold - ret;
|
|
8688
|
+ }
|
|
8689
|
+// else{
|
|
8690
|
+// ret = CurrDet - 0.6; //current Atten
|
|
8691
|
+// ret = ret + threshold;
|
|
8692
|
+// }
|
|
8693
|
+
|
|
8694
|
+
|
|
8695
|
+ return ret * -1;
|
|
8696
|
+}
|
8679
|
8697
|
|
8680
|
8698
|
|
8681
|
8699
|
//bool AGC_AlarmTimerSet[AGC_Alarm_DL_Index_MAX] = {false,};
|
|
@@ -8742,7 +8760,8 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8742
|
8760
|
int16_t ResultData = 0;
|
8743
|
8761
|
int8_t* AGC_Table;// = &DL_DET_Table_ref[MBIC_Table_DL1_INDEX][TABLE_MAX_VALUE];
|
8744
|
8762
|
int16_t FRBT_Atten = 0;
|
8745
|
|
- static int16_t RefValue[AGC_Alarm_DL_Index_MAX] = {0,};
|
|
8763
|
+ //static int16_t RefValue[AGC_Alarm_DL_Index_MAX] = {0,};
|
|
8764
|
+ //static float Ref_F_Value[AGC_Alarm_DL_Index_MAX] = {0,};
|
8746
|
8765
|
FRBT_Atten = FRBT[DLI_AGC_H] << 8 | FRBT[DLI_AGC_L];
|
8747
|
8766
|
FRBT_Atten *= 0.1;
|
8748
|
8767
|
|
|
@@ -8772,10 +8791,19 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8772
|
8791
|
}
|
8773
|
8792
|
if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL){
|
8774
|
8793
|
IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
|
|
8794
|
+ IwillgiveAtten *= -1;
|
8775
|
8795
|
}
|
8776
|
8796
|
#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
8777
|
|
- printf("==================================\r\n");
|
|
8797
|
+ printf("==================================\r\n");
|
|
8798
|
+ if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL){
|
|
8799
|
+
|
|
8800
|
+ bluecell_Currdatastatus.DLI_FRBT_Status = FRBT_IDEL;
|
|
8801
|
+ bluecell_Currdatastatus.DLI_FRBT_D_Day = 0;
|
|
8802
|
+ FRBT_UserCtrl_Set(true);
|
|
8803
|
+ }
|
|
8804
|
+
|
8778
|
8805
|
#endif // PYJ.2020.10.23_END --
|
|
8806
|
+#if 0 // PYJ.2020.10.29_BEGIN --
|
8779
|
8807
|
if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
|
8780
|
8808
|
ResdBm = Round_ResdBm_Ret = Bluecell_RoundCalc(Temp_ResdBm);
|
8781
|
8809
|
IwillgiveAtten = New_AGC_Calc(Limitdata,ResdBm);
|
|
@@ -8805,6 +8833,7 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8805
|
8833
|
if(Round_ResdBm_Ret > RefValue[Tableindex] - 1.5 && RefValue[Tableindex] != 0){
|
8806
|
8834
|
if(CurrAtten < (IwillgiveAtten * -1)){
|
8807
|
8835
|
if(((Limitdata + (CurrAtten * -1)) - 1.5) <= Temp_ResdBm){
|
|
8836
|
+// IwillgiveAtten = HFR_AGC_Calc(Limitdata,Temp_ResdBm);
|
8808
|
8837
|
#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
8809
|
8838
|
printf("4Curr ATTEN %d \r\n",CurrAtten );
|
8810
|
8839
|
printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
|
|
@@ -8819,18 +8848,16 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8819
|
8848
|
else
|
8820
|
8849
|
{
|
8821
|
8850
|
#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
8822
|
|
- printf("2Curr ATTEN %d \r\n",CurrAtten );
|
8823
|
|
- printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
|
8824
|
|
- printf("Temp_ResdBm : DL%d : %f \r\n",Tableindex+1,Temp_ResdBm);
|
8825
|
|
- printf("I WILL GIVE YOU ATTEN : %d\r\n",IwillgiveAtten);
|
8826
|
|
- printf("AGC : %d\r\n",Limitdata);
|
|
8851
|
+ printf("2Curr ATTEN %d \r\n",CurrAtten );
|
|
8852
|
+ printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
|
|
8853
|
+ printf("Temp_ResdBm : DL%d : %f \r\n",Tableindex+1,Temp_ResdBm);
|
|
8854
|
+ printf("I WILL GIVE YOU ATTEN : %d\r\n",IwillgiveAtten);
|
|
8855
|
+ printf("AGC : %d\r\n",Limitdata);
|
8827
|
8856
|
#endif // PYJ.2020.10.23_END --
|
8828
|
8857
|
RefValue[Tableindex] = Round_ResdBm_Ret;
|
8829
|
8858
|
return;
|
8830
|
|
-
|
8831
|
8859
|
}
|
8832
|
8860
|
|
8833
|
|
-
|
8834
|
8861
|
if(Limitdata == ResdBm){
|
8835
|
8862
|
IwillgiveAtten = CurrAtten;
|
8836
|
8863
|
}
|
|
@@ -8838,11 +8865,43 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8838
|
8865
|
IwillgiveAtten = 0;
|
8839
|
8866
|
// RefValue = Round_ResdBm_Ret;
|
8840
|
8867
|
}
|
|
8868
|
+#else
|
|
8869
|
+
|
|
8870
|
+ if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL){
|
|
8871
|
+ int16_t Ref_A = Limitdata - CurrAtten;
|
|
8872
|
+ float Ref_Ret = 0;
|
|
8873
|
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
|
8874
|
+ printf("Ref_A : %d \r\n",Ref_A);
|
|
8875
|
+ printf("CurrAtten : %d \r\n",CurrAtten);
|
|
8876
|
+#endif
|
|
8877
|
+ if(Ref_A + 0.5 < Temp_ResdBm){
|
|
8878
|
+ Ref_Ret = Limitdata - Temp_ResdBm;
|
|
8879
|
+ IwillgiveAtten = Bluecell_RoundCalc(Ref_Ret);
|
|
8880
|
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
|
8881
|
+ printf("True 2.1 IwillgiveAtten : %d \r\n",IwillgiveAtten);
|
|
8882
|
+#endif
|
|
8883
|
+ }else{
|
|
8884
|
+ if(Ref_A - 1.5 > Temp_ResdBm){
|
|
8885
|
+ IwillgiveAtten = CurrAtten + 1;
|
|
8886
|
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
|
8887
|
+ printf("True 3 IwillgiveAtten : %d \r\n",IwillgiveAtten);
|
|
8888
|
+#endif
|
|
8889
|
+ }else{
|
|
8890
|
+ IwillgiveAtten = CurrAtten;
|
|
8891
|
+#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
|
8892
|
+ printf("false 4 IwillgiveAtten : %d \r\n",IwillgiveAtten);
|
|
8893
|
+#endif
|
|
8894
|
+ }
|
|
8895
|
+ }
|
|
8896
|
+ }
|
|
8897
|
+
|
|
8898
|
+#endif // PYJ.2020.10.29_END --
|
|
8899
|
+
|
8841
|
8900
|
|
8842
|
|
- IwillgiveAtten *= -1;
|
8843
|
8901
|
|
8844
|
8902
|
#if AGC_PRINT // PYJ.2020.10.23_BEGIN --
|
8845
|
|
- printf("3Curr ATTEN %d \r\n",CurrAtten );
|
|
8903
|
+ printf("Result Curr ATTEN %d \r\n",CurrAtten );
|
|
8904
|
+ printf("ResdBm : %d\r\n",ResdBm);
|
8846
|
8905
|
printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
|
8847
|
8906
|
printf("Temp_ResdBm : DL%d : %f \r\n",Tableindex+1,Temp_ResdBm);
|
8848
|
8907
|
printf("I WILL GIVE YOU ATTEN : %d\r\n",IwillgiveAtten);
|
|
@@ -8859,9 +8918,10 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8859
|
8918
|
|
8860
|
8919
|
|
8861
|
8920
|
if(bluecell_Currdatastatus.DLI_FRBT_Status == FRBT_IDEL && bluecell_Currdatastatus.DLI_FRBT_D_Day == 0){
|
|
8921
|
+#if 0 // PYJ.2020.10.30_BEGIN --
|
8862
|
8922
|
if(Limitdata != ResdBm){
|
8863
|
|
- if(CurrAtten + ResdBm <= Limitdata - 1)
|
8864
|
|
- IwillgiveAtten = ((CurrAtten) + 1);
|
|
8923
|
+// if(CurrAtten + ResdBm <= Limitdata - 1)
|
|
8924
|
+// IwillgiveAtten = ((CurrAtten) + 1);
|
8865
|
8925
|
if(CurrAtten == 0)
|
8866
|
8926
|
if(IwillgiveAtten > 0)
|
8867
|
8927
|
IwillgiveAtten = 0;
|
|
@@ -8870,9 +8930,11 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8870
|
8930
|
DL_PrevIwillgiveAtten[Tableindex] = IwillgiveAtten;
|
8871
|
8931
|
DL_MainAtten[DLI_AGC_H] = ((((IwillgiveAtten) * 10) & 0xFF00) >> 8) ;
|
8872
|
8932
|
DL_MainAtten[DLI_AGC_L] = ((((IwillgiveAtten) * 10) & 0x00FF));
|
8873
|
|
-// printf("Apply 2 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 | DL_MainAtten[DLI_AGC_L]));
|
|
8933
|
+ printf("Apply 2 Curr ATTEN %d \r\n", (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 | DL_MainAtten[DLI_AGC_L]));
|
8874
|
8934
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
8875
|
|
- }else{
|
|
8935
|
+ }
|
|
8936
|
+
|
|
8937
|
+ else{
|
8876
|
8938
|
if(Limitdata == ResdBm){
|
8877
|
8939
|
IwillgiveAtten = 0;
|
8878
|
8940
|
DL_MainAtten[DLI_AGC_H] = ((((IwillgiveAtten) * 10) & 0xFF00) >> 8) ;
|
|
@@ -8882,6 +8944,12 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
8882
|
8944
|
|
8883
|
8945
|
|
8884
|
8946
|
}
|
|
8947
|
+#else
|
|
8948
|
+ DL_MainAtten[DLI_AGC_H] = ((((IwillgiveAtten) * 10) & 0xFF00) >> 8) ;
|
|
8949
|
+ DL_MainAtten[DLI_AGC_L] = ((((IwillgiveAtten) * 10) & 0x00FF));
|
|
8950
|
+ CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
8951
|
+
|
|
8952
|
+#endif // PYJ.2020.10.30_END --
|
8885
|
8953
|
}
|
8886
|
8954
|
else if(bluecell_Currdatastatus.DLI_FRBT_Status != FRBT_IDEL && (ResdBm + CurrAtten) > Limitdata && DL_PrevIwillgiveAtten[Tableindex] > IwillgiveAtten){
|
8887
|
8955
|
// printf("IwillgiveAtten : %d \r\n",IwillgiveAtten);
|