|
@@ -24,6 +24,7 @@ extern volatile bool AlarmTimerOnSet;
|
24
|
24
|
extern volatile bool AlarmTimerOffSet;
|
25
|
25
|
extern volatile uint32_t AlarmTimerOnCnt;
|
26
|
26
|
extern volatile uint32_t AlarmTimerOffCnt;
|
|
27
|
+extern volatile uint32_t AGCAlarmTimerCnt[AGC_Alarm_DL_Index_MAX];
|
27
|
28
|
|
28
|
29
|
extern ALL_PE43711_st ALL_ATT;
|
29
|
30
|
extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
|
|
@@ -882,12 +883,6 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
882
|
883
|
#endif // PYJ.2020.05.25_END --
|
883
|
884
|
|
884
|
885
|
|
885
|
|
-void Bluecell_StructCopyFunction(uint16_t* dst,uint8_t* src,uint16_t size){
|
886
|
|
- for(int i = 0; i < size / 2; i++){
|
887
|
|
- dst[i] = ((src[i * 2] << 8) & 0xFF00);
|
888
|
|
- dst[i] += src[i * 2 + 1] & 0x00FF;
|
889
|
|
- }
|
890
|
|
-}
|
891
|
886
|
|
892
|
887
|
void Bluecell_StructCpy(uint8_t* dst,uint8_t* src,uint16_t size){
|
893
|
888
|
for(int i = 0; i < size; i++){
|
|
@@ -3227,7 +3222,7 @@ typedef enum{
|
3227
|
3222
|
ALC_Alarm_UL_Index_MAX,
|
3228
|
3223
|
};
|
3229
|
3224
|
|
3230
|
|
-uint8_t AlarmSet[ALC_Alarm_UL_Index_MAX] = {0,};
|
|
3225
|
+uint8_t ALC_AlarmSet[ALC_Alarm_UL_Index_MAX] = {0,};
|
3231
|
3226
|
double ALC_Calc(uint8_t num,double CurrAtten ,int8_t threshold,double CurrDet){
|
3232
|
3227
|
double ret = 0;
|
3233
|
3228
|
// ret = CurrDet - threshold;
|
|
@@ -3243,7 +3238,7 @@ double ALC_Calc(uint8_t num,double CurrAtten ,int8_t threshold,double CurrDet){
|
3243
|
3238
|
printf("6. %f : %f %d\r\n",ret,CurrDet,threshold);
|
3244
|
3239
|
}
|
3245
|
3240
|
}else{
|
3246
|
|
- AlarmSet[num] = true;
|
|
3241
|
+ ALC_AlarmSet[num] = true;
|
3247
|
3242
|
}
|
3248
|
3243
|
printf("4. %f : %f %d\r\n",ret,CurrDet,threshold);
|
3249
|
3244
|
return ret;
|
|
@@ -3270,12 +3265,12 @@ double ALC_Calc(uint8_t num,double CurrAtten ,int8_t threshold,double CurrDet){
|
3270
|
3265
|
ret = CurrAtten * -1;
|
3271
|
3266
|
// printf("3. ret0 : %f \r\n",ret);
|
3272
|
3267
|
}else{
|
3273
|
|
- AlarmSet[num] = false;
|
|
3268
|
+ ALC_AlarmSet[num] = false;
|
3274
|
3269
|
}
|
3275
|
3270
|
|
3276
|
3271
|
if(CurrAtten + ret > 20){
|
3277
|
3272
|
ret = 20 - CurrAtten;
|
3278
|
|
- AlarmSet[num] = true;
|
|
3273
|
+ ALC_AlarmSet[num] = true;
|
3279
|
3274
|
}
|
3280
|
3275
|
// printf("ret3 : %f \r\n",ret);
|
3281
|
3276
|
return ret;
|
|
@@ -3499,6 +3494,44 @@ int8_t AGC_Calc(int8_t threshold,int8_t CurrDet){
|
3499
|
3494
|
// printf("Attenret : %d \r\n",Attenret);
|
3500
|
3495
|
return Attenret;
|
3501
|
3496
|
}
|
|
3497
|
+
|
|
3498
|
+bool AGC_AlarmSet[AGC_Alarm_DL_Index_MAX] = {0,};
|
|
3499
|
+bool AGC_AlarmTimerSet[AGC_Alarm_DL_Index_MAX] = {false,};
|
|
3500
|
+void AGC_Alarm_Check(uint8_t Path_Index,double AGC_Det,uint8_t* AGC_Table,uint16_t CurrAtten){
|
|
3501
|
+ double TableAdc = 0;
|
|
3502
|
+ double PrevTableAdc = 0;
|
|
3503
|
+ double step = 0;
|
|
3504
|
+
|
|
3505
|
+ TableAdc = AGC_Table[0] << 8;
|
|
3506
|
+ TableAdc += AGC_Table[1];
|
|
3507
|
+ TableAdc /= 1000;
|
|
3508
|
+
|
|
3509
|
+
|
|
3510
|
+ PrevTableAdc = AGC_Table[2] << 8;
|
|
3511
|
+ PrevTableAdc += AGC_Table[3];
|
|
3512
|
+ PrevTableAdc /= 1000;
|
|
3513
|
+
|
|
3514
|
+ step = TableAdc - PrevTableAdc;
|
|
3515
|
+
|
|
3516
|
+
|
|
3517
|
+ if(AGC_Det > TableAdc + step){/*Alarm Enable*/
|
|
3518
|
+ AGC_AlarmSet[Path_Index] = true; /*Alarm Check val*/
|
|
3519
|
+ AGC_AlarmTimerSet[Path_Index] = false;/*Alarm Timer Setting Val*/
|
|
3520
|
+ AGCAlarmTimerCnt[Path_Index] = 0;/*Alarm Time Cnt Val*/
|
|
3521
|
+ printf("AGC ALARM ON %d \r\n",Path_Index + 1);
|
|
3522
|
+ }else{/*Alarm Disable*/
|
|
3523
|
+ if(AGC_AlarmSet[Path_Index] == true && CurrAtten <= 18){/*Alarm Disalbe Condition*/
|
|
3524
|
+ AGC_AlarmTimerSet[Path_Index] = true;
|
|
3525
|
+ }else{/*Alarm Disalbe Fail*/
|
|
3526
|
+ AGC_AlarmTimerSet[Path_Index] = false;
|
|
3527
|
+ AGCAlarmTimerCnt[Path_Index] = 0;
|
|
3528
|
+ }
|
|
3529
|
+ if(AGCAlarmTimerCnt[Path_Index] > 3000){
|
|
3530
|
+ AGC_AlarmSet[Path_Index] = false;
|
|
3531
|
+ }
|
|
3532
|
+ }
|
|
3533
|
+
|
|
3534
|
+}
|
3502
|
3535
|
void AGC_Function(){//DL
|
3503
|
3536
|
double ret = 0;
|
3504
|
3537
|
int8_t ResdBm = 0;
|
|
@@ -3528,6 +3561,9 @@ void AGC_Function(){//DL
|
3528
|
3561
|
ret = bluecell_Currdatastatus.DET_DL1_IN_H << 8;
|
3529
|
3562
|
ret += bluecell_Currdatastatus.DET_DL1_IN_L;
|
3530
|
3563
|
ret *= 0.001;
|
|
3564
|
+
|
|
3565
|
+
|
|
3566
|
+
|
3531
|
3567
|
ResdBm = (int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&Det_DL1.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st)));
|
3532
|
3568
|
for(i = 0; i < sizeof(AGC_dBm_t); i++){
|
3533
|
3569
|
if(AGC_Table_ref[i] == ResdBm)
|
|
@@ -3546,6 +3582,7 @@ void AGC_Function(){//DL
|
3546
|
3582
|
// HAL_Delay(1000);
|
3547
|
3583
|
|
3548
|
3584
|
IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
|
|
3585
|
+ AGC_Alarm_Check(AGC_Alarm_DL1_Index,ret,&Det_DL1.Table_Det5_dBm_H,IwillgiveAtten);
|
3549
|
3586
|
bluecell_Currdatastatus.ATT_DL1_H = (((IwillgiveAtten * 10) & 0xFF00) >> 8) ;
|
3550
|
3587
|
bluecell_Currdatastatus.ATT_DL1_L = (((IwillgiveAtten * 10) & 0x00FF));
|
3551
|
3588
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
@@ -3559,6 +3596,7 @@ void AGC_Function(){//DL
|
3559
|
3596
|
ret = bluecell_Currdatastatus.DET_DL2_IN_H << 8;
|
3560
|
3597
|
ret += bluecell_Currdatastatus.DET_DL2_IN_L;
|
3561
|
3598
|
ret *= 0.001;
|
|
3599
|
+
|
3562
|
3600
|
ResdBm = (int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&Det_DL2.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st)));
|
3563
|
3601
|
for(i = 0; i < sizeof(AGC_dBm_t); i++){
|
3564
|
3602
|
if(AGC_Table_ref[i] == ResdBm)
|
|
@@ -3577,6 +3615,8 @@ void AGC_Function(){//DL
|
3577
|
3615
|
// HAL_Delay(1000);
|
3578
|
3616
|
|
3579
|
3617
|
IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
|
|
3618
|
+ AGC_Alarm_Check(AGC_Alarm_DL2_Index,ret,&Det_DL2.Table_Det5_dBm_H,IwillgiveAtten);
|
|
3619
|
+
|
3580
|
3620
|
bluecell_Currdatastatus.ATT_DL2_H = (((IwillgiveAtten * 10) & 0xFF00) >> 8) ;
|
3581
|
3621
|
bluecell_Currdatastatus.ATT_DL2_L = (((IwillgiveAtten * 10) & 0x00FF));
|
3582
|
3622
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
@@ -3587,6 +3627,7 @@ void AGC_Function(){//DL
|
3587
|
3627
|
ret = bluecell_Currdatastatus.DET_DL3_IN_H << 8;
|
3588
|
3628
|
ret += bluecell_Currdatastatus.DET_DL3_IN_L;
|
3589
|
3629
|
ret *= 0.001;
|
|
3630
|
+
|
3590
|
3631
|
ResdBm = (int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&Det_DL3.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st)));
|
3591
|
3632
|
for(i = 0; i < sizeof(AGC_dBm_t); i++){
|
3592
|
3633
|
if(AGC_Table_ref[i] == ResdBm)
|
|
@@ -3605,6 +3646,8 @@ void AGC_Function(){//DL
|
3605
|
3646
|
// HAL_Delay(1000);
|
3606
|
3647
|
|
3607
|
3648
|
IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
|
|
3649
|
+ AGC_Alarm_Check(AGC_Alarm_DL3_Index,ret,&Det_DL3.Table_Det5_dBm_H,IwillgiveAtten);
|
|
3650
|
+
|
3608
|
3651
|
bluecell_Currdatastatus.ATT_DL3_H = (((IwillgiveAtten * 10) & 0xFF00) >> 8) ;
|
3609
|
3652
|
bluecell_Currdatastatus.ATT_DL3_L = (((IwillgiveAtten * 10) & 0x00FF));
|
3610
|
3653
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
@@ -3635,6 +3678,7 @@ void AGC_Function(){//DL
|
3635
|
3678
|
// HAL_Delay(1000);
|
3636
|
3679
|
|
3637
|
3680
|
IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
|
|
3681
|
+ AGC_Alarm_Check(AGC_Alarm_DL4_Index,ret,&Det_DL4.Table_Det5_dBm_H,IwillgiveAtten);
|
3638
|
3682
|
bluecell_Currdatastatus.ATT_DL4_H = (((IwillgiveAtten * 10) & 0xFF00) >> 8) ;
|
3639
|
3683
|
bluecell_Currdatastatus.ATT_DL4_L = (((IwillgiveAtten * 10) & 0x00FF));
|
3640
|
3684
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
@@ -3703,7 +3747,7 @@ void Alarm_Check(){
|
3703
|
3747
|
|
3704
|
3748
|
#endif // PYJ.2020.05.23_END --
|
3705
|
3749
|
/*4개의 디텍 중에 한개라도 상한치를 넘었을 경우 알림 */
|
3706
|
|
- if(AlarmSet[ALC_Alarm_UL1_Index] == true){
|
|
3750
|
+ if(ALC_AlarmSet[ALC_Alarm_UL1_Index] == true){
|
3707
|
3751
|
printf("ULO_ALC_Alarm1 OCCUR\r\n");
|
3708
|
3752
|
bluecell_Currdatastatus.ALARM_ULO_Level |= ALARM_ULO_P1_LEVEL_HIGH;
|
3709
|
3753
|
bluecell_Currdatastatus.ULO_ALC_Alarm1 = true;
|
|
@@ -3712,7 +3756,7 @@ void Alarm_Check(){
|
3712
|
3756
|
bluecell_Currdatastatus.ULO_ALC_Alarm1 = false;
|
3713
|
3757
|
}
|
3714
|
3758
|
|
3715
|
|
- if(AlarmSet[ALC_Alarm_UL2_Index] == true){
|
|
3759
|
+ if(ALC_AlarmSet[ALC_Alarm_UL2_Index] == true){
|
3716
|
3760
|
printf("ULO_ALC_Alarm2 OCCUR\r\n");
|
3717
|
3761
|
bluecell_Currdatastatus.ALARM_ULO_Level |= ALARM_ULO_P2_LEVEL_HIGH;
|
3718
|
3762
|
bluecell_Currdatastatus.ULO_ALC_Alarm2 = true;
|
|
@@ -3720,7 +3764,7 @@ void Alarm_Check(){
|
3720
|
3764
|
bluecell_Currdatastatus.ALARM_ULO_Level &= ~ALARM_ULO_P2_LEVEL_HIGH;
|
3721
|
3765
|
bluecell_Currdatastatus.ULO_ALC_Alarm2 = false;
|
3722
|
3766
|
}
|
3723
|
|
- if(AlarmSet[ALC_Alarm_UL3_Index] == true){
|
|
3767
|
+ if(ALC_AlarmSet[ALC_Alarm_UL3_Index] == true){
|
3724
|
3768
|
printf("ULO_ALC_Alarm3 OCCUR\r\n");
|
3725
|
3769
|
bluecell_Currdatastatus.ALARM_ULO_Level |= ALARM_ULO_P3_LEVEL_HIGH;
|
3726
|
3770
|
bluecell_Currdatastatus.ULO_ALC_Alarm3 = true;
|
|
@@ -3728,7 +3772,7 @@ void Alarm_Check(){
|
3728
|
3772
|
bluecell_Currdatastatus.ALARM_ULO_Level &= ~ALARM_ULO_P3_LEVEL_HIGH;
|
3729
|
3773
|
bluecell_Currdatastatus.ULO_ALC_Alarm3 = false;
|
3730
|
3774
|
}
|
3731
|
|
- if(AlarmSet[ALC_Alarm_UL4_Index] == true){
|
|
3775
|
+ if(ALC_AlarmSet[ALC_Alarm_UL4_Index] == true){
|
3732
|
3776
|
printf("ULO_ALC_Alarm4 OCCUR\r\n");
|
3733
|
3777
|
bluecell_Currdatastatus.ALARM_ULO_Level |= ALARM_ULO_P4_LEVEL_HIGH;
|
3734
|
3778
|
bluecell_Currdatastatus.ULO_ALC_Alarm4 = true;
|
|
@@ -3863,14 +3907,14 @@ void Alarm_Check(){
|
3863
|
3907
|
temp = ((bluecell_Currdatastatus.ATT_DL1_H << 8) & 0xFF00);
|
3864
|
3908
|
temp += (bluecell_Currdatastatus.ATT_DL1_L & 0x00FF);
|
3865
|
3909
|
temp /= 10;
|
3866
|
|
- if(temp >= 15){
|
|
3910
|
+ if(AGC_AlarmSet[AGC_Alarm_DL1_Index] == true){
|
3867
|
3911
|
printf("ALARM_AGC_P1 OCCUR\r\n");
|
3868
|
3912
|
bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm |= ALARM_AGC_P1;
|
3869
|
3913
|
bluecell_Currdatastatus.DLI_AGC_Alarm1 = true;
|
3870
|
3914
|
}else{
|
3871
|
3915
|
bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm &= ~ALARM_AGC_P1;
|
3872
|
3916
|
}
|
3873
|
|
- if( temp < ResdBm[1]){
|
|
3917
|
+ if(AGC_AlarmSet[AGC_Alarm_DL2_Index] == true){
|
3874
|
3918
|
printf("ALARM_AGC_P2 OCCUR\r\n");
|
3875
|
3919
|
bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm |= ALARM_AGC_P2;
|
3876
|
3920
|
bluecell_Currdatastatus.DLI_AGC_Alarm2 = true;
|
|
@@ -3879,7 +3923,7 @@ void Alarm_Check(){
|
3879
|
3923
|
bluecell_Currdatastatus.DLI_AGC_Alarm2 = false;
|
3880
|
3924
|
|
3881
|
3925
|
}
|
3882
|
|
- if(temp < ResdBm[2]){
|
|
3926
|
+ if(AGC_AlarmSet[AGC_Alarm_DL3_Index] == true){
|
3883
|
3927
|
printf("ALARM_AGC_P3 OCCUR\r\n");
|
3884
|
3928
|
bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm |= ALARM_AGC_P3;
|
3885
|
3929
|
bluecell_Currdatastatus.DLI_AGC_Alarm3 = true;
|
|
@@ -3888,7 +3932,7 @@ void Alarm_Check(){
|
3888
|
3932
|
bluecell_Currdatastatus.DLI_AGC_Alarm3 = false;
|
3889
|
3933
|
|
3890
|
3934
|
}
|
3891
|
|
- if(temp < ResdBm[3]){
|
|
3935
|
+ if(AGC_AlarmSet[AGC_Alarm_DL4_Index] == true){
|
3892
|
3936
|
printf("ALARM_AGC_P4 OCCUR\r\n");
|
3893
|
3937
|
bluecell_Currdatastatus.ALARM_DLI_AGC_Alarm |= ALARM_AGC_P4;
|
3894
|
3938
|
bluecell_Currdatastatus.DLI_AGC_Alarm4 = true;
|