Browse Source

불필요한 전역변수 지역변수로 변환

PYJ 5 years ago
parent
commit
f9c3e3d24f
3 changed files with 38 additions and 37 deletions
  1. 36 30
      Bluecell_Src/Bluecell_operate.c
  2. 0 2
      Inc/main.h
  3. 2 5
      Src/main.c

+ 36 - 30
Bluecell_Src/Bluecell_operate.c

@@ -26,8 +26,6 @@ extern volatile uint32_t AlarmTimerOnCnt;
26
 extern volatile uint32_t AlarmTimerOffCnt;
26
 extern volatile uint32_t AlarmTimerOffCnt;
27
 
27
 
28
 extern ALL_PE43711_st ALL_ATT;
28
 extern ALL_PE43711_st ALL_ATT;
29
-extern volatile uint32_t ADC1_Average_value[4];
30
-extern volatile uint32_t ADC3_Average_value[5];
31
 extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
29
 extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
32
 extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
30
 extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
33
 
31
 
@@ -52,15 +50,12 @@ void Booting_LED_Check(void);
52
 /*                                  Valuable                                           */
50
 /*                                  Valuable                                           */
53
 /***************************************************************************************/
51
 /***************************************************************************************/
54
 
52
 
55
-uint8_t Alarm_Status[MAX_ALARM_Len] = {0,};
56
-uint8_t ResultData[1024] = {0,};
53
+
57
 uint8_t DataWrite[sizeof(BLUESTATUS_st)] = {0,};
54
 uint8_t DataWrite[sizeof(BLUESTATUS_st)] = {0,};
58
-uint8_t DataRead[512] = {0,};
59
 uint8_t Txdata[512];
55
 uint8_t Txdata[512];
60
 int8_t AutoControl_Save[sizeof(ALC_dBm_t)];
56
 int8_t AutoControl_Save[sizeof(ALC_dBm_t)];
61
 uint16_t ADC1Ret[4];
57
 uint16_t ADC1Ret[4];
62
-double ADC1DoubleRet[4];
63
-double ADC3DoubleRet[5];
58
+
64
 uint16_t ADC3Ret[5];
59
 uint16_t ADC3Ret[5];
65
 
60
 
66
 ATT_TABLE_st Att_DL1;
61
 ATT_TABLE_st Att_DL1;
@@ -95,17 +90,7 @@ TEMP_TABLE_st Temp_UL4;
95
 BLUESTATUS_st bluecell_Currdatastatus;
90
 BLUESTATUS_st bluecell_Currdatastatus;
96
 BLUESTATUS_st bluecell_Prevdatastatus;
91
 BLUESTATUS_st bluecell_Prevdatastatus;
97
 
92
 
98
-int8_t AGC_Table_ref[sizeof(AGC_dBm_t)] = {
99
-     5   ,    4   ,    3   ,    2   ,
100
-     1   ,    0   ,    -1  ,    -2  ,
101
-    -3  ,    -4  ,    -5  ,    -6  ,
102
-    -7  ,    -8  ,    -9  ,    -10 ,
103
-    -11 ,    -12 ,    -13 ,    -14 ,
104
-    -15 ,    -16 ,    -17 ,    -18 ,
105
-    -19 ,    -20 ,    -21 ,    -22 ,
106
-    -23 ,    -24 ,    -25 ,  
107
 
93
 
108
-};
109
 int8_t AGC_ATTEN_ref[16] = {
94
 int8_t AGC_ATTEN_ref[16] = {
110
     15  ,
95
     15  ,
111
     14  ,
96
     14  ,
@@ -125,16 +110,6 @@ int8_t AGC_ATTEN_ref[16] = {
125
     0   ,
110
     0   ,
126
 };
111
 };
127
 
112
 
128
-ALC_dBm_t ALC_Table_ref = {
129
-    -15 ,    -16 ,    -17 ,    -18 ,  -19 ,
130
-    -20 ,    -21 ,    -22 ,    -23 ,  -24 ,    -25 ,    -26 ,    -27 ,
131
-    -28 ,    -29 ,    -30 ,    -31 ,  -32 ,    -33 ,    -34 ,    -35 ,
132
-    -36 ,    -37 ,    -38 ,    -39 ,  -40 ,    -41 ,    -42 ,    -43 ,
133
-    -44 ,    -45 ,    -46 ,    -47 ,  -48 ,    -49 ,    -50 ,    -51 ,
134
-    -52 ,    -53 ,    -54 ,    -55 ,  -56 ,    -57 ,    -58 ,    -59 ,
135
-    -60 ,
136
-
137
-};
138
 
113
 
139
 
114
 
140
 
115
 
@@ -1462,7 +1437,10 @@ void DataStatusSet(void){
1462
 
1437
 
1463
     DataStatusSet();
1438
     DataStatusSet();
1464
 }
1439
 }
