// send data: ID = 0x100, Standard CAN Frame, Data length = 8 bytes, 'data' = array of data bytes to send //byte sndStat = CAN0.sendMsgBuf(0x100, 0, 8, data); Serial.println("For tesing init remote ports"); for (auto element: _Slave_Ports) { Serial.print(" Prot:"); Serial.print(element._Protocol); Serial.print(" , ID:"); Serial.print(element._Slave_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") { // if(element.PortTypes == 0x80) { Serial.println(" Prepared data"); #if defined(HAS_LCD1602) delay(LCDtim); String LCDarray1 = "P["; LCDarray1.concat(element._Protocol); LCDarray1.concat("] ID["); LCDarray1.concat(String(element._Slave_ID, HEX)); LCDarray1.concat("] T["); LCDarray1.concat(String(element.PortTypes, HEX)); LCDarray1.concat(" "); //1234567890ABCDEFGHIJKLMNOPQRTSWabcdefghijklmnopqrstwquwz // 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, element.LocalPort, element.PortTypes, element.LocalPort, element.Exp_state, element.Exp_state_ttl, 0x06, 0x07}; // } byte sndStat = CAN0.sendMsgBuf(element._Slave_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) /* Serial.print("_LCD_print_queue.push: " ); Serial.print(_LCD_print_queue.back()); Serial.println(" + 1 " ); lcd.clear(); lcd.setCursor(0,0); lcd.print("Q:"); lcd.print(_LCD_print_queue.back()); lcd.print(" + 1, PQ:" ); lcd.print( _LCD_print_queue.peek()); _LCD_print_queue.push(_LCD_print_queue.peek() + 1); LCD_print_background_screen_add( _LCD_print_screens, _LCD_print_queue.peek() ,time, time + 1000, LCDarray1a, LCDarray2buf ); lcd.setCursor(0,1); lcd.print("Q:"); lcd.print(_LCD_print_queue.back()); lcd.print(" Fr:"); lcd.print( _LCD_print_queue.front()); lcd.print(" PQ:" ); lcd.print( _LCD_print_queue.peek()); delay(LCDtim * 10); //EOF QUEUE */ 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.setCursor(0,60); display.print(LCDarray1); display.print(" "); display.print(LCDarray2); #endif delay(5000); // send data per 100ms } // byte sndStat = CAN0.sendMsgBuf(_Slave1_ID, 0, 8, data);