|
|
@@ -82,7 +82,7 @@
|
|
|
CAN_broadcast_A.Exp_state_ttl = Slave_Ports_Status_A[i].Exp_state_ttl ;
|
|
|
CAN_broadcast_A.Broadcast_state = Slave_Ports_Status_A[i].Broadcast_state ;
|
|
|
|
|
|
- // CAN_broadcast_A._CAN_8 = _CAN_8_EMPTY ;
|
|
|
+ // CAN_broadcast_A._CAN_8 = _CAN_8_EMPTY ;
|
|
|
|
|
|
String message = "CAN BCAST "; message.concat(i); message.concat("."); message.concat(Slave_Ports_Status_A[i].Port_ID); message.concat(" >>>");
|
|
|
|
|
|
@@ -113,9 +113,7 @@
|
|
|
// byte sndStat = CAN0.sendMsgBuf(Slave_Ports_Status_A[i].Port_ID, 0, 8, data);
|
|
|
//byte CAN_broadcast_A8[8];
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
byte CAN_MSG8_A[8];
|
|
|
CAN_MSG8_A_ptr(CAN_broadcast_A,CAN_MSG8_A);
|
|
|
|
|
|
@@ -152,13 +150,22 @@
|
|
|
);
|
|
|
|
|
|
#ifdef DEBUG_CAN
|
|
|
- Serial.println("#155 after CAN_SEND update [Broadcast_state_FULL_FRESH] [Exp_state_ttl_IS_ACTIVE] ");
|
|
|
+ Serial.print("#155 after CAN_SEND update [Broadcast_state_FULL_FRESH] for i[");
|
|
|
+ Serial.print(i); Serial.println("] ");
|
|
|
+ Serial.print("#154 before Exp_state_ttl[");
|
|
|
+ Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Exp_state_ttl)); Serial.print("] Broadcast_state[");
|
|
|
+ Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Broadcast_state)); Serial.println("] ");
|
|
|
#endif
|
|
|
- // + Broadcast_state_FULL_FRESH
|
|
|
- //+Exp_state_ttl_IS_ACTIVE
|
|
|
-
|
|
|
- Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
- Slave_Ports_Status_A[i].Broadcast_state = Broadcast_state_FULL_FRESH ;
|
|
|
+
|
|
|
+ // Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
+ Slave_Ports_Status_A[i].Broadcast_state = Broadcast_state_FULL_FRESH ;
|
|
|
+ #ifdef DEBUG_CAN
|
|
|
+ Serial.print("#164 after Exp_state_ttl[");
|
|
|
+ Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Exp_state_ttl)); Serial.print("] Broadcast_state[");
|
|
|
+ Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Broadcast_state)); Serial.println("] ");
|
|
|
+
|
|
|
+ #endif
|
|
|
+
|
|
|
|
|
|
|
|
|
} else {
|
|
|
@@ -205,7 +212,7 @@
|
|
|
|
|
|
// delay(5000); // send data per 100ms
|
|
|
} else {
|
|
|
- #if defined(DEBUG)
|
|
|
+ #ifdef DEBUG || DEBUG_CAN
|
|
|
if(DEBUG > 4) {
|
|
|
Serial.print("#147 BCAST NOT SENT ind:"); Serial.print(i); Serial.print("] IS_Local_A:");
|
|
|
Serial.print(Slave_Ports_Status_A[i].IS_Local_A);
|
|
|
@@ -217,7 +224,7 @@
|
|
|
Serial.print(" , Exp_state_ttl"); Serial.println(Slave_Ports_Status_A[i].Exp_state_ttl);
|
|
|
Serial.print("#2111 *_TEST_GLOBAL"); Serial.print(*_TEST_GLOBAL); Serial.println("]");
|
|
|
}
|
|
|
- #endif
|
|
|
+ #endif
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -233,73 +240,5 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
- /*
|
|
|
- for (auto element: Slave_Ports_Status_A) {
|
|
|
- ind++;
|
|
|
- Serial.print(" ind:"); Serial.print(ind); Serial.print("] Prot:"); Serial.print(element._Protocol); Serial.print(" , ID:"); Serial.print(element.Port_ID); Serial.print(" , PortTypes:");
|
|
|
- Serial.print(element.PortTypes); Serial.print(" , Addr:"); Serial.print(element.Address);
|
|
|
- Serial.print(" , Local:"); Serial.print(element.LocalPort);
|
|
|
- Serial.print(" , Exp state:"); Serial.print(element.Exp_state);
|
|
|
- Serial.print(" , Exp_state_ttl"); Serial.println(element.Exp_state_ttl);
|
|
|
- if(element._Protocol == "CAN") {
|
|
|
- Serial.println(" Prepared data");
|
|
|
- #if defined(HAS_LCD1602)
|
|
|
-
|
|
|
- String LCDarray1 = "P[";
|
|
|
- LCDarray1.concat(element._Protocol); LCDarray1.concat("] ID["); LCDarray1.concat(String(element.Port_ID, HEX)); LCDarray1.concat("] T["); LCDarray1.concat(String(element.PortTypes, HEX));
|
|
|
- // lcd.print(LCDarray1);
|
|
|
- String LCDarray2 = " >"; LCDarray2.concat(String(element.Address, HEX)); LCDarray2.concat( "< {"); LCDarray2.concat( String(element.LocalPort, HEX)); LCDarray2.concat( "} =[" ); LCDarray2.concat(String(element.Exp_state, HEX) ); LCDarray2.concat("] ?[" ) ;
|
|
|
- LCDarray2.concat(String(element.Exp_state_ttl, HEX)) ; LCDarray2.concat("]") ;
|
|
|
- LCD_print(LCDarray1, LCDarray2, LCDtim / 2 ) ;
|
|
|
- #endif
|
|
|
- byte data[8] = {element.Address, 0x04, element.LocalPort, element.PortTypes, element.LocalPort, element.Exp_state, element.Exp_state_ttl, 0x07};
|
|
|
- // }
|
|
|
- byte sndStat = CAN0.sendMsgBuf(element.Port_ID, 0, 8, data);
|
|
|
-
|
|
|
- if(sndStat == CAN_OK){
|
|
|
- Serial.println("Message Sent Successfully!");
|
|
|
- String LCDarray1 = "Message Sent";
|
|
|
- String LCDarray2 = "Successfully";
|
|
|
- } else {
|
|
|
- Serial.println("Error Sending Message...");
|
|
|
- String LCDarray1 = "Error Sending";
|
|
|
- String LCDarray2 = "Message...";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- #if defined(HAS_LCD1602)
|
|
|
-
|
|
|
-
|
|
|
- delay(LCDtim * 5);
|
|
|
- //lcd.setCursor(0,1);
|
|
|
- lcd.print(lcdPattern);
|
|
|
- //lcd.print(lcdPos % 10);
|
|
|
- if(lcdPos >= 16) {
|
|
|
- //lcd.print("N");
|
|
|
- lcd.setCursor(0,1);
|
|
|
- lcdPos = 0;
|
|
|
- if(lcdPattern=="s") lcdPattern = "S" ;
|
|
|
- else lcdPattern = "s" ;
|
|
|
- }
|
|
|
- lcdPos ++;
|
|
|
- #endif
|
|
|
- #if defined(HAS_TFT_ILI9163C)
|
|
|
- delay(LCDtim);
|
|
|
- DISPLAY_DEV.setCursor(0,60);
|
|
|
- DISPLAY_DEV.print(LCDarray1); DISPLAY_DEV.print(" "); DISPLAY_DEV.print(LCDarray2);
|
|
|
- #endif
|
|
|
- delay(5000); // send data per 100ms
|
|
|
-
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // byte sndStat = CAN0.sendMsgBuf(_Slave1_ID, 0, 8, data);
|
|
|
-
|
|
|
-
|
|
|
} //EOF _Slave_Ports_broadcast_POP
|
|
|
|