1440
+//uint8_t ResultData[1024] = {0,}; 
1465
 uint8_t* MBIC_HeaderDataSetting(uint8_t* data){
1441
 uint8_t* MBIC_HeaderDataSetting(uint8_t* data){
1442
+    static uint8_t ResultData[1024] = {0,}; /*NOT YET*/ 
1443
+
1466
 	ResultData[MBIC_PREAMBLE_0] = MBIC_PREAMBLE0;
1444
 	ResultData[MBIC_PREAMBLE_0] = MBIC_PREAMBLE0;
1467
 	ResultData[MBIC_PREAMBLE_1] = MBIC_PREAMBLE1;
1445
 	ResultData[MBIC_PREAMBLE_1] = MBIC_PREAMBLE1;
1468
 	ResultData[MBIC_PREAMBLE_2] = MBIC_PREAMBLE2;
1446
 	ResultData[MBIC_PREAMBLE_2] = MBIC_PREAMBLE2;
@@ -2426,6 +2404,10 @@ uint32_t SumFunc(uint16_t* data,uint16_t size){
2426
 
2404
 
2427
 void ADC_Check(void){
2405
 void ADC_Check(void){
2428
     //static uint8_t Cnt = 0;
2406
     //static uint8_t Cnt = 0;
2407
+   double ADC1DoubleRet[4];
2408
+   double ADC3DoubleRet[5];
2409
+   uint32_t ADC1_Average_value[ADC1_CNT];
2410
+   uint32_t ADC3_Average_value[ADC3_CNT];
2429
 
2411
 
2430
    // double ret = 0;
2412
    // double ret = 0;
2431
     uint16_t MIN_ADC[ADC3_CNT] = {0,};
2413
     uint16_t MIN_ADC[ADC3_CNT] = {0,};
@@ -2780,13 +2762,25 @@ void ALC_Function(){ //DL
2780
     double ret = 0;
2762
     double ret = 0;
2781
    // double CurrnALCValue = 0;
2763
    // double CurrnALCValue = 0;
2782
     double CurrentATTENVALUE = 0;
2764
     double CurrentATTENVALUE = 0;
2783
-    int32_t CurrnALC_MAX_SettingValue = 0;    
2784
-    int32_t CurrnALC_MIN_SettingValue = 0;        
2785
-    int32_t ALC_Result = 0;
2765
+  //  int32_t CurrnALC_MAX_SettingValue = 0;
2766
+  //  int32_t CurrnALC_MIN_SettingValue = 0;
2767
+  //  int32_t ALC_Result = 0;
2786
     int16_t Limitdata = 0;
2768
     int16_t Limitdata = 0;
2787
     double ResdBm = 0;
2769
     double ResdBm = 0;
2788
     uint16_t IwillGiveAtten = 0;
2770
     uint16_t IwillGiveAtten = 0;
2789
     uint8_t tempadc[100];
2771
     uint8_t tempadc[100];
2772
+    ALC_dBm_t ALC_Table_ref = {
2773
+        -15 ,    -16 ,    -17 ,    -18 ,  -19 ,
2774
+        -20 ,    -21 ,    -22 ,    -23 ,  -24 ,    -25 ,    -26 ,    -27 ,
2775
+        -28 ,    -29 ,    -30 ,    -31 ,  -32 ,    -33 ,    -34 ,    -35 ,
2776
+        -36 ,    -37 ,    -38 ,    -39 ,  -40 ,    -41 ,    -42 ,    -43 ,
2777
+        -44 ,    -45 ,    -46 ,    -47 ,  -48 ,    -49 ,    -50 ,    -51 ,
2778
+        -52 ,    -53 ,    -54 ,    -55 ,  -56 ,    -57 ,    -58 ,    -59 ,
2779
+        -60 ,
2780
+    
2781
+    };
2782
+
2783
+
2790
     Bluecell_StructCpy(&AutoControl_Save[0],&ALC_Table_ref.DET_UL_0,sizeof(ALC_dBm_t));
2784
     Bluecell_StructCpy(&AutoControl_Save[0],&ALC_Table_ref.DET_UL_0,sizeof(ALC_dBm_t));
2791
     Bluecell_StructCpy(&tempadc[0],&Det_UL1.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
2785
     Bluecell_StructCpy(&tempadc[0],&Det_UL1.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
2792
     if(ALCTimerCnt > 100){
2786
     if(ALCTimerCnt > 100){
@@ -2917,6 +2911,18 @@ void AGC_Function(){//DL
2917
     int i = 0;
2911
     int i = 0;
2918
     int16_t Limitdata = 0;
2912
     int16_t Limitdata = 0;
2919
     uint16_t IwillgiveAtten = 0;
2913
     uint16_t IwillgiveAtten = 0;
2914
+    int8_t AGC_Table_ref[sizeof(AGC_dBm_t)] = {
2915
+         5   ,    4   ,    3   ,    2   ,
2916
+         1   ,    0   ,    -1  ,    -2  ,
2917
+        -3  ,    -4  ,    -5  ,    -6  ,
2918
+        -7  ,    -8  ,    -9  ,    -10 ,
2919
+        -11 ,    -12 ,    -13 ,    -14 ,
2920
+        -15 ,    -16 ,    -17 ,    -18 ,
2921
+        -19 ,    -20 ,    -21 ,    -22 ,
2922
+        -23 ,    -24 ,    -25 ,  
2923
+
2924
+    }; 
2925
+         
2920
     if(AGCTimerCnt > 100){
2926
     if(AGCTimerCnt > 100){
2921
         Bluecell_StructCpy(&AutoControl_Save[0],&AGC_Table_ref[0],sizeof(AGC_dBm_t));
2927
         Bluecell_StructCpy(&AutoControl_Save[0],&AGC_Table_ref[0],sizeof(AGC_dBm_t));
2922
 
2928
 

+ 0 - 2
Inc/main.h

@@ -57,8 +57,6 @@ void Error_Handler(void);
57
 /* USER CODE BEGIN EFP */
57
 /* USER CODE BEGIN EFP */
58
 extern volatile uint16_t ADC1value[4];
58
 extern volatile uint16_t ADC1value[4];
59
 extern volatile uint16_t ADC3value[5];
59
 extern volatile uint16_t ADC3value[5];
60
-extern volatile uint32_t ADC1_Average_value[4];
61
-extern volatile uint32_t ADC3_Average_value[5];
62
 
60
 
63
 extern uint16_t adc1cnt;
61
 extern uint16_t adc1cnt;
64
 extern uint16_t adc3cnt;
62
 extern uint16_t adc3cnt;

+ 2 - 5
Src/main.c

@@ -64,8 +64,7 @@ DMA_HandleTypeDef hdma_usart2_tx;
64
 /* USER CODE BEGIN PV */
64
 /* USER CODE BEGIN PV */
65
 volatile uint16_t ADC1value[ADC1_CNT];
65
 volatile uint16_t ADC1value[ADC1_CNT];
66
 volatile uint16_t ADC3value[ADC3_CNT];
66
 volatile uint16_t ADC3value[ADC3_CNT];
67
-volatile uint32_t ADC1_Average_value[ADC1_CNT];
68
-volatile uint32_t ADC3_Average_value[ADC3_CNT];
67
+
69
 volatile uint16_t ADC1valuearray[ADC1_CNT][ADC_AVERAGECNT];
68
 volatile uint16_t ADC1valuearray[ADC1_CNT][ADC_AVERAGECNT];
70
 volatile uint16_t ADC3valuearray[ADC3_CNT][ADC_AVERAGECNT];
69
 volatile uint16_t ADC3valuearray[ADC3_CNT][ADC_AVERAGECNT];
71
 
70
 
@@ -130,7 +129,6 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
130
     {
129
     {
131
         if(adc1cnt < 500){
130
         if(adc1cnt < 500){
132
             for(int i = 0; i < 4; i++){
131
             for(int i = 0; i < 4; i++){
133
-//                ADC1_Average_value[i] += ADC1value[i];
134
                 ADC1valuearray[i][adc1cnt] = ADC1value[i];
132
                 ADC1valuearray[i][adc1cnt] = ADC1value[i];
135
             }
133
             }
136
             adc1cnt++;
134
             adc1cnt++;
@@ -140,7 +138,6 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
140
     {
138
     {
141
         if(adc3cnt < 500){
139
         if(adc3cnt < 500){
142
             for(int i = 0; i < 5; i++){
140
             for(int i = 0; i < 5; i++){
143
-//                ADC3_Average_value[i] += ADC3value[i]  ;
144
                 ADC3valuearray[i][adc3cnt] = ADC3value[i];
141
                 ADC3valuearray[i][adc3cnt] = ADC3value[i];
145
             }
142
             }
146
             adc3cnt++;
143
             adc3cnt++;
@@ -253,7 +250,7 @@ void EEPROMTEST_J(){
253
 
250
 
254
 void eepromtest_j1(){
251
 void eepromtest_j1(){
255
     uint8_t eepromtestReadarray[1024 * 4];
252
     uint8_t eepromtestReadarray[1024 * 4];
256
-    uint8_t ret  = 0;
253
+    //uint8_t ret  = 0;
257
 
254
 
258
     EEPROM_M24C08_Read(EEPROM_M24C08_ID ,EEPROM_ATT_BASE + 96,eepromtestReadarray,128 );
255
     EEPROM_M24C08_Read(EEPROM_M24C08_ID ,EEPROM_ATT_BASE + 96,eepromtestReadarray,128 );
259
     for(int i = 0; i< 128 ; i++){
256
     for(int i = 0; i< 128 ; i++){