Преглед изворни кода

ADC bluecell 알고리즘 적용

PYJ пре 4 година
родитељ
комит
859d9a5747
4 измењених фајлова са 459 додато и 43 уклоњено
  1. 438 25
      Bluecell_Src/Bluecell_operate.c
  2. 1 1
      Bluecell_Src/MBIC_Bootloader.c
  3. 8 8
      Bluecell_Src/eeprom.c
  4. 12 9
      Src/main.c

+ 438 - 25
Bluecell_Src/Bluecell_operate.c

@@ -44,8 +44,10 @@ extern volatile uint32_t DET_DL_Normal_Shutdown_On_AlarmTimerCnt[DET_Alarm_UL_In
44 44
 extern volatile uint32_t DET_UL_Normal_Shutdown_On_AlarmTimerCnt[DET_Alarm_UL_Index_MAX] ;
45 45
 
46 46
 extern ALL_PE43711_st ALL_ATT;
47
-//extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
48
-//extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
47
+extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
48
+extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
49
+extern volatile uint16_t ADC1Desc_valuearray[4][ADC_AVERAGECNT];
50
+extern volatile uint16_t ADC3Desc_valuearray[5][ADC_AVERAGECNT];
49 51
 
50 52
 extern volatile uint32_t LedTimerCnt;
51 53
 extern volatile uint32_t AdcTimerCnt;
@@ -2068,6 +2070,11 @@ bool Bluecell_Operate(uint8_t* data){
2068 2070
 //       printf("DL PATH 1 : %d \r\n",data[BLUECELL_DATA]);
2069 2071
        if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2070 2072
               return true;
2073
+       if(data[MBIC_PAYLOADSTART] != 0)
2074
+           bluecell_Currdatastatus.Path_TempSave_Bit = 0x80;
2075
+       else
2076
+          bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x80;
2077
+
2071 2078
 
2072 2079
        DL_Path_OnOff(Path1_OnOff,
2073 2080
             data[BLUECELL_DATA],
@@ -2096,6 +2103,10 @@ bool Bluecell_Operate(uint8_t* data){
2096 2103
 #else
2097 2104
         if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2098 2105
                return true;
2106
+        if(data[MBIC_PAYLOADSTART] != 0)
2107
+            bluecell_Currdatastatus.Path_TempSave_Bit = 0x08;
2108
+        else
2109
+           bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x08;
2099 2110
 
2100 2111
         UL_Path_OnOff(Path1_OnOff,
2101 2112
              data[BLUECELL_DATA],
@@ -2163,6 +2174,10 @@ bool Bluecell_Operate(uint8_t* data){
2163 2174
 #else
2164 2175
         if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2165 2176
           return true;
2177
+        if(data[MBIC_PAYLOADSTART] != 0)
2178
+            bluecell_Currdatastatus.Path_TempSave_Bit = 0x40;
2179
+        else
2180
+           bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x40;
2166 2181
 
2167 2182
         DL_Path_OnOff(Path2_OnOff,
2168 2183
              data[BLUECELL_DATA],
@@ -2194,6 +2209,10 @@ bool Bluecell_Operate(uint8_t* data){
2194 2209
 #else
2195 2210
         if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2196 2211
           return true;
2212
+        if(data[MBIC_PAYLOADSTART] != 0)
2213
+            bluecell_Currdatastatus.Path_TempSave_Bit = 0x04;
2214
+        else
2215
+           bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x04;
2197 2216
 
2198 2217
         UL_Path_OnOff(Path2_OnOff,
2199 2218
              data[BLUECELL_DATA],
@@ -2239,6 +2258,10 @@ bool Bluecell_Operate(uint8_t* data){
2239 2258
 #else
2240 2259
         if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2241 2260
           return true;
2261
+        if(data[MBIC_PAYLOADSTART] != 0)
2262
+            bluecell_Currdatastatus.Path_TempSave_Bit = 0x20;
2263
+        else
2264
+           bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x20;
2242 2265
 
2243 2266
         DL_Path_OnOff(Path3_OnOff,
2244 2267
              data[BLUECELL_DATA],
@@ -2266,6 +2289,10 @@ bool Bluecell_Operate(uint8_t* data){
2266 2289
 #else
2267 2290
         if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2268 2291
           return true;
2292
+        if(data[MBIC_PAYLOADSTART] != 0)
2293
+            bluecell_Currdatastatus.Path_TempSave_Bit = 0x02;
2294
+        else
2295
+           bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x02;
2269 2296
 
2270 2297
         UL_Path_OnOff(Path3_OnOff,
2271 2298
              data[BLUECELL_DATA],
@@ -2310,6 +2337,10 @@ bool Bluecell_Operate(uint8_t* data){
2310 2337
 #else
2311 2338
         if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2312 2339
           return true;
2340
+        if(data[MBIC_PAYLOADSTART] != 0)
2341
+            bluecell_Currdatastatus.Path_TempSave_Bit = 0x10;
2342
+        else
2343
+           bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x10;
2313 2344
 
2314 2345
         DL_Path_OnOff(Path4_OnOff,
2315 2346
              data[BLUECELL_DATA],
@@ -2340,6 +2371,10 @@ bool Bluecell_Operate(uint8_t* data){
2340 2371
 #else
2341 2372
         if(bluecell_Currdatastatus.Carrier_ON_OFF == false)
2342 2373
           return true;
2374
+        if(data[MBIC_PAYLOADSTART] != 0)
2375
+            bluecell_Currdatastatus.Path_TempSave_Bit = 0x01;
2376
+        else
2377
+           bluecell_Currdatastatus.Path_TempSave_Bit &= ~0x01;
2343 2378
 
2344 2379
         UL_Path_OnOff(Path4_OnOff,
2345 2380
              data[BLUECELL_DATA],
@@ -2987,7 +3022,7 @@ bool Bluecell_Operate(uint8_t* data){
2987 3022
     case Bluecell_CarrierOnOff:
2988 3023
         bluecell_Currdatastatus.Carrier_ON_OFF = data[BLUECELL_DATA + i++]; 
2989 3024
         Carrier_ONOFF(bluecell_Currdatastatus.Carrier_ON_OFF);
2990
-//        printf("Carrier %d \r\n",bluecell_Currdatastatus.Carrier_ON_OFF);
3025
+        printf("Carrier %d \r\n",bluecell_Currdatastatus.Carrier_ON_OFF);
2991 3026
     break;
2992 3027
     case Bluecell_PCBVersionSet:
2993 3028
 //        printf("Bluecell_PCBVersionSet\r\n");
@@ -3031,7 +3066,7 @@ bool Bluecell_Operate(uint8_t* data){
3031 3066
 //        printf("Bluecell_UL_Det_Path4_Offset : %d \r\n",bluecell_Currdatastatus.UL_Det_Path_Offset[3]);        
3032 3067
         break;
3033 3068
     case Bluecell_Temp_Shutdown_Path_ON_OFF:
3034
-         bluecell_Prevdatastatus.Path_TempShutdown_Set = data[MBIC_PAYLOADSTART + 3];
3069
+         bluecell_Currdatastatus.Path_TempShutdown_Set = data[BLUECELL_DATA];
3035 3070
          Temp_Shutdown_ONOFF(bluecell_Prevdatastatus.Path_TempShutdown_Set);
3036 3071
         break;
3037 3072
   }
@@ -3039,10 +3074,15 @@ bool Bluecell_Operate(uint8_t* data){
3039 3074
   if(datatype != Bluecell_StatusReq
3040 3075
   && datatype != Bluecell_LED_TEST
3041 3076
   && datatype != ATT_TableSet
3042
-  && datatype != ATT_TableGet)
3077
+  && datatype != ATT_TableGet
3078
+  && datatype != Bluecell_Temp_Shutdown_Path_ON_OFF)
3079
+  
3043 3080
   {
3044
-      Bluecell_StructCpy(&DataWrite[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
3045
-      EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&DataWrite[0],sizeof(BLUESTATUS_st));
3081
+//      Bluecell_StructCpy(&DataWrite[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
3082
+      
3083
+      EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
3084
+
3085
+//      EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&DataWrite[0],sizeof(BLUESTATUS_st));
3046 3086
 //      EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_WINDOW_STATUS_ADDRESDS,&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st) );
3047 3087
 //      Bluecell_StructCpy(&Txdata[0],&DataWrite[0],sizeof(BLUESTATUS_st));
3048 3088
 //      Txdata[sizeof(BLUESTATUS_st) - 2] = STH30_CreateCrc(&Txdata[BLUECELL_TYPE], sizeof(BLUESTATUS_st) - 3);
@@ -3113,42 +3153,42 @@ void HFR_TypeInit(){
3113 3153
         PrevMBIC_DL_ShutdownCount[i] = 0xFF;        
3114 3154
     }
3115 3155
 #if 1 // PYJ.2020.06.17_BEGIN -- 
3116
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x80)
3156
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x80)
3117 3157
         bluecell_Currdatastatus.ATT_DL1_PATH = true;
3118 3158
     else
3119 3159
         bluecell_Currdatastatus.ATT_DL1_PATH = false;
3120 3160
 
3121
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x40)
3161
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x40)
3122 3162
         bluecell_Currdatastatus.ATT_DL2_PATH = true;
3123 3163
     else
3124 3164
         bluecell_Currdatastatus.ATT_DL2_PATH = false;
3125 3165
 
3126
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x20)
3166
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x20)
3127 3167
         bluecell_Currdatastatus.ATT_DL3_PATH = true;
3128 3168
     else
3129 3169
         bluecell_Currdatastatus.ATT_DL3_PATH = false;
3130 3170
 
3131
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x10)
3171
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x10)
3132 3172
         bluecell_Currdatastatus.ATT_DL4_PATH = true;
3133 3173
     else
3134 3174
         bluecell_Currdatastatus.ATT_DL4_PATH = false;
3135 3175
 
3136
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x08)
3176
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x08)
3137 3177
         bluecell_Currdatastatus.ATT_UL1_PATH = true;
3138 3178
     else
3139 3179
         bluecell_Currdatastatus.ATT_UL1_PATH = false;
3140 3180
 
3141
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x04)
3181
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x04)
3142 3182
         bluecell_Currdatastatus.ATT_UL2_PATH = true;
3143 3183
     else
3144 3184
         bluecell_Currdatastatus.ATT_UL2_PATH = false;
3145 3185
 
3146
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x02)
3186
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x02)
3147 3187
         bluecell_Currdatastatus.ATT_UL3_PATH = true;
3148 3188
     else
3149 3189
         bluecell_Currdatastatus.ATT_UL3_PATH = false;
3150 3190
 
3151
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x01)
3191
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x01)
3152 3192
         bluecell_Currdatastatus.ATT_UL4_PATH = true;
3153 3193
     else
3154 3194
         bluecell_Currdatastatus.ATT_UL4_PATH = false;
@@ -4389,6 +4429,7 @@ void Carrier_ONOFF(uint8_t val){
4389 4429
         bluecell_Currdatastatus.ATT_UL2_PATH = PATH_DEFAULT;    
4390 4430
         bluecell_Currdatastatus.ATT_UL3_PATH = PATH_DEFAULT;    
4391 4431
         bluecell_Currdatastatus.ATT_UL4_PATH = PATH_DEFAULT;   
4432
+        bluecell_Currdatastatus.Path_TempSave_Bit = 0xFF;
4392 4433
         DL_Path_OnOff(Path1_OnOff,
4393 4434
              true,
4394 4435
              &bluecell_Currdatastatus.ATT_DL1_PATH,
@@ -4452,6 +4493,7 @@ void Carrier_ONOFF(uint8_t val){
4452 4493
         bluecell_Currdatastatus.ATT_UL2_PATH = false;    
4453 4494
         bluecell_Currdatastatus.ATT_UL3_PATH = false;    
4454 4495
         bluecell_Currdatastatus.ATT_UL4_PATH = false; 
4496
+        bluecell_Currdatastatus.Path_TempSave_Bit = 0x00;        
4455 4497
         DL_Path_OnOff(Path1_OnOff,
4456 4498
              false,
4457 4499
              &bluecell_Currdatastatus.ATT_DL1_PATH,
@@ -4654,6 +4696,204 @@ void Temp_Shutdown_ONOFF(uint8_t val){
4654 4696
 
4655 4697
 //        HAL_Delay(10);
4656 4698
     CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);    
4699
+}
4700
+typedef enum{
4701
+    Temperature_AlarmType,
4702
+    DLI_P4_Level_LowType,
4703
+    DLI_P3_Level_LowType,   
4704
+    DLI_P2_Level_LowType,  
4705
+    DLI_P1_Level_LowType, 
4706
+    DLI_P4_Level_HighType,   
4707
+    DLI_P3_Level_HighType,   
4708
+    DLI_P2_Level_HighType,   
4709
+    DLI_P1_Level_HighType,   
4710
+    DLI_P4_AGC_AlarmType,    
4711
+    DLI_P3_AGC_AlarmType,    
4712
+    DLI_P2_AGC_AlarmType,    
4713
+    DLI_P1_AGC_AlarmType,    
4714
+    DLI_P4_Shutdown_AlarmType,   
4715
+    DLI_P3_Shutdown_AlarmType,   
4716
+    DLI_P2_Shutdown_AlarmType,   
4717
+    DLI_P1_Shutdown_AlarmType,   
4718
+    ULO_P4_Level_HighType,   
4719
+    ULO_P3_Level_HighType,   
4720
+    ULO_P2_Level_HighType,   
4721
+    ULO_P1_Level_HighType,   
4722
+    ULO_P4_ALC_AlarmType,    
4723
+    ULO_P3_ALC_AlarmType,    
4724
+    ULO_P2_ALC_AlarmType,    
4725
+    ULO_P1_ALC_AlarmType,    
4726
+    ULO_P4_ShutdownType, 
4727
+    ULO_P3_ShutdownType, 
4728
+    ULO_P2_ShutdownType, 
4729
+    ULO_P1_ShutdownType, 
4730
+    Alarm_type_IndexMax
4731
+}Alarm_type;
4732
+#define OVERPOWER_STR "Overpower"
4733
+#define OVER_INPUT_STR "Over-Input"
4734
+uint8_t AlarmReport_History[Alarm_type_IndexMax] = {0,};
4735
+uint8_t* Alarm_Report_Send(uint8_t Alarm_type,uint8_t val){
4736
+    if(AlarmReport_History[Alarm_type] != true){
4737
+        return;
4738
+    }
4739
+    static uint8_t Alarm_ReportData[40 + 21 + 3] = {0,};
4740
+    uint8_t index = 0;
4741
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0xE0;
4742
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = Alarm_type;    
4743
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = val;
4744
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4745
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;
4746
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4747
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;
4748
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4749
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;
4750
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4751
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;
4752
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4753
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;
4754
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4755
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;
4756
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4757
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = bluecell_Currdatastatus.Carrier_ID;
4758
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = bluecell_Currdatastatus.Freq_ID;    
4759
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;
4760
+    Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;    
4761
+
4762
+    
4763
+    for(int i = 20; i < 40; i++)
4764
+        Alarm_ReportData[i] = 0;
4765
+    
4766
+ 
4767
+
4768
+    int16_t LimitData_UL_High = 0;
4769
+    
4770
+    int16_t LimitData_DL_High = 0;    
4771
+    int16_t LimitData_DL_Low = 0;    
4772
+
4773
+
4774
+    int16_t LimitData_DL_Shutdown = 0;    
4775
+    int16_t LimitData_UL_Shutdown = 0;    
4776
+    
4777
+    double ret = 0;
4778
+    int16_t Res_DL_dBm[DET_Alarm_DL_Index_MAX] = {0,};
4779
+    int16_t Res_UL_dBm[DET_Alarm_UL_Index_MAX] = {0,};    
4780
+    
4781
+
4782
+    LimitData_UL_High = ConvertTo2byte(bluecell_Currdatastatus.ULO_Level_High_Threshold_H,bluecell_Currdatastatus.ULO_Level_High_Threshold_L) * 0.1;
4783
+    LimitData_DL_High = ConvertTo2byte(bluecell_Currdatastatus.DLI_Level_High_Threshold_H,bluecell_Currdatastatus.DLI_Level_High_Threshold_L)* 0.1;
4784
+    LimitData_DL_Low  = ConvertTo2byte(bluecell_Currdatastatus.DLI_Level_Low_Threshold_H,bluecell_Currdatastatus.DLI_Level_Low_Threshold_L)* 0.1;
4785
+
4786
+    LimitData_DL_Shutdown = ConvertTo2byte(bluecell_Currdatastatus.DLI_Shutdown_Threshold_H,bluecell_Currdatastatus.DLI_Shutdown_Threshold_L)* 0.1;
4787
+    LimitData_UL_Shutdown = ConvertTo2byte(bluecell_Currdatastatus.ULO_Shutdown_Threshold_H,bluecell_Currdatastatus.ULO_Shutdown_Threshold_L)* 0.1;
4788
+    
4789
+
4790
+    ret  = bluecell_Currdatastatus.DLI_P1_Level1_H << 8;
4791
+    ret += bluecell_Currdatastatus.DLI_P1_Level1_L;   
4792
+    ret *= 0.001;    
4793
+    Res_DL_dBm[DET_Alarm_DL1_Index] 
4794
+        = bluecell_Currdatastatus.DLI_Level1_H << 8 | bluecell_Currdatastatus.DLI_Level1_L;//(int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&Det_DL1.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st)));
4795
+    ret  = bluecell_Currdatastatus.DLI_P2_Level2_H << 8;
4796
+    ret += bluecell_Currdatastatus.DLI_P2_Level2_L;   
4797
+    ret *= 0.001;  
4798
+
4799
+    Res_DL_dBm[DET_Alarm_DL2_Index] 
4800
+        = bluecell_Currdatastatus.DLI_Level2_H << 8 | bluecell_Currdatastatus.DLI_Level2_L;//(int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&Det_DL2.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st)));
4801
+    ret  = bluecell_Currdatastatus.DLI_P3_Level3_H << 8;
4802
+    ret += bluecell_Currdatastatus.DLI_P3_Level3_L;   
4803
+    ret *= 0.001;  
4804
+
4805
+    Res_DL_dBm[DET_Alarm_DL3_Index] 
4806
+        = bluecell_Currdatastatus.DLI_Level3_H << 8 | bluecell_Currdatastatus.DLI_Level3_L;//(int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&Det_DL3.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st)));
4807
+
4808
+
4809
+    ret  = bluecell_Currdatastatus.DLI_P4_Level4_H << 8;
4810
+    ret += bluecell_Currdatastatus.DLI_P4_Level4_L;   
4811
+    ret *= 0.001;  
4812
+
4813
+    Res_DL_dBm[DET_Alarm_DL4_Index] 
4814
+        = bluecell_Currdatastatus.DLI_Level4_H << 8 | bluecell_Currdatastatus.DLI_Level4_L;//(int8_t)Bluecell_TestPro(AGC_AutoControl_ADC_Compare(ret,&Det_DL4.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st)));
4815
+
4816
+
4817
+
4818
+    ret  = bluecell_Currdatastatus.ULO_P1_Level1_H << 8;
4819
+    ret += bluecell_Currdatastatus.ULO_P1_Level1_L;   
4820
+    ret *= 0.001;
4821
+
4822
+    Res_UL_dBm[DET_Alarm_UL1_Index] 
4823
+        = bluecell_Currdatastatus.ULO_Level1_H << 8 | bluecell_Currdatastatus.ULO_Level1_L; //(int8_t)Bluecell_TestPro(AutoControl_ADC_Compare(ret,&Det_UL1.Table_Det_15_dBm_H,Det_UL1.Table_Length * 2));
4824
+
4825
+
4826
+    ret  = bluecell_Currdatastatus.ULO_P2_Level2_H << 8;
4827
+    ret += bluecell_Currdatastatus.ULO_P2_Level2_L;   
4828
+    ret *= 0.001;
4829
+
4830
+    Res_UL_dBm[DET_Alarm_UL2_Index] 
4831
+        = bluecell_Currdatastatus.ULO_Level2_H << 8 | bluecell_Currdatastatus.ULO_Level2_L;//(int8_t)Bluecell_TestPro(AutoControl_ADC_Compare(ret,&Det_UL2.Table_Det_15_dBm_H,Det_UL2.Table_Length * 2));
4832
+
4833
+    ret  = bluecell_Currdatastatus.ULO_P3_Level3_H << 8;
4834
+    ret += bluecell_Currdatastatus.ULO_P3_Level3_L;   
4835
+    ret *= 0.001;
4836
+
4837
+    Res_UL_dBm[DET_Alarm_UL3_Index] 
4838
+        = bluecell_Currdatastatus.ULO_Level3_H << 8 | bluecell_Currdatastatus.ULO_Level3_L;//(int8_t)Bluecell_TestPro(AutoControl_ADC_Compare(ret,&Det_UL3.Table_Det_15_dBm_H,Det_UL3.Table_Length * 2));
4839
+
4840
+
4841
+    ret  = bluecell_Currdatastatus.ULO_P4_Level4_H << 8;
4842
+    ret += bluecell_Currdatastatus.ULO_P4_Level4_L;   
4843
+    ret *= 0.001;
4844
+
4845
+    Res_UL_dBm[DET_Alarm_UL4_Index] 
4846
+        = bluecell_Currdatastatus.ULO_Level4_H << 8 | bluecell_Currdatastatus.ULO_Level4_L;//(int8_t)Bluecell_TestPro(AutoControl_ADC_Compare(ret,&Det_UL4.Table_Det_15_dBm_H,Det_UL4.Table_Length * 2));
4847
+    
4848
+    switch(Alarm_type){
4849
+        case Temperature_AlarmType:     sprintf(&Alarm_ReportData[20],"Temp:%2.1f, Th:%2.1f",bluecell_Currdatastatus.DET_TEMP,bluecell_Currdatastatus.Temp_High_Threshold);    break;
4850
+        case DLI_P4_Level_LowType:      sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL1_Index],LimitData_DL_Low);    break;
4851
+        case DLI_P3_Level_LowType:      sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL2_Index],LimitData_DL_Low);    break;
4852
+        case DLI_P2_Level_LowType:      sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL3_Index],LimitData_DL_Low);    break;
4853
+        case DLI_P1_Level_LowType:      sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL4_Index],LimitData_DL_Low);    break;
4854
+        case DLI_P4_Level_HighType:     sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL1_Index],LimitData_DL_High);    break;
4855
+        case DLI_P3_Level_HighType:     sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL2_Index],LimitData_DL_High);    break;
4856
+        case DLI_P2_Level_HighType:     sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL3_Index],LimitData_DL_High);    break;
4857
+        case DLI_P1_Level_HighType:     sprintf(&Alarm_ReportData[20],"DLI:%2.1f, Th:%2.1f",Res_DL_dBm[DET_Alarm_DL4_Index],LimitData_DL_High);    break;
4858
+        case DLI_P4_AGC_AlarmType:
4859
+        case DLI_P3_AGC_AlarmType:
4860
+        case DLI_P2_AGC_AlarmType:
4861
+        case DLI_P1_AGC_AlarmType:      break;
4862
+        case DLI_P4_Shutdown_AlarmType: sprintf(&Alarm_ReportData[20],OVERPOWER_STR);    break;
4863
+        case DLI_P3_Shutdown_AlarmType: sprintf(&Alarm_ReportData[20],OVERPOWER_STR);    break;
4864
+        case DLI_P2_Shutdown_AlarmType: sprintf(&Alarm_ReportData[20],OVERPOWER_STR);    break;
4865
+        case DLI_P1_Shutdown_AlarmType: sprintf(&Alarm_ReportData[20],OVERPOWER_STR);    break;
4866
+        case ULO_P4_Level_HighType:     sprintf(&Alarm_ReportData[20],"ULO:%2.1f, Th:%2.1f",Res_UL_dBm[DET_Alarm_UL1_Index],LimitData_UL_High);    break;
4867
+        case ULO_P3_Level_HighType:     sprintf(&Alarm_ReportData[20],"ULO:%2.1f, Th:%2.1f",Res_UL_dBm[DET_Alarm_UL2_Index],LimitData_UL_High);    break;
4868
+        case ULO_P2_Level_HighType:     sprintf(&Alarm_ReportData[20],"ULO:%2.1f, Th:%2.1f",Res_UL_dBm[DET_Alarm_UL3_Index],LimitData_UL_High);    break;
4869
+        case ULO_P1_Level_HighType:     sprintf(&Alarm_ReportData[20],"ULO:%2.1f, Th:%2.1f",Res_UL_dBm[DET_Alarm_UL4_Index],LimitData_UL_High);    break;
4870
+        case ULO_P4_ALC_AlarmType:
4871
+        case ULO_P3_ALC_AlarmType:
4872
+        case ULO_P2_ALC_AlarmType:
4873
+        case ULO_P1_ALC_AlarmType:      break;
4874
+        case ULO_P4_ShutdownType:       sprintf(&Alarm_ReportData[20],OVER_INPUT_STR);    break;
4875
+        case ULO_P3_ShutdownType:       sprintf(&Alarm_ReportData[20],OVER_INPUT_STR);    break;
4876
+        case ULO_P2_ShutdownType:       sprintf(&Alarm_ReportData[20],OVER_INPUT_STR);    break;
4877
+        case ULO_P1_ShutdownType:       sprintf(&Alarm_ReportData[20],OVER_INPUT_STR);    break;
4878
+    }
4879
+    
4880
+    Alarm_ReportData[MBIC_PAYLOADSTART + 1] = Alarm_type;    
4881
+    Alarm_ReportData[MBIC_PAYLOADSTART + 2] = val;        
4882
+    
4883
+    printf("%s \r\n",&Alarm_ReportData[20]);
4884
+    MBIC_HeaderMergeFunction(Alarm_ReportData,40);
4885
+    Alarm_ReportData[MBIC_HEADERCHECKSUM_0] = Chksum_Create(Alarm_ReportData);        
4886
+    uint16_t crcret = ((CRC16_Generate(&Alarm_ReportData[MBIC_PAYLOADSTART], 40) ) );
4887
+//                        printf("\r\n crc ret : %x \r\n",crcret);
4888
+    Alarm_ReportData[MBIC_PAYLOADSTART + (Alarm_ReportData[MBIC_PAYLOADSTART + MBIC_TableIndex_Length] ) + 5] =(( crcret  & 0xFF00)>> 8);  
4889
+    Alarm_ReportData[MBIC_PAYLOADSTART + (Alarm_ReportData[MBIC_PAYLOADSTART + MBIC_TableIndex_Length] ) + 6] = (( crcret  & 0x00FF));  
4890
+    Alarm_ReportData[MBIC_PAYLOADSTART + (Alarm_ReportData[MBIC_PAYLOADSTART + MBIC_TableIndex_Length] ) + 7] = 0x03; 
4891
+
4892
+    Uart1_Data_Send(Alarm_ReportData,sizeof(Alarm_ReportData));
4893
+
4894
+    
4895
+    
4896
+
4657 4897
 }
