Explorar o código

SelfTest 기능 통합
Gain Value 저장 기능 추가

PYJ %!s(int64=4) %!d(string=hai) anos
pai
achega
673ba089f9
Modificáronse 5 ficheiros con 418 adicións e 486 borrados
  1. 37 50
      Bluecell_Inc/Bluecell_operate.h
  2. 1 1
      Bluecell_Inc/eeprom.h
  3. 350 423
      Bluecell_Src/Bluecell_operate.c
  4. 24 4
      Bluecell_Src/eeprom.c
  5. 6 8
      Src/main.c

+ 37 - 50
Bluecell_Inc/Bluecell_operate.h

@@ -492,6 +492,11 @@ ULO_SelfTest1,
492 492
 ULO_SelfTest2,
493 493
 ULO_SelfTest3,
494 494
 ULO_SelfTest4,
495
+ULO_PATH1_GAIN,
496
+ULO_PATH2_GAIN,
497
+ULO_PATH3_GAIN,
498
+ULO_PATH4_GAIN,
499
+ULO_SelfTest_ONOFF,
495 500
 ULO_ALC_ON_OFF=0x80,
496 501
 ULO_ALC_Threshold,
497 502
 ULO_ALC_Threshold_Default,
@@ -554,16 +559,13 @@ enum DATATYPE
554 559
     BLUECELL_SOFTWARERESET = 0,
555 560
 	ATT_DL1_PATH = 0x12,
556 561
 	ATT_UL1_PATH = 0x16,
557
-	ATT_SelfTest1 = 0x18,
562
+	ATT_SelfTest = 0x18,
558 563
 	ATT_DL2_PATH = 0x22,
559 564
 	ATT_UL2_PATH = 0x26,
560
-	ATT_SelfTest2 = 0x28,
561 565
 	ATT_DL3_PATH = 0x32,
562 566
 	ATT_UL3_PATH = 0x36,
563
-	ATT_SelfTest3 = 0x38,
564 567
 	ATT_DL4_PATH = 0x42,
565 568
 	ATT_UL4_PATH = 0x46,
566
-	ATT_SelfTest4 = 0x48,
567 569
 	Bluecell_ULO_ALC_ON_OFF = 0x51,
568 570
     Bluecell_DLI_AGC_ON_OFF = 0x61,
569 571
     ATT_TableSet = 0x70,
@@ -633,7 +635,11 @@ enum DATATYPE
633 635
     Bluecell_UL_Det_Path2_Offset,    
634 636
     Bluecell_UL_Det_Path3_Offset,    
635 637
     Bluecell_UL_Det_Path4_Offset, 
636
-    Bluecell_Temp_Shutdown_Path_ON_OFF
638
+    Bluecell_Temp_Shutdown_Path_ON_OFF,
639
+    Bluecell_Path1_GainValue,
640
+    Bluecell_Path2_GainValue,
641
+    Bluecell_Path3_GainValue,
642
+    Bluecell_Path4_GainValue,
637 643
 };
