|
@@ -431,16 +431,21 @@ ATT_TABLE_st Atten_Table_ref[Table_ATT_Ref_Index_MAX] = {
|
431
|
431
|
#define TableDataSetting_ATT_UL_LEVEL_STEP -1
|
432
|
432
|
#define TableDataSetting_ATT_DL_TEMP_STEP -5
|
433
|
433
|
#define TableDataSetting_ATT_UL_TEMP_STEP -5
|
|
434
|
+void Table_LengthSetting(){
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+}
|
434
|
438
|
|
435
|
439
|
void Table_DataSetting(int8_t* pdata,int8_t RefData,double step,uint8_t size){
|
436
|
440
|
// step /= 10;
|
437
|
441
|
for(int i =0; i < size; i++){
|
438
|
442
|
pdata[i] = RefData;
|
439
|
|
- printf("pdata[%d] %d \r\n",i,pdata[i]);
|
|
443
|
+// printf("pdata[%d] %d \r\n",i,pdata[i]);
|
440
|
444
|
RefData += step;
|
441
|
445
|
}
|
442
|
446
|
}
|
443
|
447
|
void Table_Init(){
|
|
448
|
+ printf("Table Initialize\r\n");
|
444
|
449
|
Table_DataSetting(&DL_DET_Table_ref[AGC_Table_DL1_Ref_Index][TABLE_MAX_VALUE],Det_DL1.Table_Ref,TableDataSetting_ATT_DL_LEVEL_STEP,Det_DL1.Table_Length);
|
445
|
450
|
Table_DataSetting(&DL_DET_Table_ref[AGC_Table_DL2_Ref_Index][TABLE_MAX_VALUE],Det_DL2.Table_Ref,TableDataSetting_ATT_DL_LEVEL_STEP,Det_DL2.Table_Length);
|
446
|
451
|
Table_DataSetting(&DL_DET_Table_ref[AGC_Table_DL3_Ref_Index][TABLE_MAX_VALUE],Det_DL3.Table_Ref,TableDataSetting_ATT_DL_LEVEL_STEP,Det_DL3.Table_Length);
|
|
@@ -451,11 +456,24 @@ void Table_Init(){
|
451
|
456
|
Table_DataSetting(&UL_DET_Table_ref[ALC_Table_UL4_Ref_Index][TABLE_MAX_VALUE],Det_UL4.Table_Ref,TableDataSetting_ATT_UL_LEVEL_STEP,Det_UL4.Table_Length);
|
452
|
457
|
|
453
|
458
|
|
|
459
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_ATT_UL4_TABLE_ADDRESDS,&Det_DL1.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st) );
|
|
460
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_DET_DL1_TABLE_ADDRESDS,&Det_DL2.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st) );
|
|
461
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_DET_DL2_TABLE_ADDRESDS,&Det_DL3.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st) );
|
|
462
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_DET_DL3_TABLE_ADDRESDS,&Det_DL4.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st) );
|
|
463
|
+//
|
|
464
|
+//
|
|
465
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_DET_DL4_TABLE_ADDRESDS,&Det_UL1.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st) );
|
|
466
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_DET_UL1_TABLE_ADDRESDS,&Det_UL2.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st) );
|
|
467
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_DET_UL2_TABLE_ADDRESDS,&Det_UL3.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st) );
|
|
468
|
+// EEPROM_M24C08_write(EEPROM_M24C08_ID,EEPROM_DET_UL3_TABLE_ADDRESDS,&Det_UL4.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st) );
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
454
|
472
|
}
|
455
|
473
|
void Bluecell_AttenInitialize(){
|
456
|
474
|
uint8_t val = 0;
|
457
|
475
|
int16_t MBIC_ALC_Val = 0,MBIC_Val = 0,MBIC_UserVal = 0;
|
458
|
|
- Table_Init();
|
|
476
|
+
|
459
|
477
|
// Bluecell_StructCpy(&AutoControl_Save[MBIC_Table_DL1_INDEX],&DL_DET_Table_ref[AGC_Table_DL1_Ref_Index][TABLE_MAX_VALUE],sizeof(AGC_dBm_t));
|
460
|
478
|
// Bluecell_StructCpy(&AutoControl_Save[MBIC_Table_DL2_INDEX],&DL_DET_Table_ref[AGC_Table_DL2_Ref_Index][TABLE_MAX_VALUE],sizeof(AGC_dBm_t));
|
461
|
479
|
// Bluecell_StructCpy(&AutoControl_Save[MBIC_Table_DL3_INDEX],&DL_DET_Table_ref[AGC_Table_DL3_Ref_Index][TABLE_MAX_VALUE],sizeof(AGC_dBm_t));
|
|
@@ -683,13 +701,42 @@ void Atten_UL_Ctrl_Function(uint8_t index,ATT_TABLE_st* Table,uint8_t* CurrAtten
|
683
|
701
|
}
|
684
|
702
|
|
685
|
703
|
}
|
|
704
|
+typedef enum{
|
|
705
|
+ DL_ATTEN_H,
|
|
706
|
+ DL_ATTEN_L,
|
|
707
|
+};
|
|
708
|
+void DL_AttenOperate(uint8_t* Atten,uint8_t* PrevAtten,uint8_t* UserAtten,uint8_t* PrevUserAtten,PE43711_st ATT){
|
|
709
|
+ uint8_t val = 0;
|
|
710
|
+ uint16_t MBIC_Val = 0;
|
|
711
|
+ uint16_t MBIC_ALC_Val = 0;
|
|
712
|
+ uint16_t MBIC_UserVal = 0;
|
|
713
|
+ if((Atten[DL_ATTEN_H] != PrevAtten[DL_ATTEN_H])
|
|
714
|
+ ||(Atten[DL_ATTEN_L] != PrevAtten[DL_ATTEN_L])
|
|
715
|
+ ||(UserAtten[DL_ATTEN_H] != PrevUserAtten[DL_ATTEN_H])
|
|
716
|
+ ||(UserAtten[DL_ATTEN_L] != PrevUserAtten[DL_ATTEN_L])){
|
|
717
|
+ // printf("%s : %d \r\n",__func__,__LINE__);
|
|
718
|
+ Atten[DL_ATTEN_H] = PrevAtten[DL_ATTEN_H];
|
|
719
|
+ Atten[DL_ATTEN_L] = PrevAtten[DL_ATTEN_L];
|
|
720
|
+ UserAtten[DL_ATTEN_H] = PrevUserAtten[DL_ATTEN_H];
|
|
721
|
+ UserAtten[DL_ATTEN_L] = PrevUserAtten[DL_ATTEN_L];
|
|
722
|
+ MBIC_Val =Atten[DL_ATTEN_H] << 8 |Atten[DL_ATTEN_L];
|
|
723
|
+ MBIC_UserVal = UserAtten[DL_ATTEN_H] << 8 | UserAtten[DL_ATTEN_L];
|
|
724
|
+ val = MBIC_DL_PE43711_Calc(&Att_DL1.Table_0_0_dBm, // Table Offset
|
|
725
|
+ MBIC_Val,
|
|
726
|
+ MBIC_UserVal);// User Atten Low Bit
|
|
727
|
+ printf("%s : %d \r\n",__func__,__LINE__);
|
|
728
|
+ printf("%d val = %x \r\n",__LINE__,val);
|
|
729
|
+ PE43711_atten_ctrl(ATT,val);
|
|
730
|
+ }
|
|
731
|
+
|
686
|
732
|
|
|
733
|
+}
|
687
|
734
|
void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
688
|
735
|
uint8_t val = 0;
|
689
|
736
|
uint16_t MBIC_Val = 0;
|
690
|
737
|
uint16_t MBIC_ALC_Val = 0;
|
691
|
738
|
uint16_t MBIC_UserVal = 0;
|
692
|
|
-
|
|
739
|
+#if 1 // PYJ.2020.07.01_BEGIN --
|
693
|
740
|
if((Curr.ATT_DL1_H != Prev.ATT_DL1_H)
|
694
|
741
|
||(Curr.ATT_DL1_L != Prev.ATT_DL1_L)
|
695
|
742
|
||(Curr.bluecell_User_DL1_H != Prev.bluecell_User_DL1_H)
|
|
@@ -766,6 +813,17 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
766
|
813
|
printf("%d val = %x \r\n",__LINE__,val);
|
767
|
814
|
PE43711_atten_ctrl(ALL_ATT.ATT_DL4,val);
|
768
|
815
|
}
|
|
816
|
+#else
|
|
817
|
+ DL_AttenOperate(&bluecell_Currdatastatus.ATT_DL1_H,&bluecell_Prevdatastatus.ATT_DL1_L,
|
|
818
|
+ &bluecell_Currdatastatus.bluecell_User_DL1_H,&bluecell_Prevdatastatus.bluecell_User_DL1_L,ALL_ATT.ATT_DL1);
|
|
819
|
+ DL_AttenOperate(&bluecell_Currdatastatus.ATT_DL2_H,&bluecell_Prevdatastatus.ATT_DL2_L,
|
|
820
|
+ &bluecell_Currdatastatus.bluecell_User_DL2_H,&bluecell_Prevdatastatus.bluecell_User_DL2_L,ALL_ATT.ATT_DL2);
|
|
821
|
+ DL_AttenOperate(&bluecell_Currdatastatus.ATT_DL3_H,&bluecell_Prevdatastatus.ATT_DL3_L,
|
|
822
|
+ &bluecell_Currdatastatus.bluecell_User_DL3_H,&bluecell_Prevdatastatus.bluecell_User_DL3_L,ALL_ATT.ATT_DL3);
|
|
823
|
+ DL_AttenOperate(&bluecell_Currdatastatus.ATT_DL4_H,&bluecell_Prevdatastatus.ATT_DL4_L,
|
|
824
|
+ &bluecell_Currdatastatus.bluecell_User_DL4_H,&bluecell_Prevdatastatus.bluecell_User_DL4_L,ALL_ATT.ATT_DL4);
|
|
825
|
+
|
|
826
|
+#endif // PYJ.2020.07.01_END --
|
769
|
827
|
|
770
|
828
|
if(bluecell_Prevdatastatus.bluecell_User_UL1_H != 0xFF)
|
771
|
829
|
bluecell_Prevdatastatus.bluecell_User_UL1_H =0xFF;
|
|
@@ -874,19 +932,19 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
|
874
|
932
|
||(Curr.MBIC_ULO_ALC_Atten4_H != Prev.MBIC_ULO_ALC_Atten4_H)
|
875
|
933
|
||(Curr.MBIC_ULO_ALC_Atten4_L != Prev.MBIC_ULO_ALC_Atten4_L))
|
876
|
934
|
{
|
877
|
|
- printf("bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_H : %02x \r\n",bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_H);
|
878
|
|
- printf("bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_L : %02x \r\n",bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_L);
|
879
|
|
- printf("bluecell_Prevdatastatus.ATT_UL4_H : %02x \r\n",bluecell_Prevdatastatus.ATT_UL4_H);
|
880
|
|
- printf("bluecell_Prevdatastatus.ATT_UL4_L : %02x \r\n",bluecell_Prevdatastatus.ATT_UL4_L);
|
881
|
|
- printf("bluecell_Prevdatastatus.bluecell_User_UL4_H : %02x \r\n",bluecell_Prevdatastatus.bluecell_User_UL4_H);
|
882
|
|
- printf("bluecell_Prevdatastatus.bluecell_User_UL4_L : %02x \r\n",bluecell_Prevdatastatus.bluecell_User_UL4_L);
|
883
|
|
- printf("============================================================\r\n");
|
884
|
|
- printf("bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_H : %02x \r\n",bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_H);
|
885
|
|
- printf("bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_L : %02x \r\n",bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_L);
|
886
|
|
- printf("bluecell_Currdatastatus.ATT_UL4_H : %02x \r\n",bluecell_Currdatastatus.ATT_UL4_H);
|
887
|
|
- printf("bluecell_Currdatastatus.ATT_UL4_L : %02x \r\n",bluecell_Currdatastatus.ATT_UL4_L);
|
888
|
|
- printf("bluecell_Currdatastatus.bluecell_User_UL4_H : %02x \r\n",bluecell_Currdatastatus.bluecell_User_UL4_H);
|
889
|
|
- printf("bluecell_Currdatastatus.bluecell_User_UL4_L : %02x \r\n",bluecell_Currdatastatus.bluecell_User_UL4_L);
|
|
935
|
+// printf("bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_H : %02x \r\n",bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_H);
|
|
936
|
+// printf("bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_L : %02x \r\n",bluecell_Prevdatastatus.MBIC_ULO_ALC_Atten4_L);
|
|
937
|
+// printf("bluecell_Prevdatastatus.ATT_UL4_H : %02x \r\n",bluecell_Prevdatastatus.ATT_UL4_H);
|
|
938
|
+// printf("bluecell_Prevdatastatus.ATT_UL4_L : %02x \r\n",bluecell_Prevdatastatus.ATT_UL4_L);
|
|
939
|
+// printf("bluecell_Prevdatastatus.bluecell_User_UL4_H : %02x \r\n",bluecell_Prevdatastatus.bluecell_User_UL4_H);
|
|
940
|
+// printf("bluecell_Prevdatastatus.bluecell_User_UL4_L : %02x \r\n",bluecell_Prevdatastatus.bluecell_User_UL4_L);
|
|
941
|
+// printf("============================================================\r\n");
|
|
942
|
+// printf("bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_H : %02x \r\n",bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_H);
|
|
943
|
+// printf("bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_L : %02x \r\n",bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_L);
|
|
944
|
+// printf("bluecell_Currdatastatus.ATT_UL4_H : %02x \r\n",bluecell_Currdatastatus.ATT_UL4_H);
|
|
945
|
+// printf("bluecell_Currdatastatus.ATT_UL4_L : %02x \r\n",bluecell_Currdatastatus.ATT_UL4_L);
|
|
946
|
+// printf("bluecell_Currdatastatus.bluecell_User_UL4_H : %02x \r\n",bluecell_Currdatastatus.bluecell_User_UL4_H);
|
|
947
|
+// printf("bluecell_Currdatastatus.bluecell_User_UL4_L : %02x \r\n",bluecell_Currdatastatus.bluecell_User_UL4_L);
|
890
|
948
|
bluecell_Prevdatastatus.ATT_UL4_H = bluecell_Currdatastatus.ATT_UL4_H;
|
891
|
949
|
bluecell_Prevdatastatus.ATT_UL4_L = bluecell_Currdatastatus.ATT_UL4_L;
|
892
|
950
|
bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
|
|
@@ -2195,12 +2253,16 @@ bool Bluecell_Operate(uint8_t* data){
|
2195
|
2253
|
int16_t CurrAtten = 0;
|
2196
|
2254
|
int16_t ALC_TEMP[4] ={0,};
|
2197
|
2255
|
int16_t Tmpdata = 0 ,Tmpdata2 = 0;
|
|
2256
|
+ double tmpedata2 = 0;
|
2198
|
2257
|
uint8_t i = 0;
|
2199
|
2258
|
uint16_t Crcret = 0;
|
|
2259
|
+ uint16_t Length = 0;
|
2200
|
2260
|
switch(datatype){
|
2201
|
2261
|
case BLUECELL_SOFTWARERESET:
|
2202
|
2262
|
printf("Bluecell Reset \r\n");
|
|
2263
|
+// Table_Init();
|
2203
|
2264
|
Table_LengSet();
|
|
2265
|
+// Table_LengSet();
|
2204
|
2266
|
NVIC_SystemReset();
|
2205
|
2267
|
break;
|
2206
|
2268
|
case Bluecell_ATT_DL1 :
|
|
@@ -2641,8 +2703,12 @@ bool Bluecell_Operate(uint8_t* data){
|
2641
|
2703
|
Bluecell_StructCpy(&Txdata[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
|
2642
|
2704
|
Txdata[BLUECELL_LENGTH_L] = sizeof(BLUESTATUS_st) - 3;//sizeof(BLUESTATUS_st) - 3;
|
2643
|
2705
|
// Txdata[sizeof(BLUESTATUS_st) - 2] = STH30_CreateCrc(&Txdata[BLUECELL_TYPE], Txdata[BLUECELL_LENGTH_L]);
|
2644
|
|
- Txdata[sizeof(BLUESTATUS_st) - 3] = ((CRC16_Generate(&data[BLUECELL_TYPE], data[BLUECELL_LENGTH_L]) & 0xFF00) >> 8);
|
2645
|
|
- Txdata[sizeof(BLUESTATUS_st) - 2] = CRC16_Generate(&data[BLUECELL_TYPE], data[BLUECELL_LENGTH_L]) & 0x00FF;
|
|
2706
|
+ Length = sizeof(BLUESTATUS_st) - 4;
|
|
2707
|
+ Txdata[BLUECELL_LENGTH_H] = ((Length & 0xFF00) >> 8);
|
|
2708
|
+ Txdata[BLUECELL_LENGTH_L] = ((Length & 0x00FF));
|
|
2709
|
+ Crcret = ((CRC16_Generate(&Txdata[BLUECELL_TYPE], Length) ));
|
|
2710
|
+ Txdata[sizeof(BLUESTATUS_st) - 3] = ((Crcret & 0xFF00) >> 8 );
|
|
2711
|
+ Txdata[sizeof(BLUESTATUS_st) - 2] = ((Crcret & 0x00FF));
|
2646
|
2712
|
|
2647
|
2713
|
#endif // PYJ.2020.05.28_END --
|
2648
|
2714
|
#if 0 // PYJ.2020.04.22_BEGIN --
|
|
@@ -2651,24 +2717,18 @@ bool Bluecell_Operate(uint8_t* data){
|
2651
|
2717
|
}
|
2652
|
2718
|
printf("\r\n");
|
2653
|
2719
|
#endif // PYJ.2020.04.22_END --
|
2654
|
|
-#if 0 // PYJ.2020.07.01_BEGIN --
|
|
2720
|
+#if 1 // PYJ.2020.07.01_BEGIN --
|
2655
|
2721
|
printf("===================START=======================\r\n");
|
2656
|
|
- printf("ALC ON %d \r\n",bluecell_Currdatastatus.ULO_ALC_ON_OFF);
|
2657
|
|
- printf("AGC ON %d \r\n",bluecell_Currdatastatus.DLI_AGC_ON_OFF);
|
2658
|
|
- printf("Shutdown DL ON OFF %d \r\n",bluecell_Currdatastatus.DLI_Shutdown_ON_OFF);
|
2659
|
|
- printf("Shutdown UL ON OFF %d \r\n",bluecell_Currdatastatus.ULO_Shutdown_ON_OFF);
|
2660
|
|
-
|
2661
|
|
-
|
2662
|
|
- printf("Shutdown DL1 CNT %d \r\n",bluecell_Currdatastatus.DLI_Shutdown_Retry_Count1);
|
2663
|
|
- printf("Shutdown DL2 CNT %d \r\n",bluecell_Currdatastatus.DLI_Shutdown_Retry_Count2);
|
2664
|
|
- printf("Shutdown DL3 CNT %d \r\n",bluecell_Currdatastatus.DLI_Shutdown_Retry_Count3);
|
2665
|
|
- printf("Shutdown DL4 CNT %d \r\n",bluecell_Currdatastatus.DLI_Shutdown_Retry_Count4);
|
2666
|
|
-
|
2667
|
|
- printf("Shutdown UL1 CNT %d \r\n",bluecell_Currdatastatus.ULO_Shutdown_Retry_Count1);
|
2668
|
|
- printf("Shutdown UL2 CNT %d \r\n",bluecell_Currdatastatus.ULO_Shutdown_Retry_Count2);
|
2669
|
|
- printf("Shutdown UL3 CNT %d \r\n",bluecell_Currdatastatus.ULO_Shutdown_Retry_Count3);
|
2670
|
|
- printf("Shutdown UL4 CNT %d \r\n",bluecell_Currdatastatus.ULO_Shutdown_Retry_Count4);
|
2671
|
|
-
|
|
2722
|
+ printf("ALC ON %d | AGC ON %d\r\n",bluecell_Currdatastatus.ULO_ALC_ON_OFF,bluecell_Currdatastatus.DLI_AGC_ON_OFF);
|
|
2723
|
+ printf("Shutdown DL ON OFF %d | Shutdown UL ON OFF %d \r\n",bluecell_Currdatastatus.DLI_Shutdown_ON_OFF,bluecell_Currdatastatus.ULO_Shutdown_ON_OFF);
|
|
2724
|
+ printf("PATH1 %d|Shutdown DL1 CNT %d | PATH1 %d|Shutdown UL1 CNT %d\r\n",bluecell_Currdatastatus.ATT_DL1_PATH,bluecell_Currdatastatus.DLI_Shutdown_Retry_Count1,bluecell_Currdatastatus.ATT_DL1_PATH,bluecell_Currdatastatus.ULO_Shutdown_Retry_Count1);
|
|
2725
|
+ printf("PATH2 %d|Shutdown DL2 CNT %d | PATH2 %d|Shutdown UL2 CNT %d\r\n",bluecell_Currdatastatus.ATT_DL2_PATH,bluecell_Currdatastatus.DLI_Shutdown_Retry_Count2,bluecell_Currdatastatus.ATT_UL2_PATH,bluecell_Currdatastatus.ULO_Shutdown_Retry_Count2);
|
|
2726
|
+ printf("PATH3 %d|Shutdown DL3 CNT %d | PATH3 %d|Shutdown UL3 CNT %d\r\n",bluecell_Currdatastatus.ATT_DL3_PATH,bluecell_Currdatastatus.DLI_Shutdown_Retry_Count3,bluecell_Currdatastatus.ATT_UL3_PATH,bluecell_Currdatastatus.ULO_Shutdown_Retry_Count3);
|
|
2727
|
+ printf("PATH4 %d|Shutdown DL4 CNT %d | PATH4 %d|Shutdown UL4 CNT %d\r\n",bluecell_Currdatastatus.ATT_DL4_PATH,bluecell_Currdatastatus.DLI_Shutdown_Retry_Count4,bluecell_Currdatastatus.ATT_UL4_PATH,bluecell_Currdatastatus.ULO_Shutdown_Retry_Count4);
|
|
2728
|
+ tempdata = (( bluecell_Currdatastatus.DLI_Shutdown_Threshold_H << 8) & 0xFF00) ;
|
|
2729
|
+ tempdata += bluecell_Currdatastatus.DLI_Shutdown_Threshold_L ;
|
|
2730
|
+ tempdata /= 10;
|
|
2731
|
+ printf("DL Shutdown Threas : %d \r\n",tempdata);
|
2672
|
2732
|
// printf("Temp Alarm %d \r\n");
|
2673
|
2733
|
printf("ALC Alarm 1: %d 2: %d 3: %d 4: %d\r\n",
|
2674
|
2734
|
bluecell_Currdatastatus.ALARM_ULO_ALC_Alarm & ALARM_ALC_P1,
|
|
@@ -2739,6 +2799,7 @@ bool Bluecell_Operate(uint8_t* data){
|
2739
|
2799
|
// Uart1_Data_Send(&Txdata[0], sizeof(BLUESTATUS_st));
|
2740
|
2800
|
EEPROM_M24C08_Zerowrite(EEPROM_M24C08_ID ,(EEPROM_ATT_BASE));
|
2741
|
2801
|
// printf("ZERO WRITE COMPLETE");
|
|
2802
|
+
|
2742
|
2803
|
NVIC_SystemReset();
|
2743
|
2804
|
|
2744
|
2805
|
break;
|
|
@@ -2838,12 +2899,12 @@ bool Bluecell_Operate(uint8_t* data){
|
2838
|
2899
|
// bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_L = data[BLUECELL_DATA + i++];
|
2839
|
2900
|
break;
|
2840
|
2901
|
case Bluecell_DLI_AGC_ON_OFF:
|
2841
|
|
- bluecell_Currdatastatus.DLI_AGC_ON_OFF = data[BLUECELL_DATA + i];
|
2842
|
2902
|
printf("AGC ON OFF SET : %d \r\n",bluecell_Currdatastatus.DLI_AGC_ON_OFF);
|
|
2903
|
+ bluecell_Currdatastatus.DLI_AGC_ON_OFF = data[BLUECELL_DATA + i];
|
2843
|
2904
|
break;
|
2844
|
2905
|
case Bluecell_ULO_ALC_ON_OFF:
|
|
2906
|
+ printf("ALC ON OFF SET : %d \r\n",bluecell_Currdatastatus.ULO_ALC_ON_OFF);
|
2845
|
2907
|
bluecell_Currdatastatus.ULO_ALC_ON_OFF = data[BLUECELL_DATA + i];
|
2846
|
|
- printf("ALC ON OFF SET : %d \r\n",bluecell_Currdatastatus.DLI_AGC_ON_OFF);
|
2847
|
2908
|
break;
|
2848
|
2909
|
case Bluecell_DLI_AGC_Threshold:
|
2849
|
2910
|
bluecell_Currdatastatus.DLI_AGC_Threshold_H = data[BLUECELL_DATA + i++];
|
|
@@ -2866,8 +2927,8 @@ bool Bluecell_Operate(uint8_t* data){
|
2866
|
2927
|
}
|
2867
|
2928
|
break;
|
2868
|
2929
|
case Bluecell_DLI_Shutdown_ON_OFF:
|
2869
|
|
- bluecell_Currdatastatus.DLI_Shutdown_ON_OFF = data[BLUECELL_DATA + i++];
|
2870
|
2930
|
printf("%s : %d DLI_Shutdown_ON_OFF : %d \r\n",__func__,__LINE__,bluecell_Currdatastatus.DLI_Shutdown_ON_OFF);
|
|
2931
|
+ bluecell_Currdatastatus.DLI_Shutdown_ON_OFF = data[BLUECELL_DATA + i++];
|
2871
|
2932
|
|
2872
|
2933
|
break;
|
2873
|
2934
|
case Bluecell_DLI_Shutdown_Threshold:
|
|
@@ -2991,8 +3052,8 @@ bool Bluecell_Operate(uint8_t* data){
|
2991
|
3052
|
|
2992
|
3053
|
break;
|
2993
|
3054
|
case Bluecell_ULO_Shutdown_ON_OFF :
|
|
3055
|
+ printf("%s Bluecell_ULO_Shutdown_ON_OFF : %d \r\n",__func__,bluecell_Currdatastatus.ULO_Shutdown_ON_OFF );
|
2994
|
3056
|
bluecell_Currdatastatus.ULO_Shutdown_ON_OFF = data[BLUECELL_DATA + i++];
|
2995
|
|
- printf("%s Bluecell_ULO_Shutdown_ON_OFF : %d \r\n",__func__,bluecell_Currdatastatus.ULO_Shutdown_ON_OFF );
|
2996
|
3057
|
|
2997
|
3058
|
break;
|
2998
|
3059
|
case Bluecell_ULO_Shutdown_Threshold :
|
|
@@ -4117,7 +4178,7 @@ bool MBIC_Operate(uint8_t* data){
|
4117
|
4178
|
NVIC_SystemReset();
|
4118
|
4179
|
break;
|
4119
|
4180
|
case SW_Reset :
|
4120
|
|
- Table_LengSet();
|
|
4181
|
+// Table_LengSet();
|
4121
|
4182
|
printf("SoftWare Reset Start \r\n");
|
4122
|
4183
|
bluecell_Currdatastatus.S_W_Reset = data[MBIC_PAYLOADSTART + 3];
|
4123
|
4184
|
NVIC_SystemReset();
|
|
@@ -6552,7 +6613,7 @@ typedef enum{
|
6552
|
6613
|
void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tableindex,uint8_t* DLI_ADC_Level,uint8_t* DLI_Level,DET_TABLEDL_st* DL_Table){
|
6553
|
6614
|
double ret = 0;
|
6554
|
6615
|
int8_t ResdBm = 0;
|
6555
|
|
-
|
|
6616
|
+ int16_t CurrAtten = 0;
|
6556
|
6617
|
int16_t Levelret = 0;
|
6557
|
6618
|
int i = 0;
|
6558
|
6619
|
int16_t Limitdata = 0;
|
|
@@ -6567,7 +6628,9 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
6567
|
6628
|
ret = DLI_ADC_Level[DLI_AGC_H] << 8;
|
6568
|
6629
|
ret += DLI_ADC_Level[DLI_AGC_L];
|
6569
|
6630
|
ret *= 0.001;
|
6570
|
|
- ResdBm = (int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&DL_Table->Table_Det5_dBm_H,DL_Table->Table_Length * 2,AGC_Table));
|
|
6631
|
+
|
|
6632
|
+ CurrAtten = (int16_t)(DL_MainAtten[DLI_AGC_H] << 8 | DL_MainAtten[DLI_AGC_L]);
|
|
6633
|
+ ResdBm = (int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&DL_Table->Table_Det5_dBm_H,DL_Table->Table_Length,AGC_Table));
|
6571
|
6634
|
DLI_Level[DLI_AGC_H] = ((int16_t)ResdBm & 0xFF00) >> 8;
|
6572
|
6635
|
DLI_Level[DLI_AGC_L] = ((int16_t)ResdBm & 0x00FF);
|
6573
|
6636
|
for(i = 0; i < sizeof(AGC_dBm_t); i++){
|
|
@@ -6577,18 +6640,20 @@ void AGC_Package_Operate(uint8_t* Threshold,uint8_t* DL_MainAtten,uint8_t Tablei
|
6577
|
6640
|
IwillgiveAtten = AGC_Calc(Limitdata,ResdBm);
|
6578
|
6641
|
IwillgiveAtten *= -1;
|
6579
|
6642
|
// printf("==================================\r\n");
|
|
6643
|
+// printf("Curr ATTEN %d \r\n",CurrAtten );
|
6580
|
6644
|
// printf("Current DL% ADC VALUE : %f \r\n",Tableindex+1,ret);
|
6581
|
6645
|
// printf("ResdBm : DL% : %d \r\n",Tableindex+1,ResdBm);
|
6582
|
6646
|
// printf("I WILL GIVE YOU ATTEN : %d\r\n",IwillgiveAtten);
|
6583
|
6647
|
// printf("AGC : %d\r\n",Limitdata);
|
6584
|
|
-
|
|
6648
|
+ if((CurrAtten / 10) < IwillgiveAtten)
|
|
6649
|
+ IwillgiveAtten = (CurrAtten / 10);
|
6585
|
6650
|
|
6586
|
6651
|
if(ResdBm > Limitdata && DL_PrevIwillgiveAtten[Tableindex] > IwillgiveAtten){
|
6587
|
6652
|
// printf("IwillgiveAtten : %d \r\n",IwillgiveAtten);
|
6588
|
6653
|
DL_PrevIwillgiveAtten[Tableindex] = IwillgiveAtten;
|
6589
|
6654
|
IwillgiveAtten = (DL_AGC_StartAtten[Tableindex]*0.1) + IwillgiveAtten;
|
6590
|
6655
|
// printf("WILLATTEN RET : %d \r\n",IwillgiveAtten);
|
6591
|
|
- AGC_Alarm_Check(AGC_Alarm_DL1_Index,ret,&DL_Table->Table_Det5_dBm_H,IwillgiveAtten);
|
|
6656
|
+ AGC_Alarm_Check(AGC_Alarm_DL1_Index + Tableindex,ret,&DL_Table->Table_Det5_dBm_H,IwillgiveAtten);
|
6592
|
6657
|
DL_MainAtten[DLI_AGC_H] = (((IwillgiveAtten * 10) & 0xFF00) >> 8) ;
|
6593
|
6658
|
DL_MainAtten[DLI_AGC_L] = (((IwillgiveAtten * 10) & 0x00FF));
|
6594
|
6659
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
@@ -6606,7 +6671,7 @@ void DL_Det_Function(uint8_t Table_Num,uint8_t* CurrADC_Level,DET_TABLEDL_st* DL
|
6606
|
6671
|
int16_t Levelret = 0;
|
6607
|
6672
|
AGC_Table = &DL_DET_Table_ref[Table_Num][TABLE_MAX_VALUE];
|
6608
|
6673
|
ret = (((CurrADC_Level[DL_Level_H] << 8) | CurrADC_Level[DL_Level_L]) * 0.001);
|
6609
|
|
-
|
|
6674
|
+// printf("DL_Table->Table_Length : %d \r\n",DL_Table->Table_Length);
|
6610
|
6675
|
Levelret = (int16_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&DL_Table->Table_Det5_dBm_H,DL_Table->Table_Length,AGC_Table));
|
6611
|
6676
|
Level[DL_Level_H] = (Levelret & 0xFF00) >> 8;
|
6612
|
6677
|
Level[DL_Level_L] = (Levelret & 0x00FF);
|
|
@@ -7374,11 +7439,12 @@ void DL_Shutdown_Operate(uint8_t index,uint8_t* path,uint8_t* retrycnt,uint8_t*
|
7374
|
7439
|
if(MBIC_DL_ShutdownCount[index] < 3
|
7375
|
7440
|
&& (PrevMBIC_DL_ShutdownCount[index] != MBIC_DL_ShutdownCount[index])
|
7376
|
7441
|
&& DET_DL_Shutdown_Off_AlarmTimerCnt[index] >= MBIC_RECOVERY_SHUTDOWN_MAINTAIN_SEC
|
7377
|
|
- && DL_PathUserHandl[index] == false){
|
|
7442
|
+ && DL_PathUserHandl[index] == false
|
|
7443
|
+ && (*retrycnt) > 0){
|
7378
|
7444
|
HAL_GPIO_WritePin(Port,Pin,GPIO_PIN_SET);//CLOCK
|
7379
|
7445
|
*path = true;
|
7380
|
|
- bluecell_Prevdatastatus.ATT_DL1_H = 0xFF;
|
7381
|
|
- bluecell_Prevdatastatus.ATT_DL1_L = 0xFF;
|
|
7446
|
+ MainAtten[DL_Shutdown_H] = 0xFF;
|
|
7447
|
+ MainAtten[DL_Shutdown_L] = 0xFF;
|
7382
|
7448
|
PrevMBIC_DL_ShutdownCount[index] = MBIC_DL_ShutdownCount[index];
|
7383
|
7449
|
CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
7384
|
7450
|
}
|
|
@@ -8082,6 +8148,10 @@ void ULO_ShutdownAlarmCheck(){
|
8082
|
8148
|
}
|
8083
|
8149
|
else{
|
8084
|
8150
|
bluecell_Currdatastatus.ALARM_ULO_SHTUTDOWN = 0;
|
|
8151
|
+ bluecell_Currdatastatus.ULO_Shutdown_Retry_Count1 = 0;
|
|
8152
|
+ bluecell_Currdatastatus.ULO_Shutdown_Retry_Count2 = 0;
|
|
8153
|
+ bluecell_Currdatastatus.ULO_Shutdown_Retry_Count3 = 0;
|
|
8154
|
+ bluecell_Currdatastatus.ULO_Shutdown_Retry_Count4 = 0;
|
8085
|
8155
|
bluecell_Currdatastatus.ULO_Shutdown_Alarm1 = false;
|
8086
|
8156
|
bluecell_Currdatastatus.ULO_Shutdown_Alarm2 = false;
|
8087
|
8157
|
bluecell_Currdatastatus.ULO_Shutdown_Alarm3 = false;
|