4658 4898
 
4659 4899
 bool MBIC_Operate(uint8_t* data){
@@ -4822,8 +5062,8 @@ bool MBIC_Operate(uint8_t* data){
4822 5062
                     bluecell_Currdatastatus.Manufacture_Date[i] = data[MBIC_PAYLOADSTART + 3 + i]; 
4823 5063
                 break;
4824 5064
             case Temp_Shutdown_Path_ON_OFF:
4825
-                bluecell_Prevdatastatus.Path_TempShutdown_Set = data[MBIC_PAYLOADSTART + 3];
4826
-                Temp_Shutdown_ONOFF(bluecell_Prevdatastatus.Path_TempShutdown_Set);
5065
+                bluecell_Currdatastatus.Path_TempShutdown_Set = data[MBIC_PAYLOADSTART + 3];
5066
+                Temp_Shutdown_ONOFF(bluecell_Currdatastatus.Path_TempShutdown_Set);
4827 5067
                 break;
4828 5068
             case  Carrier_ON_OFF                          :
4829 5069
                 bluecell_Currdatastatus.Carrier_ON_OFF = data[MBIC_PAYLOADSTART + 3]; 
@@ -5449,14 +5689,16 @@ uint16_t Descendingcompare(const void *a, const void *b)    // 내림차순 비
5449 5689
     
5450 5690
     return 0;           // a와 b가 같을 때는 0 반환
5451 5691
 }
5452
-void DascendigFunc(uint16_t* data,uint32_t size ){
5692
+void DascendigFunc(uint16_t* src,uint32_t size ){
5453 5693
   int temp;
5694
+
5695
+  
5454 5696
   for(int i = 0 ; i < size - 1 ; i ++) {
5455 5697
       for(int j = i+1 ; j < size ; j ++) {
5456
-	  if(data[i] < data[j]) {
5457
-              temp = data[j];
5458
-              data[j] = data[i];
5459
-              data[i] = temp;
5698
+	  if(src[i] < src[j]) {
5699
+              temp = src[j];
5700
+              src[j] = src[i];
5701
+              src[i] = temp;
5460 5702
         }
5461 5703
       }
5462 5704
   }
@@ -6477,8 +6719,9 @@ void ADC_Sampling_Func(uint8_t mode,uint16_t Timer2ms_AdcValue,uint8_t index){
6477 6719
 
6478 6720
 
6479 6721
 #endif // PYJ.2020.08.07_END -- 
6722
+#if 0 // PYJ.2020.08.12_BEGIN -- 
6480 6723
 void ADC_Check(void){
6481
-#if 0 // PYJ.2020.08.07_BEGIN -- 
6724
+#if 1 // PYJ.2020.08.07_BEGIN -- 
6482 6725
     //static uint8_t Cnt = 0;
6483 6726
    double ADC1DoubleRet[4];
6484 6727
    double ADC3DoubleRet[5];
@@ -6497,8 +6740,8 @@ void ADC_Check(void){
6497 6740
 //        printf("%d\r\n",ADC_100ms_Cnt);
6498 6741
 //    }
6499 6742
 
6500
-//    if(adc3cnt >= ADC_AVERAGECNT){
6501
-    if(ADC_100ms_Cnt >= 100){
6743
+    if(adc3cnt >= ADC_AVERAGECNT){
6744
+//    if(ADC_100ms_Cnt >= 100){
6502 6745
         ADC_100ms_Cnt = 0;
6503 6746
         printf("adc3cnt : %d \r\n",adc3cnt);
6504 6747
 #if 1 // PYJ.2020.05.25_BEGIN -- 
@@ -6746,6 +6989,176 @@ void ADC_Check(void){
6746 6989
 
6747 6990
     DET_LevelAlarmCheck();/*DL UL Alarm Check*/
6748 6991
 }
6992
+#else
6993
+#define Percent      2
6994
+#define Percent100 10
6995
+void ADC_Check(void){
6996
+#if 1 // PYJ.2020.08.07_BEGIN -- 
6997
+    //static uint8_t Cnt = 0;
6998
+   double ADC1DoubleRet[4];
6999
+   double ADC3DoubleRet[5];
7000
+   uint32_t ADC1_Average_value[ADC1_CNT];
7001
+   static uint32_t HFR_ADC1_Average_value[ADC1_CNT];
7002
+   uint32_t ADC3_Average_value[ADC3_CNT];
7003
+
7004
+   // double ret = 0;
7005
+    uint16_t MIN_ADC[ADC3_CNT] = {0,};
7006
+    uint16_t cnt[ADC3_CNT] = {0,};
7007
+    double temp;
7008
+    
7009
+//    if(AdcTimerCnt > 10){
7010
+    // 정렬할 배열, 요소 개수, 요소 크기, 비교 함수를 넣어줌
7011
+//
7012
+    if(ADC_100ms_Cnt >= 100){
7013
+#if 1 // PYJ.2020.05.25_BEGIN -- 
7014
+    for(int i = 0; i < ADC3_CNT; i++){
7015
+        for(int index = 0; index < 100; index++){
7016
+            ADC3Desc_valuearray[i][index] = ADC3valuearray[i][index];
7017
+        }
7018
+        DascendigFunc(&ADC3Desc_valuearray[i][0],ADC_AVERAGECNT);
7019
+            
7020
+        ADC3_Average_value[i] = SumFunc(&ADC3Desc_valuearray[i][0],Percent100);
7021
+
7022
+        ADC3_Average_value[i] /=Percent100;
7023
+       
7024
+        if(Total_SamplingCnt == HFR_REQUSET_TOTAL_CNT - 1){
7025
+            ArrayMoveBack(&Adc3_HFR_Array[i][0],HFR_REQUSET_TOTAL_CNT);
7026
+            Adc3_HFR_Array[i][Total_SamplingCnt] = ADC3_Average_value[i]; 
7027
+             for(int index = 0; index <6; index++){
7028
+                 Adc3_HFR_Desc_Array[i][index] = Adc3_HFR_Array[i][index] ;
7029
+             }                  
7030
+            
7031
+
7032
+             DascendigFunc(&Adc3_HFR_Desc_Array[i][0],6);
7033
+             ADC3_Average_value[i] = 0;
7034
+             
7035
+            for(int index = 0; index <Percent; index++)
7036
+                 ADC3_Average_value[i] += Adc3_HFR_Desc_Array[i][index];
7037
+            
7038
+            ADC3_Average_value[i] /= Percent;                
7039
+            
7040
+        }
7041
+        else{
7042
+            Adc3_HFR_Array[i][Total_SamplingCnt] = ADC3_Average_value[i];
7043
+        }
7044
+
7045
+        ADC3DoubleRet[i] = (((ADC3_Average_value[i] ) * 3.3 /4096) * 1000);
7046
+        ADC3Ret[i] = ADC3DoubleRet[i];
7047
+        ADC3_Average_value[i] = 0;
7048
+    }
7049
+    bluecell_Currdatastatus.DLI_P1_Level1_H 
7050
+        = ((ADC3Ret[1] & 0xFF00) >> 8);
7051
+    bluecell_Currdatastatus.DLI_P1_Level1_L 
7052
+        = ((ADC3Ret[1] & 0x00FF));
7053
+    
7054
+
7055
+    bluecell_Currdatastatus.DLI_P2_Level2_H 
7056
+        = ((ADC3Ret[2] & 0xFF00) >> 8);
7057
+    bluecell_Currdatastatus.DLI_P2_Level2_L 
7058
+        = ((ADC3Ret[2] & 0x00FF) );
7059
+
7060
+        
7061
+    bluecell_Currdatastatus.DLI_P3_Level3_H 
7062
+        = ((ADC3Ret[3] & 0xFF00) >> 8);
7063
+    bluecell_Currdatastatus.DLI_P3_Level3_L 
7064
+        = ((ADC3Ret[3] & 0x00FF) );
7065
+
7066
+        
7067
+    bluecell_Currdatastatus.DLI_P4_Level4_H 
7068
+        = ((ADC3Ret[4] & 0xFF00) >> 8);
7069
+    bluecell_Currdatastatus.DLI_P4_Level4_L 
7070
+        = ((ADC3Ret[4] & 0x00FF) );
7071
+
7072
+        
7073
+    bluecell_Currdatastatus.ULO_P4_Level4_H 
7074
+        = ((ADC3Ret[0] & 0xFF00) >> 8);
7075
+    bluecell_Currdatastatus.ULO_P4_Level4_L 
7076
+        = ((ADC3Ret[0] & 0x00FF) );
7077
+#endif // PYJ.2020.05.25_END -- 
7078
+        adc3cnt = 0;
7079
+
7080
+    for(int i = 0; i < ADC1_CNT; i++){
7081
+        for(int index = 0; index < 100; index++){
7082
+            ADC1Desc_valuearray[i][index] = ADC1valuearray[i][index];
7083
+        }
7084
+        DascendigFunc(&ADC1Desc_valuearray[i][0],ADC_AVERAGECNT);
7085
+            
7086
+        ADC1_Average_value[i] = SumFunc(&ADC1Desc_valuearray[i][0],Percent);
7087
+
7088
+        ADC1_Average_value[i] /=Percent;
7089
+       
7090
+        if(Total_SamplingCnt == HFR_REQUSET_TOTAL_CNT - 1){
7091
+            ArrayMoveBack(&Adc1_HFR_Array[i][0],HFR_REQUSET_TOTAL_CNT);
7092
+            Adc1_HFR_Array[i][Total_SamplingCnt] = ADC1_Average_value[i]; 
7093
+             for(int index = 0; index <6; index++){
7094
+                 Adc1_HFR_Desc_Array[i][index] = Adc1_HFR_Array[i][index] ;
7095
+             }                  
7096
+            
7097
+
7098
+             DascendigFunc(&Adc1_HFR_Desc_Array[i][0],6);
7099
+             ADC1_Average_value[i] = 0;
7100
+             
7101
+            for(int index = 0; index <3; index++)
7102
+                 ADC1_Average_value[i] += Adc1_HFR_Desc_Array[i][index];
7103
+            
7104
+            ADC1_Average_value[i] /= 3;                
7105
+            
7106
+        }
7107
+        else{
7108
+            Adc1_HFR_Array[i][Total_SamplingCnt] = ADC1_Average_value[i];
7109
+        }
7110
+
7111
+        ADC1DoubleRet[i] = (((ADC1_Average_value[i] ) * 3.3 /4096) * 1000);
7112
+        ADC1Ret[i] = ADC1DoubleRet[i];
7113
+        ADC1_Average_value[i] = 0;
7114
+    }
7115
+
7116
+        bluecell_Currdatastatus.ULO_P1_Level1_H 
7117
+            = ((ADC1Ret[0] & 0xFF00) >> 8);
7118
+        bluecell_Currdatastatus.ULO_P1_Level1_L 
7119
+            = ((ADC1Ret[0] & 0x00FF) );
7120
+
7121
+            
7122
+        bluecell_Currdatastatus.ULO_P2_Level2_H 
7123
+            = ((ADC1Ret[1] & 0xFF00) >> 8);
7124
+        bluecell_Currdatastatus.ULO_P2_Level2_L 
7125
+            = ((ADC1Ret[1] & 0x00FF) );
7126
+
7127
+            
7128
+        bluecell_Currdatastatus.ULO_P3_Level3_H 
7129
+            = ((ADC1Ret[2] & 0xFF00) >> 8);
7130
+        bluecell_Currdatastatus.ULO_P3_Level3_L 
7131
+            = ((ADC1Ret[2] & 0x00FF) );
7132
+
7133
+/* *
7134
+온도 소수점 제거
7135
+*/
7136
+    temp = (ADC1Ret[3] * 0.001);
7137
+    bluecell_Currdatastatus.DET_TEMP =  ((temp - 0.5) * 100);
7138
+    bluecell_Currdatastatus.DET_TEMP  += bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET;
7139
+//    printf("bluecell_Currdatastatus.DET_TEMP : %d \r\n",bluecell_Currdatastatus.DET_TEMP);
7140
+    
7141
+        ADC_100ms_Cnt = 0;
7142
+
7143
+        adc1cnt = 0;
7144
+        
7145
+        Total_SamplingCnt++;
7146
+//         printf("1. Total_SamplingCnt %d\r\n",Total_SamplingCnt);
7147
+        if(Total_SamplingCnt >= 5)
7148
+            Total_SamplingCnt = 5;
7149
+
7150
+    }
7151
+#endif//    ADC_Sampling_Func();
7152
+
7153
+    /*
7154
+        After ADC calculation is completed, start Det Alarm check.
7155
+    */
7156
+
7157
+    DET_LevelAlarmCheck();/*DL UL Alarm Check*/
7158
+}
7159
+
7160
+
7161
+#endif // PYJ.2020.08.12_END -- 
6749 7162
 
6750 7163
 #endif // PYJ.2020.08.07_END -- 
6751 7164
 

+ 1 - 1
Bluecell_Src/MBIC_Bootloader.c

@@ -526,7 +526,7 @@ void MBIC_Bootloader_FirmwareUpdate(uint8_t* data){
526 526
     
527 527
     Uart1_Data_Send(MBIC_Resp ,22 + 3 + index);
528 528
     if( cmd == MBIC_Complete_Notice_RSP
529
-        &&bluecell_Currdatastatus.MBIC_Download_Auto_Restart_Set == true){
529
+        &&bluecell_Currdatastatus.MBIC_Download_Auto_Restart_Set != false){
530 530
         HAL_Delay(100);
531 531
         NVIC_SystemReset();
532 532
     }

+ 8 - 8
Bluecell_Src/eeprom.c

@@ -250,42 +250,42 @@ void EEPROM_M24C08_Init(void){
250 250
     bluecell_Currdatastatus.Type = 0;
251 251
 
252 252
 
253
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x80)
253
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x80)
254 254
         bluecell_Currdatastatus.ATT_DL1_PATH = true;
255 255
     else
256 256
         bluecell_Currdatastatus.ATT_DL1_PATH = false;
257 257
 
258
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x40)
258
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x40)
259 259
         bluecell_Currdatastatus.ATT_DL2_PATH = true;
260 260
     else
261 261
         bluecell_Currdatastatus.ATT_DL2_PATH = false;
262 262
 
263
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x20)
263
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x20)
264 264
         bluecell_Currdatastatus.ATT_DL3_PATH = true;
265 265
     else
266 266
         bluecell_Currdatastatus.ATT_DL3_PATH = false;
267 267
 
268
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x10)
268
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x10)
269 269
         bluecell_Currdatastatus.ATT_DL4_PATH = true;
270 270
     else
271 271
         bluecell_Currdatastatus.ATT_DL4_PATH = false;
272 272
 
273
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x08)
273
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x08)
274 274
         bluecell_Currdatastatus.ATT_UL1_PATH = true;
275 275
     else
276 276
         bluecell_Currdatastatus.ATT_UL1_PATH = false;
277 277
 
278
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x04)
278
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x04)
279 279
         bluecell_Currdatastatus.ATT_UL2_PATH = true;