638 644
 typedef enum{    
639 645
 	DLI_P1_Level_Table_Number = 0x00,
@@ -786,10 +792,10 @@ typedef struct{
786 792
     uint8_t bluecell_type;
787 793
     uint8_t bluecell_length;
788 794
     uint8_t bluecell_crcindex;
789
-    uint8_t Selftest1;
790
-    uint8_t Selftest2;
791
-    uint8_t Selftest3;
792
-    uint8_t Selftest4;
795
+    int8_t Path1_GainValue;
796
+    int8_t Path2_GainValue;
797
+    int8_t Path3_GainValue;
798
+    int8_t Path4_GainValue;
793 799
     uint8_t ATT_DL1_PATH;
794 800
     uint8_t ATT_DL2_PATH;
795 801
     uint8_t ATT_DL3_PATH;
@@ -1002,51 +1008,32 @@ typedef struct{
1002 1008
     uint8_t MBIC_ULO_ALC_Atten3_L;
1003 1009
     uint8_t MBIC_ULO_ALC_Atten4_H;
1004 1010
     uint8_t MBIC_ULO_ALC_Atten4_L;
1005
-    int8_t MBIC_DLI_P1_Level_Table_Ref;
1006
-    int8_t MBIC_DLI_P2_Level_Table_Ref;
1007
-    int8_t MBIC_DLI_P3_Level_Table_Ref;
1008
-    int8_t MBIC_DLI_P4_Level_Table_Ref;
1009
-    int8_t MBIC_ULO_P1_Level_Table_Ref;
1010
-    int8_t MBIC_ULO_P2_Level_Table_Ref;
1011
-    int8_t MBIC_ULO_P3_Level_Table_Ref;
1012
-    int8_t MBIC_ULO_P4_Level_Table_Ref;
1013
-    int8_t MBIC_TEMP_DL_P1_Level_Table_Ref;
1014
-    int8_t MBIC_TEMP_DL_P2_Level_Table_Ref;
1015
-    int8_t MBIC_TEMP_DL_P3_Level_Table_Ref;
1016
-    int8_t MBIC_TEMP_DL_P4_Level_Table_Ref;
1017
-    int8_t MBIC_TEMP_UL_P1_Level_Table_Ref;
1018
-    int8_t MBIC_TEMP_UL_P2_Level_Table_Ref;
1019
-    int8_t MBIC_TEMP_UL_P3_Level_Table_Ref;
1020
-    int8_t MBIC_TEMP_UL_P4_Level_Table_Ref;
1021
-    int8_t MBIC_DLI_P1_Table_Length;
1022
-    int8_t MBIC_DLI_P2_Table_Length;
1023
-    int8_t MBIC_DLI_P3_Table_Length;
1024
-    int8_t MBIC_DLI_P4_Table_Length;
1025
-    int8_t MBIC_ULO_P1_Table_Length;
1026
-    int8_t MBIC_ULO_P2_Table_Length;
1027
-    int8_t MBIC_ULO_P3_Table_Length;
1028
-    int8_t MBIC_ULO_P4_Table_Length;
1029
-    int8_t MBIC_DLI_P1_Level_Table_Length;
1030
-    int8_t MBIC_DLI_P2_Level_Table_Length;
1031
-    int8_t MBIC_DLI_P3_Level_Table_Length;
1032
-    int8_t MBIC_DLI_P4_Level_Table_Length;
1033
-    int8_t MBIC_ULO_P1_Level_Table_Length;
1034
-    int8_t MBIC_ULO_P2_Level_Table_Length;
1035
-    int8_t MBIC_ULO_P3_Level_Table_Length;
1036
-    int8_t MBIC_ULO_P4_Level_Table_Length;
1037
-    int8_t MBIC_TEMP_DL_P1_Level_Table_Length;
1038
-    int8_t MBIC_TEMP_DL_P2_Level_Table_Length;
1039
-    int8_t MBIC_TEMP_DL_P3_Level_Table_Length;
1040
-    int8_t MBIC_TEMP_DL_P4_Level_Table_Length;
1041
-    int8_t MBIC_TEMP_UL_P1_Level_Table_Length;
1042
-    int8_t MBIC_TEMP_UL_P2_Level_Table_Length;
1043
-    int8_t MBIC_TEMP_UL_P3_Level_Table_Length;
1044
-    int8_t MBIC_TEMP_UL_P4_Level_Table_Length;
1045 1011
     uint8_t DL_Det_ALL_Offset;
1046 1012
     uint8_t MBIC_Download_Auto_Restart_Set;    
1047 1013
     uint8_t Path_TempSave_Bit;/*DL1 / DL 2 /DL3 /DL4 /UL1/UL2/UL3/UL4*/
1048 1014
     uint8_t Path_TempShutdown_Set;/*DL1 / DL 2 /DL3 /DL4 /UL1/UL2/UL3/UL4*/
1049
-    int8_t UL_Det_Path_Offset[1];
1015
+    uint8_t SelfTest;
1016
+    /**/
1017
+    /*Add*/
1018
+    uint8_t SelfTest_ATT_DL1_H;
1019
+    uint8_t SelfTest_ATT_DL1_L;
1020
+    uint8_t SelfTest_ATT_DL2_H;
1021
+    uint8_t SelfTest_ATT_DL2_L;
1022
+    uint8_t SelfTest_ATT_DL3_H;
1023
+    uint8_t SelfTest_ATT_DL3_L;
1024
+    uint8_t SelfTest_ATT_DL4_H;
1025
+    uint8_t SelfTest_ATT_DL4_L;
1026
+
1027
+    uint8_t SelfTest_ATT_UL1_H;
1028
+    uint8_t SelfTest_ATT_UL1_L;
1029
+    uint8_t SelfTest_ATT_UL2_H;
1030
+    uint8_t SelfTest_ATT_UL2_L;
1031
+    uint8_t SelfTest_ATT_UL3_H;
1032
+    uint8_t SelfTest_ATT_UL3_L;
1033
+    uint8_t SelfTest_ATT_UL4_H;
1034
+    uint8_t SelfTest_ATT_UL4_L;
1035
+    uint8_t Reserve[24];
1036
+    /**/
1050 1037
     uint8_t bluecell_crc_H;
1051 1038
     uint8_t bluecell_crc_L;
1052 1039
     uint8_t bluecell_etx;

+ 1 - 1
Bluecell_Inc/eeprom.h

@@ -40,7 +40,7 @@
40 40
 #define EEPROM_TEMP_UL3_TABLE_ADDRESDS	 (( EEPROM_TEMP_UL2_TABLE_ADDRESDS +( sizeof(TEMP_TABLE_st)))     & 0xFFFF)
41 41
 #define EEPROM_TEMP_UL4_TABLE_ADDRESDS	 (( EEPROM_TEMP_UL3_TABLE_ADDRESDS +( sizeof(TEMP_TABLE_st)))     & 0xFFFF)
42 42
 #define EEPROM_USER_ATTEN_VALUE_ADDRESDS (( EEPROM_TEMP_UL4_TABLE_ADDRESDS +( sizeof(USER_ATTEN_st)+16))     & 0xFFFF)
43
-#define EEPROM_WINDOW_STATUS_ADDRESDS	 ((EEPROM_USER_ATTEN_VALUE_ADDRESDS + (sizeof(BLUESTATUS_st))) & 0xFFFF) //96byte
43
+#define EEPROM_WINDOW_STATUS_ADDRESDS	 ((EEPROM_USER_ATTEN_VALUE_ADDRESDS + (sizeof(BLUESTATUS_st))) & 0xFFFF) //128byte
44 44
 
45 45
 #else
46 46
 #define EEPROM_WINDOW_STATUS_ADDRESDS	 ((EEPROM_ATT_BASE + (sizeof(BLUESTATUS_st))) & 0xFFFF) //96byte

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 350 - 423
Bluecell_Src/Bluecell_operate.c


+ 24 - 4
Bluecell_Src/eeprom.c

@@ -241,10 +241,30 @@ void EEPROM_M24C08_Init(void){
241 241
     bluecell_Currdatastatus.DLI_FRBT_Atten3_L = 0;    
242 242
     bluecell_Currdatastatus.DLI_FRBT_Atten4_L = 0;
243 243
     bluecell_Currdatastatus.DLI_FRBT_D_Day = 0;
244
-    bluecell_Currdatastatus.Selftest1 = false;
245
-    bluecell_Currdatastatus.Selftest2 = false;
246
-    bluecell_Currdatastatus.Selftest3 = false;
247
-    bluecell_Currdatastatus.Selftest4 = false;    
244
+    if(bluecell_Currdatastatus.SelfTest == true){
245
+        bluecell_Currdatastatus.ATT_DL1_H = bluecell_Currdatastatus.SelfTest_ATT_DL1_H ;
246
+        bluecell_Currdatastatus.ATT_DL2_H = bluecell_Currdatastatus.SelfTest_ATT_DL2_H ;
247
+        bluecell_Currdatastatus.ATT_DL3_H = bluecell_Currdatastatus.SelfTest_ATT_DL3_H ;
248
+        bluecell_Currdatastatus.ATT_DL4_H = bluecell_Currdatastatus.SelfTest_ATT_DL4_H ;
249
+        
250
+        bluecell_Currdatastatus.ATT_DL1_L = bluecell_Currdatastatus.SelfTest_ATT_DL1_L ;
251
+        bluecell_Currdatastatus.ATT_DL2_L = bluecell_Currdatastatus.SelfTest_ATT_DL2_L ;
252
+        bluecell_Currdatastatus.ATT_DL3_L = bluecell_Currdatastatus.SelfTest_ATT_DL3_L ;
253
+        bluecell_Currdatastatus.ATT_DL4_L = bluecell_Currdatastatus.SelfTest_ATT_DL4_L ;                    
254
+        
255
+        bluecell_Currdatastatus.ATT_UL1_H = bluecell_Currdatastatus.SelfTest_ATT_UL1_H ;
256
+        bluecell_Currdatastatus.ATT_UL2_H = bluecell_Currdatastatus.SelfTest_ATT_UL2_H ;
257
+        bluecell_Currdatastatus.ATT_UL3_H = bluecell_Currdatastatus.SelfTest_ATT_UL3_H ;
258
+        bluecell_Currdatastatus.ATT_UL4_H = bluecell_Currdatastatus.SelfTest_ATT_UL4_H ;
259
+        
260
+        bluecell_Currdatastatus.ATT_UL1_L = bluecell_Currdatastatus.SelfTest_ATT_UL1_L ;
261
+        bluecell_Currdatastatus.ATT_UL2_L = bluecell_Currdatastatus.SelfTest_ATT_UL2_L ;
262
+        bluecell_Currdatastatus.ATT_UL3_L = bluecell_Currdatastatus.SelfTest_ATT_UL3_L ;
263
+        bluecell_Currdatastatus.ATT_UL4_L = bluecell_Currdatastatus.SelfTest_ATT_UL4_L ;                    
264
+    }
265
+    bluecell_Currdatastatus.SelfTest = false;
266
+printf("bluecell_Currdatastatus.DLI_Level_High_Threshold_H : %x \r\n",bluecell_Currdatastatus.DLI_Level_High_Threshold_H);
267
+printf("bluecell_Currdatastatus.DLI_Level_High_Threshold_L : %x \r\n",bluecell_Currdatastatus.DLI_Level_High_Threshold_L);
248 268
 //    bluecell_Currdatastatus.DLI_FRBT_Status = 7;
249 269
     bluecell_Currdatastatus.ALARM_TESTMODE = 0;
250 270
     bluecell_Currdatastatus.Type = 0;

+ 6 - 8
Src/main.c

@@ -124,7 +124,7 @@ volatile uint32_t Alarm_DL_Level_TimerOnCnt = 0;
124 124
 volatile uint32_t Alarm_UL_Level_TimerOffCnt = 0;
125 125
 volatile uint32_t Alarm_UL_Level_TimerOnCnt = 0;
126 126
 
127
-volatile uint32_t SelfTestLifeCnt[4] = {0,};
127
+volatile uint32_t SelfTestLifeCnt = 0;
128 128
 
129 129
 volatile uint32_t ADC_100ms_Cnt = 0;
130 130
 
@@ -942,11 +942,12 @@ void UL_Shutdown_Timer(uint8_t Table_num){
942 942
           }
943 943
   }
944 944
 }
945
-void UL_SelfTestTimer(uint8_t Table_Num,uint8_t* selftest_status){
945
+void UL_SelfTestTimer(uint8_t* selftest_status){
946 946
     if((*selftest_status) == true){
947
-        SelfTestLifeCnt[Table_Num]++;
947
+        SelfTestLifeCnt++;
948
+//        printf("selftest_status : %d SelfTestLifeCnt , :%d\r\n",(*selftest_status),SelfTestLifeCnt);
948 949
     }else{
949
-        SelfTestLifeCnt[Table_Num] = 0;
950
+        SelfTestLifeCnt = 0;
950 951
     }
951 952
 
952 953
 }
@@ -997,10 +998,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
997 998
     DL_Shutdown_Timer(DET_Alarm_DL4_Shutdown_Index);
998 999
 
999 1000
 
1000
-    UL_SelfTestTimer(0,&bluecell_Currdatastatus.Selftest1);
1001
-    UL_SelfTestTimer(1,&bluecell_Currdatastatus.Selftest2);
1002
-    UL_SelfTestTimer(2,&bluecell_Currdatastatus.Selftest3);
1003
-    UL_SelfTestTimer(3,&bluecell_Currdatastatus.Selftest4);    
1001
+    UL_SelfTestTimer(&bluecell_Currdatastatus.SelfTest);
1004 1002
         
1005 1003
     
1006 1004
       /*ALC Alarm timer start*/