浏览代码

주석추가 / 알람 리포트 Length 오류 수정

PYJ 4 年之前
父节点
当前提交
559a5daf25
共有 2 个文件被更改,包括 17 次插入12 次删除
  1. 16 11
      Bluecell_Src/Bluecell_operate.c
  2. 1 1
      Src/main.c

+ 16 - 11
Bluecell_Src/Bluecell_operate.c

@@ -4998,12 +4998,13 @@ void Temp_Shutdown_ONOFF(uint8_t val){
4998 4998
 
4999 4999
 #define OVERPOWER_STR "Overpower"
5000 5000
 #define OVER_INPUT_STR "Over-Input"
5001
+#define ALARM_REPORT_LENGTH 42
5001 5002
 //uint8_t AlarmReport_History[Alarm_type_IndexMax] = {0,};
5003
+volatile uint8_t Alarm_ReportData[40 + 2 + 22 + 3] = {0,}; // 40 Alarm Data + 2 UNIT ID, 21 Header , 3 Tail
5002 5004
 uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
5003 5005
 //    if(AlarmReport_History[Alarm_type] != true){
5004 5006
 //        return;
5005 5007
 //    }
5006
-    static uint8_t Alarm_ReportData[40 + 2 + 21 + 3] = {0,}; // 40 Alarm Data + 2 UNIT ID, 21 Header , 3 Tail
5007 5008
     uint8_t index = 0;
5008 5009
     Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0x00;       //UNIT ID0
5009 5010
     Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0xF1;       //UNIT ID1
@@ -5029,7 +5030,7 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
5029 5030
     Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;//Alarm SeqNum1 RF Board Default 0   
5030 5031
 
5031 5032
     // 0~ 19 
5032
-    for(int i = MBIC_PAYLOADSTART + 22; i < MBIC_PAYLOADSTART + 42; i++)
5033
+    for(int i = MBIC_PAYLOADSTART + 22; i < MBIC_PAYLOADSTART + ALARM_REPORT_LENGTH; i++)
5033 5034
         Alarm_ReportData[i] = 0;
5034 5035
     
5035 5036
 
@@ -5152,8 +5153,8 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
5152 5153
 //    Alarm_ReportData[MBIC_PAYLOADSTART + 2] = val;        
5153 5154
     
5154 5155
     printf("%s \r\n",&Alarm_ReportData[MBIC_PAYLOADSTART + 22]);
5155
-    printf("Type : %x  size length : %d \r\n",Alarm_type,sizeof(Alarm_ReportData));
5156
-//    MBIC_HeaderMergeFunction(Alarm_ReportData,42);
5156
+//    printf("Type : %x  size length : %d \r\n",Alarm_type,sizeof(Alarm_ReportData));
5157
+//    MBIC_HeaderMergeFunction(Alarm_ReportData,ALARM_REPORT_LENGTH);
5157 5158
     Alarm_ReportData[MBIC_PREAMBLE_0] = MBIC_PREAMBLE0;
5158 5159
     Alarm_ReportData[MBIC_PREAMBLE_1] = MBIC_PREAMBLE1;
5159 5160
     Alarm_ReportData[MBIC_PREAMBLE_2] = MBIC_PREAMBLE2;
@@ -5184,19 +5185,23 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
5184 5185
 
5185 5186
 
5186 5187
 
5187
-    Alarm_ReportData[MBIC_LENGTH_0] = (sizeof(Alarm_ReportData) & 0xFF00) >> 8;
5188
-    Alarm_ReportData[MBIC_LENGTH_1] = sizeof(Alarm_ReportData) & 0x00FF;
5188
+    Alarm_ReportData[MBIC_LENGTH_0] = (ALARM_REPORT_LENGTH & 0xFF00) >> 8;
5189
+    Alarm_ReportData[MBIC_LENGTH_1] = ALARM_REPORT_LENGTH & 0x00FF;
5189 5190
 
5190 5191
     Alarm_ReportData[MBIC_HEADERCHECKSUM_0] = Chksum_Create(Alarm_ReportData);    
5191 5192
 
5192 5193
     
5193
-    uint16_t crcret = ((CRC16_Generate(&Alarm_ReportData[MBIC_PAYLOADSTART], 42) ) );
5194
+    uint16_t crcret =CRC16_Generate(&Alarm_ReportData[MBIC_PAYLOADSTART], ALARM_REPORT_LENGTH);
5194 5195
     
5195 5196
 //                        printf("\r\n crc ret : %x \r\n",crcret);
5196
-    Alarm_ReportData[MBIC_PAYLOADSTART + 41] =(( crcret  & 0xFF00)>> 8);  
5197
-    Alarm_ReportData[MBIC_PAYLOADSTART + 42] = (( crcret  & 0x00FF));  
5198
-    Alarm_ReportData[MBIC_PAYLOADSTART + 43] = 0x03; 
5199
-    Uart1_Data_Send(Alarm_ReportData,sizeof(Alarm_ReportData));
5197
+    Alarm_ReportData[MBIC_PAYLOADSTART + 42] =(( crcret  & 0xFF00)>> 8);  
5198
+//        printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 41] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 41]);
5199
+    Alarm_ReportData[MBIC_PAYLOADSTART + 43] = (( crcret  & 0x00FF));  
5200
+//        printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 42] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 42]);    
5201
+    Alarm_ReportData[MBIC_PAYLOADSTART + 44] = 0x03; 
5202
+//        printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 43] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 43]);    
5203
+    Uart1_Data_Send(&Alarm_ReportData[0],sizeof(Alarm_ReportData));
5204
+            printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 42] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 42]);
5200 5205
 }
5201 5206
 
5202 5207
 bool MBIC_Operate(uint8_t* data){

+ 1 - 1
Src/main.c

@@ -330,7 +330,7 @@ int main(void)
330 330
   Booting_LedInit();
331 331
   InitUartQueue(&TerminalQueue);
332 332
   bluecell_Currdatastatus.LED_TEST = true;
333
-  Led_ToggleCntSet = 6;
333
+  Led_ToggleCntSet = 6; // Booting Led 3Cnt  ,Led Test 10Cnt
334 334
 
335 335
 
336 336
 #if 1 // PYJ.2020.05.06_BEGIN --