280 280
     else
281 281
         bluecell_Currdatastatus.ATT_UL2_PATH = false;
282 282
 
283
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x02)
283
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x02)
284 284
         bluecell_Currdatastatus.ATT_UL3_PATH = true;
285 285
     else
286 286
         bluecell_Currdatastatus.ATT_UL3_PATH = false;
287 287
 
288
-    if(bluecell_Currdatastatus.Path_TempSave_Bit == 0x01)
288
+    if(bluecell_Currdatastatus.Path_TempSave_Bit & 0x01)
289 289
         bluecell_Currdatastatus.ATT_UL4_PATH = true;
290 290
     else
291 291
         bluecell_Currdatastatus.ATT_UL4_PATH = false;

+ 12 - 9
Src/main.c

@@ -70,8 +70,10 @@ volatile uint16_t ADC3value[ADC3_CNT];
70 70
 volatile uint32_t HFR_ADC1value[ADC1_CNT];
71 71
 volatile uint32_t HFR_ADC3value[ADC3_CNT];
72 72
 
73
-//volatile uint16_t ADC1valuearray[ADC1_CNT][ADC_AVERAGECNT];
74
-//volatile uint16_t ADC3valuearray[ADC3_CNT][ADC_AVERAGECNT];
73
+volatile uint16_t ADC1valuearray[ADC1_CNT][ADC_AVERAGECNT];
74
+volatile uint16_t ADC3valuearray[ADC3_CNT][ADC_AVERAGECNT];
75
+volatile uint16_t ADC1Desc_valuearray[4][ADC_AVERAGECNT];
76
+volatile uint16_t ADC3Desc_valuearray[5][ADC_AVERAGECNT];
75 77
 
