|
|
@ -10,49 +10,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
String IdeSerial; // for 485_0
|
|
|
|
String IdeSerial; // for 485_0
|
|
|
|
|
|
|
|
|
|
|
|
HardwareSerial* Serials[] = {&Serial1, &Serial2};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int BUFF_SIZE = 512;
|
|
|
|
|
|
|
|
char Buff_Eth_Rd[BUFF_SIZE] = {0};
|
|
|
|
|
|
|
|
char Buff_485_1_Wr[BUFF_SIZE] = {0};
|
|
|
|
|
|
|
|
char Buff_485_1_Rd[BUFF_SIZE] = {0};
|
|
|
|
|
|
|
|
char Buff_485_2_Wr[BUFF_SIZE] = {0};
|
|
|
|
|
|
|
|
char Buff_485_2_Rd[BUFF_SIZE] = {0};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String latest_sent_msg;
|
|
|
|
|
|
|
|
int numOf485 = 0;
|
|
|
|
|
|
|
|
int returnTime = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------- 485
|
|
|
|
|
|
|
|
bool Wait_485_1;
|
|
|
|
|
|
|
|
int Wait_485_1_cnt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int RS485_1_Addr[2] = {0,0};
|
|
|
|
|
|
|
|
bool RS485_1_Rcv_PV[2] = {false, false};
|
|
|
|
|
|
|
|
bool RS485_1_Rcv_SV[2] = {false, false};
|
|
|
|
|
|
|
|
int RS485_1_Rcv_size = 8;
|
|
|
|
|
|
|
|
int RS485_1_Values_PV[8*2];
|
|
|
|
|
|
|
|
int RS485_1_Values_SV[8*2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Wait_485_2;
|
|
|
|
|
|
|
|
int Wait_485_2_cnt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int RS485_2_Addr[2];
|
|
|
|
|
|
|
|
bool RS485_2_Rcv_PV[2];
|
|
|
|
|
|
|
|
bool RS485_2_Rcv_SV[2];
|
|
|
|
|
|
|
|
int RS485_2_Rcv_size = 8;
|
|
|
|
|
|
|
|
int RS485_2_Values_PV[8*2];
|
|
|
|
|
|
|
|
int RS485_2_Values_SV[8*2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bool rcv_10_PV = true;
|
|
|
|
|
|
|
|
//int Size_PV = 8;
|
|
|
|
|
|
|
|
//int Values_10_PV[8];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bool rcv_10_SV = true;
|
|
|
|
|
|
|
|
//int Size_SV = 8;
|
|
|
|
|
|
|
|
//int Values_10_SV[8];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
void setup() {
|
|
|
|
// put your setup code here, to run once:
|
|
|
|
// put your setup code here, to run once:
|
|
|
|
Serial.begin(9600);
|
|
|
|
Serial.begin(9600);
|
|
|
@ -111,6 +68,7 @@ void loop() {
|
|
|
|
// If data read
|
|
|
|
// If data read
|
|
|
|
if(message != ""){
|
|
|
|
if(message != ""){
|
|
|
|
cmd = demuxCMD(message, &cmdData);
|
|
|
|
cmd = demuxCMD(message, &cmdData);
|
|
|
|
|
|
|
|
//Serial.println(">> " + message);
|
|
|
|
message = "";
|
|
|
|
message = "";
|
|
|
|
|
|
|
|
|
|
|
|
//Serial.println(cmd);
|
|
|
|
//Serial.println(cmd);
|
|
|
|