a.binder 5 năm trước cách đây
mục cha
commit
02229c6b57

+ 30 - 24
SE/stuff/P5_Automation_can-dev-res/_CAN/_CAN_func.h

@@ -22,14 +22,14 @@ void CAN_READ(
                    //     DISPLAY__print_loop(DISPLAY_CURSOR_Y_CHARS_CAN_DEBUG, "CAN RECV DATA", 13, DISPLAY__print_loop_ACTION_ADD ) ;
                         _CAN_REMOTE_ID_T _CAN_REMOTE_ID = CANrxId ;
                                              
-                         CAN_MSG8_BIT_1_T CAN_MSG8_BIT_1_A = int(CANrxBuf[0] , HEX) ;//< 0x10
-                         CAN_MSG8_BIT_2_T CAN_MSG8_BIT_2_A = int(CANrxBuf[1] , HEX) ;
-                         CAN_MSG8_BIT_3_T CAN_MSG8_BIT_3_A = int(CANrxBuf[2] , HEX) ;
-                         CAN_MSG8_BIT_4_T CAN_MSG8_BIT_4_A = int(CANrxBuf[3] , HEX) ;
-                         CAN_MSG8_BIT_5_T CAN_MSG8_BIT_5_A = int(CANrxBuf[4] , HEX) ;
-                         CAN_MSG8_BIT_6_T CAN_MSG8_BIT_6_A = int(CANrxBuf[5] , HEX) ;
-                         CAN_MSG8_BIT_7_T CAN_MSG8_BIT_7_A = int(CANrxBuf[6] , HEX) ;
-                         CAN_MSG8_BIT_8_T CAN_MSG8_BIT_8_A = int(CANrxBuf[7] , HEX) ;
+                         CAN_MSG8_BIT_1_T CAN_MSG8_BIT_1_A = CANrxBuf[0] ;//< 0x10
+                         CAN_MSG8_BIT_2_T CAN_MSG8_BIT_2_A = CANrxBuf[1] ;
+                         CAN_MSG8_BIT_3_T CAN_MSG8_BIT_3_A = CANrxBuf[2] ;
+                         CAN_MSG8_BIT_4_T CAN_MSG8_BIT_4_A = CANrxBuf[3] ;
+                         CAN_MSG8_BIT_5_T CAN_MSG8_BIT_5_A = CANrxBuf[4] ;
+                         CAN_MSG8_BIT_6_T CAN_MSG8_BIT_6_A = CANrxBuf[5] ;
+                         CAN_MSG8_BIT_7_T CAN_MSG8_BIT_7_A = CANrxBuf[6] ;
+                         CAN_MSG8_BIT_8_T CAN_MSG8_BIT_8_A = CANrxBuf[7] ;
                          
                    
                   // Serial.print();
@@ -43,7 +43,21 @@ void CAN_READ(
                    Serial.print(", BcSt.7:");Serial.print(CAN_MSG8_BIT_7_A, HEX);
                    Serial.print(", TaskT?.8:");Serial.print(CAN_MSG8_BIT_8_A, HEX);Serial.println(" ] ");
                    
-                    
+                   
+                    Serial.println("64[ Debug STD]")   ;                             
+                                   for(int i = 0; i<CANlen; i++)           // Print each byte of the data
+                                    {
+                                     Serial.print("[");Serial.print(i);Serial.print("]");
+                                      if(CANrxBuf[i] < 0x10)                // If data byte is less than 0x10, add a leading zero
+                                      {
+                                        Serial.print("0");
+                                 
+                                      }
+                                      Serial.print(CANrxBuf[i], HEX);
+                                      Serial.print(" ");
+                         }
+                   
+                    if(CAN_MSG8_BIT_8_A == TASK_TYPE_T_Slave_Ports_broadcast____) {
                                 Slave_Ports_Status_add_port(
                                                                Slave_Ports_Status_A ,
                                                                Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
@@ -62,21 +76,13 @@ void CAN_READ(
                                                                0 ,//int I2C_driver
                                                                IS_Local_FALSE 
                                                                );
-                                Serial.println("64[ Debug STD]")   ;                             
-                 
-                        for(int i = 0; i<CANlen; i++)           // Print each byte of the data
-                         {
-                          Serial.print("[");Serial.print(i);Serial.print("]");
-                           if(CANrxBuf[i] < 0x10)                // If data byte is less than 0x10, add a leading zero
-                           {
-                             Serial.print("0");
-                      
-                           }
-                           Serial.print(CANrxBuf[i], HEX);
-                           Serial.print(" ");
-                       
-                            
-                         }
+                        } else {
+                        
+                            Serial.println("81[CAN][RECV][UNKNOWN][CAN_MSG8_BIT_8_A][")   ;
+                            Serial.print(CAN_MSG8_BIT_8_A, HEX) ;
+                            Serial.print("] ");   
+                        }
+                               
                 
               } else { //if(CANlen == CAN_MSG_DATA8_LEN) 
               

+ 1 - 1
SE/stuff/P5_Automation_can-dev-res/_CAN/_Slave_Ports_Protocol_CAN_struct.h

@@ -177,7 +177,7 @@ void CAN_MSG8_A_ptr(_Slave_Ports_Protocol_CAN_broadcast_T
 void CAN_data_debug(byte data[8]) {
     int i;
     Serial.print("#102 CAN_data_debug   [  ");
-    for(i=1; i<=8; i++) {
+    for(i=0; i<8; i++) {
         Serial.print(" "); Serial.print(i+1); Serial.print("["); Serial.print(data[i]); Serial.print("."); Serial.print(data[i], HEX); Serial.print("] "); 
     }
     Serial.println("   ");