76 78
 volatile uint32_t AdcTimerCnt = 0;
77 79
 volatile uint32_t LedTimerCnt = 0;
@@ -224,28 +226,29 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
224 226
         }
225 227
     }
226 228
 #else
227
-//    if(adc1cnt == ADC_AVERAGECNT)
228
-//        adc1cnt = 0;
229
-//    if(adc3cnt == ADC_AVERAGECNT)
230
-//        adc3cnt = 0;
229
+    if(adc1cnt == ADC_AVERAGECNT)
230
+        adc1cnt = 0;
231
+    if(adc3cnt == ADC_AVERAGECNT)
232
+        adc3cnt = 0;
231 233
     if(hadc->Instance == hadc1.Instance)
232 234
     {
233 235
         for(int i = 0; i < 4; i++){
234
-//            ADC1valuearray[i][adc1cnt] = ADC1value[i];
236
+            ADC1valuearray[i][adc1cnt] = ADC1value[i];
235 237
             HFR_ADC1value[i] += ADC1value[i];
236 238
 
237 239
         }
238 240
         adc1cnt++;
239 241
     }
240
-
242
+   
241 243
     if(hadc->Instance == hadc3.Instance)
242 244
     {
243 245
         for(int i = 0; i < 5; i++){
244
-//            ADC3valuearray[i][adc3cnt] = ADC3value[i];
246
+            ADC3valuearray[i][adc3cnt] = ADC3value[i];
245 247
             HFR_ADC3value[i] += ADC3value[i];            
246 248
         }
247 249
         adc3cnt++;
248 250
     }    
251
+    
249 252
 //    printf("ADC_100ms_Cnt : %d \r\n",ADC_100ms_Cnt);
250 253
     
251 254