Selaa lähdekoodia

Data 동시 설정 시 Length 덮어 쓰는 문제 수정 / 알람마스크 수정

PYJ 4 vuotta sitten
vanhempi
commit
0955f2f6d2
2 muutettua tiedostoa jossa 30 lisäystä ja 18 poistoa
  1. 29 17
      Bluecell_Src/Bluecell_operate.c
  2. 1 1
      Bluecell_Src/uart.c

+ 29 - 17
Bluecell_Src/Bluecell_operate.c

@@ -2566,7 +2566,7 @@ bool Bluecell_Operate(uint8_t* data){
2566 2566
 //        Txdata[sizeof(BLUESTATUS_st) - 2] = STH30_CreateCrc(&Txdata[BLUECELL_TYPE], sizeof(BLUESTATUS_st) - 3);
2567 2567
 //        Uart1_Data_Send(&Txdata[0], sizeof(BLUESTATUS_st));        
2568 2568
         EEPROM_M24C08_Zerowrite(EEPROM_M24C08_ID ,(EEPROM_ATT_BASE));
2569
-//        printf("ZERO WRITE COMPLETE");
2569
+        printf("ZERO WRITE COMPLETE\r\n Reset Start \r\n");
2570 2570
 
2571 2571
          NVIC_SystemReset();
2572 2572
 
@@ -3253,11 +3253,11 @@ uint32_t MBIC_DataSend(uint8_t* data){
3253 3253
     data[MBIC_PAYLOADSTART + i++] = 10; // LENGTH
3254 3254
     
3255 3255
 
3256
-    data[MBIC_PAYLOADSTART + i++] = 0x80;
3257
-    data[MBIC_PAYLOADSTART + i++] = 0xFF;
3258
-    data[MBIC_PAYLOADSTART + i++] = 0xFF;
3259
-    data[MBIC_PAYLOADSTART + i++] = 0x0F;
3260
-    data[MBIC_PAYLOADSTART + i++] = 0xFF;
3256
+    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK1;
3257
+    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK2;
3258
+    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK3;
3259
+    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK4;
3260
+    data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK5;
3261 3261
     if(bluecell_Currdatastatus.SelfTest == true){
3262 3262
         data[MBIC_PAYLOADSTART + i++] = 0;
3263 3263
         data[MBIC_PAYLOADSTART + i++] = 0;
@@ -4817,7 +4817,8 @@ void Carrier_ONOFF(uint8_t val){
4817 4817
 
4818 4818
 //        HAL_Delay(10);
4819 4819
         CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
4820
-    }else{
4820
+    }
4821
+    else{
4821 4822
         bluecell_Currdatastatus.ATT_DL1_PATH = false;    
4822 4823
         bluecell_Currdatastatus.ATT_DL2_PATH = false;    
4823 4824
         bluecell_Currdatastatus.ATT_DL3_PATH = false;    
@@ -5396,10 +5397,20 @@ bool MBIC_Operate(uint8_t* data){
5396 5397
 //                printf("bluecell_Currdatastatus.ALARM_MASK5 : %x \r\n",data[MBIC_PAYLOADSTART + 7]);                                
5397 5398
                 break;
5398 5399
             case  Alarm_Test_Mode                         :
5399
-//                printf("bluecell_Currdatastatus.ALsARM_TESTMODE : %d \r\n",bluecell_Currdatastatus.ALARM_TESTMODE);
5400 5400
                 bluecell_Currdatastatus.ALARM_TESTMODE = data[MBIC_PAYLOADSTART + 3]; 
5401
-//                printf("data[MBIC_PAYLOADSTART + 3];  : %d \r\n",data[MBIC_PAYLOADSTART + 3]);
5402
-//                printf("bluecell_Currdatastatus.ALARM_TESTMODE : %d \r\n",bluecell_Currdatastatus.ALARM_TESTMODE);
5401
+//                printf("Alarm Test mode Data : ");
5402
+//                for(int i = 0 ; i < 8 ; i++){
5403
+//                    printf("%x ",data[MBIC_PAYLOADSTART + 3 + i]);
5404
+//                }
5405
+//                printf("\r\n");
5406
+                if(bluecell_Currdatastatus.ALARM_TESTMODE == false){
5407
+                    bluecell_Currdatastatus.ALARM_Test_Dummy1 = 0;
5408
+                    bluecell_Currdatastatus.ALARM_Test_Dummy2 = 0;
5409
+                    bluecell_Currdatastatus.ALARM_Test_Dummy3 = 0;
5410
+                    bluecell_Currdatastatus.ALARM_Test_Dummy4 = 0;
5411
+                    bluecell_Currdatastatus.ALARM_Test_Dummy5 = 0;
5412
+                }
5413
+//                printf("Alarm Test Mode start");
5403 5414
                 break;
5404 5415
             case  Alarm_Test_Dummy                        :
5405 5416
                 bluecell_Currdatastatus.ALARM_Test_Dummy1 = data[MBIC_PAYLOADSTART + 3]; 
@@ -5426,14 +5437,14 @@ bool MBIC_Operate(uint8_t* data){
5426 5437
                 Bluecell_StructCpy(&DataWrite[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
5427 5438
                 EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&DataWrite[0],sizeof(BLUESTATUS_st));
5428 5439
                 EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_WINDOW_STATUS_ADDRESDS,&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st) );
5429
-//                printf("bluecell_Currdatastatus.CPU_Bank_Select : %d \r\n",bluecell_Currdatastatus.CPU_Bank_Select);
5430
-//                printf("I will Booting Bank : %d \r\n",bluecell_Currdatastatus.CPU_Current_Bank);
5431
-//                printf("Reset : \r\n");
5440
+                printf("bluecell_Currdatastatus.CPU_Bank_Select : %d \r\n",bluecell_Currdatastatus.CPU_Bank_Select);
5441
+                printf("I will Booting Bank : %d \r\n",bluecell_Currdatastatus.CPU_Current_Bank);
5442
+                printf("Reset : \r\n");
5432 5443
                 NVIC_SystemReset();
5433 5444
                 break;
5434 5445
             case  SW_Reset                                :
5435 5446
 //                Table_LengSet();
5436
-//                printf("SoftWare Reset Start \r\n");
5447
+                printf("MBIC SoftWare Reset Start \r\n");
5437 5448
                 bluecell_Currdatastatus.S_W_Reset = data[MBIC_PAYLOADSTART + 3]; 
5438 5449
                 NVIC_SystemReset();
5439 5450
                 break;
@@ -5983,10 +5994,11 @@ bool MBIC_Operate(uint8_t* data){
5983 5994
                 CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
5984 5995
                 break;
5985 5996
         }
5986
-        if(data[MBIC_PAYLOADSTART + data[MBIC_PAYLOADSTART + 2] + 3 ] == 0xE0 && occurlen > 0){
5987
-            occurlen -= data[MBIC_PAYLOADSTART + 2] + 3;
5997
+        uint8_t tmpLength = data[MBIC_PAYLOADSTART + 2];
5998
+        if(data[MBIC_PAYLOADSTART + tmpLength + 3 ] == 0xE0 && occurlen > 0){
5999
+            occurlen -= tmpLength + 3;
5988 6000
             for(int k = 0; k < occurlen; k++){
5989
-                data[MBIC_PAYLOADSTART + k] = data[MBIC_PAYLOADSTART + data[MBIC_PAYLOADSTART + 2] + 3 + k];
6001
+                data[MBIC_PAYLOADSTART + k] = data[MBIC_PAYLOADSTART + tmpLength+ 3 + k];
5990 6002
             }
5991 6003
             goto protocolReplay;
5992 6004
         }

+ 1 - 1
Bluecell_Src/uart.c

@@ -168,7 +168,7 @@ void Uart1_Data_Send(uint8_t* data,uint16_t size){
168 168
   //HAL_UART_Transmit_IT(&hTerminal, &data[0],size);
169 169
 //    printf("data[278] : %x \r\n",data[278]);
170 170
 ////    HAL_Delay(1);   
171
-#if 0 // PYJ.2020.07.19_BEGIN -- 
171
+#if 0 // PYJ.2020.07.19_BEGIN --
172 172
     printf("\r\n [TX] : ");
173 173
     for(int i = 0; i< size; i++)
174 174
         printf("%02x ",data[i]);