|
|
@ -7,10 +7,15 @@ const int MC9_CH[] = {1000, 1008, 1016, 1024, 1100, 1108, 1116, 1124};
|
|
|
|
void setupMC9_1(int i, int data){
|
|
|
|
void setupMC9_1(int i, int data){
|
|
|
|
RS485_1_Addr[i] = data;
|
|
|
|
RS485_1_Addr[i] = data;
|
|
|
|
|
|
|
|
|
|
|
|
Serial.println("MC9 No."+ String(i) + " 's address set as " + String(data));
|
|
|
|
Serial.println("MC9_1 No."+ String(i) + " 's address set as " + String(data));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void setupMC9_2(int i, int data){
|
|
|
|
|
|
|
|
RS485_2_Addr[i] = data;
|
|
|
|
|
|
|
|
|
|
|
|
String msg_MC9_PV(int addr){
|
|
|
|
Serial.println("MC9_2 No."+ String(i) + " 's address set as " + String(data));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String msg_MC9_PV_read(int addr){
|
|
|
|
String message = "";
|
|
|
|
String message = "";
|
|
|
|
|
|
|
|
|
|
|
|
if(addr < 10){
|
|
|
|
if(addr < 10){
|
|
|
@ -24,7 +29,7 @@ String msg_MC9_PV(int addr){
|
|
|
|
return message;
|
|
|
|
return message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String msg_MC9_SV(int addr){
|
|
|
|
String msg_MC9_SV_read(int addr){
|
|
|
|
String message = "";
|
|
|
|
String message = "";
|
|
|
|
|
|
|
|
|
|
|
|
if(addr < 10){
|
|
|
|
if(addr < 10){
|
|
|
@ -38,10 +43,13 @@ String msg_MC9_SV(int addr){
|
|
|
|
return message;
|
|
|
|
return message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int msg_MC9_SV_set(unsigned int data[], int dataSize){
|
|
|
|
int msg_MC9_SV_set_1(unsigned int data[], int dataSize){
|
|
|
|
String message = "";
|
|
|
|
String message = "";
|
|
|
|
int lp0, lp1;
|
|
|
|
int lp0, lp1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(dataSize > 16){
|
|
|
|
|
|
|
|
dataSize = 16;
|
|
|
|
|
|
|
|
}
|
|
|
|
if(dataSize > 8){
|
|
|
|
if(dataSize > 8){
|
|
|
|
lp0 = 8;
|
|
|
|
lp0 = 8;
|
|
|
|
lp1 = dataSize;
|
|
|
|
lp1 = dataSize;
|
|
|
@ -91,13 +99,14 @@ int msg_MC9_SV_set(unsigned int data[], int dataSize){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
message += sumMC9(message);
|
|
|
|
message += sumMC9(message);
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
|
|
|
|
|
|
|
|
write_buff_first(Buff_485_1_Wr, message);
|
|
|
|
write_buff_first(Buff_485_1_Wr, message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int msg_MC9_AT_set(unsigned int data[], int dataSize){
|
|
|
|
int msg_MC9_AT_set_1(unsigned int data[], int dataSize){
|
|
|
|
String message = "";
|
|
|
|
String message = "";
|
|
|
|
bool at[16];
|
|
|
|
bool at[16];
|
|
|
|
|
|
|
|
|
|
|
@ -126,7 +135,6 @@ int msg_MC9_AT_set(unsigned int data[], int dataSize){
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
atFlag = "0000"; // Auto Tuen Off
|
|
|
|
atFlag = "0000"; // Auto Tuen Off
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message += "0302,"; // Ch No cmd.
|
|
|
|
message += "0302,"; // Ch No cmd.
|
|
|
|
message += "000" + String(i+1) + ","; // Ch No.
|
|
|
|
message += "000" + String(i+1) + ","; // Ch No.
|
|
|
|
message += "0501,"; // AT cmd.
|
|
|
|
message += "0501,"; // AT cmd.
|
|
|
@ -137,6 +145,7 @@ int msg_MC9_AT_set(unsigned int data[], int dataSize){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
message += sumMC9(message);
|
|
|
|
message += sumMC9(message);
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
|
|
|
|
|
|
|
|
write_buff_first(Buff_485_1_Wr, message);
|
|
|
|
write_buff_first(Buff_485_1_Wr, message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -167,11 +176,146 @@ int msg_MC9_AT_set(unsigned int data[], int dataSize){
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
write_buff_first(Buff_485_1_Wr, message);
|
|
|
|
write_buff_first(Buff_485_1_Wr, message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int msg_MC9_SV_set_2(unsigned int data[], int dataSize){
|
|
|
|
|
|
|
|
String message = "";
|
|
|
|
|
|
|
|
int lp0, lp1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(dataSize > 16){
|
|
|
|
|
|
|
|
dataSize = 16;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(dataSize > 8){
|
|
|
|
|
|
|
|
lp0 = 8;
|
|
|
|
|
|
|
|
lp1 = dataSize;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
lp0 = dataSize;
|
|
|
|
|
|
|
|
lp1 = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(RS485_2_Addr[0] != 0){
|
|
|
|
|
|
|
|
if(RS485_2_Addr[0] < 10){
|
|
|
|
|
|
|
|
message += "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message = String(RS485_2_Addr[0]);
|
|
|
|
|
|
|
|
message += "DWR,0" + String(lp0) + ",";
|
|
|
|
|
|
|
|
for(int i=0 ; i<lp0 ; i++){
|
|
|
|
|
|
|
|
char hexStr[5]; // Buffer to hold the hexadecimal string (4 characters + null terminator)
|
|
|
|
|
|
|
|
sprintf(hexStr, "%04X", data[i]); // Format as 4 digit uppercase hexadecimal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message += MC9_CH[i] + 1; // ZONE 1
|
|
|
|
|
|
|
|
message += ",";
|
|
|
|
|
|
|
|
message += String(hexStr);
|
|
|
|
|
|
|
|
if(i != (lp0-1)){
|
|
|
|
|
|
|
|
message += ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message += sumMC9(message);
|
|
|
|
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
|
|
|
|
write_buff_first(Buff_485_2_Wr, message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((RS485_2_Addr[1] != 0) && (lp1>0)){
|
|
|
|
|
|
|
|
if(RS485_2_Addr[1] < 10){
|
|
|
|
|
|
|
|
message += "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message = String(RS485_2_Addr[1]);
|
|
|
|
|
|
|
|
message += "DWR,0" + String(lp1-8) + ",";
|
|
|
|
|
|
|
|
for(int i=8 ; i<lp1 ; i++){
|
|
|
|
|
|
|
|
char hexStr[5]; // Buffer to hold the hexadecimal string (4 characters + null terminator)
|
|
|
|
|
|
|
|
sprintf(hexStr, "%04X", data[i]); // Format as 4 digit uppercase hexadecimal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message += MC9_CH[i%8] + 1; // ZONE 1
|
|
|
|
|
|
|
|
message += ",";
|
|
|
|
|
|
|
|
message += String(hexStr);
|
|
|
|
|
|
|
|
if(i != (lp1-1)){
|
|
|
|
|
|
|
|
message += ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message += sumMC9(message);
|
|
|
|
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
|
|
|
|
write_buff_first(Buff_485_2_Wr, message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int msg_MC9_AT_set_2(unsigned int data[], int dataSize){
|
|
|
|
|
|
|
|
String message = "";
|
|
|
|
|
|
|
|
bool at[16];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int lp0, lp1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Number to boolean array
|
|
|
|
|
|
|
|
unsigned int data0 = data[0];
|
|
|
|
|
|
|
|
for (int i = 0; i < 16; i++) {
|
|
|
|
|
|
|
|
at[i] = (bitRead(data0, i) ? HIGH : LOW);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lp0 = 8;
|
|
|
|
|
|
|
|
lp1 = 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message = "";
|
|
|
|
|
|
|
|
if(RS485_2_Addr[0] != 0){
|
|
|
|
|
|
|
|
if(RS485_2_Addr[0] < 10){
|
|
|
|
|
|
|
|
message += "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message += String(RS485_2_Addr[0]);
|
|
|
|
|
|
|
|
message += "DWR,16,";
|
|
|
|
|
|
|
|
for(int i=0 ; i<8 ; i++){
|
|
|
|
|
|
|
|
String atFlag;
|
|
|
|
|
|
|
|
if(at[i]){
|
|
|
|
|
|
|
|
atFlag = "0001"; // Auto Tuen On
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
atFlag = "0000"; // Auto Tuen Off
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message += "0302,"; // Ch No cmd.
|
|
|
|
|
|
|
|
message += "000" + String(i+1) + ","; // Ch No.
|
|
|
|
|
|
|
|
message += "0501,"; // AT cmd.
|
|
|
|
|
|
|
|
message += atFlag; // AT flag
|
|
|
|
|
|
|
|
if(i != 7){
|
|
|
|
|
|
|
|
message += ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message += sumMC9(message);
|
|
|
|
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
|
|
|
|
write_buff_first(Buff_485_2_Wr, message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message = "";
|
|
|
|
|
|
|
|
if((RS485_2_Addr[1] != 0) && (lp1>0)){
|
|
|
|
|
|
|
|
if(RS485_1_Addr[1] < 10){
|
|
|
|
|
|
|
|
message += "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message += String(RS485_2_Addr[1]);
|
|
|
|
|
|
|
|
message += "DWR,16,";
|
|
|
|
|
|
|
|
for(int i=0 ; i<8 ; i++){
|
|
|
|
|
|
|
|
String atFlag;
|
|
|
|
|
|
|
|
if(at[i+8]){
|
|
|
|
|
|
|
|
atFlag = "0001";
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
atFlag = "0000";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message += "0302,"; // Ch No cmd.
|
|
|
|
|
|
|
|
message += "000" + String(i+1) + ","; // Ch No.
|
|
|
|
|
|
|
|
message += "0501,"; // AT cmd.
|
|
|
|
|
|
|
|
message += atFlag; // AT flag
|
|
|
|
|
|
|
|
if(i != 7){
|
|
|
|
|
|
|
|
message += ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message += sumMC9(message);
|
|
|
|
|
|
|
|
message = "" + message + CRLF;
|
|
|
|
|
|
|
|
write_buff_first(Buff_485_2_Wr, message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int saveMC9(String message){
|
|
|
|
int saveMC9_1(String message){
|
|
|
|
int addr;
|
|
|
|
int addr;
|
|
|
|
int idx = -1;
|
|
|
|
int idx = -1;
|
|
|
|
String mode;
|
|
|
|
String mode;
|
|
|
@ -190,7 +334,7 @@ int saveMC9(String message){
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(latest_sent_msg.indexOf("DRS,08,0001") != -1){ // if sent message is PV CMD
|
|
|
|
if(latest_sent_msg_1.indexOf("DRS,08,0001") != -1){ // if sent message is PV CMD
|
|
|
|
//rcv_10_PV = true;
|
|
|
|
//rcv_10_PV = true;
|
|
|
|
RS485_1_Rcv_PV[idx] = true;
|
|
|
|
RS485_1_Rcv_PV[idx] = true;
|
|
|
|
for(int i = 0 ; i < RS485_1_Rcv_size ; i++){
|
|
|
|
for(int i = 0 ; i < RS485_1_Rcv_size ; i++){
|
|
|
@ -198,7 +342,7 @@ int saveMC9(String message){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(latest_sent_msg.indexOf("DRS,08,0011") != -1){ // if sent message is SV CMD
|
|
|
|
if(latest_sent_msg_1.indexOf("DRS,08,0011") != -1){ // if sent message is SV CMD
|
|
|
|
//rcv_10_SV = true;
|
|
|
|
//rcv_10_SV = true;
|
|
|
|
RS485_1_Rcv_SV[idx] = true;
|
|
|
|
RS485_1_Rcv_SV[idx] = true;
|
|
|
|
for(int i = 0 ; i < RS485_1_Rcv_size ; i++){
|
|
|
|
for(int i = 0 ; i < RS485_1_Rcv_size ; i++){
|
|
|
@ -213,7 +357,49 @@ int saveMC9(String message){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int timeoutMC9(){
|
|
|
|
int saveMC9_2(String message){
|
|
|
|
|
|
|
|
int addr;
|
|
|
|
|
|
|
|
int idx = -1;
|
|
|
|
|
|
|
|
String mode;
|
|
|
|
|
|
|
|
int data[8];
|
|
|
|
|
|
|
|
int crc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!parseMC9(message, addr, mode, data, crc)) {
|
|
|
|
|
|
|
|
for(int i=0 ; i < 2 ; i++){ // RS485_1 has two rooms for two MC9s
|
|
|
|
|
|
|
|
if(RS485_2_Addr[i] == addr){
|
|
|
|
|
|
|
|
idx = i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(idx < 0){
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(latest_sent_msg_2.indexOf("DRS,08,0001") != -1){ // if sent message is PV CMD
|
|
|
|
|
|
|
|
//rcv_10_PV = true;
|
|
|
|
|
|
|
|
RS485_2_Rcv_PV[idx] = true;
|
|
|
|
|
|
|
|
for(int i = 0 ; i < RS485_1_Rcv_size ; i++){
|
|
|
|
|
|
|
|
RS485_2_Values_PV[i + idx*8] = data[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(latest_sent_msg_2.indexOf("DRS,08,0011") != -1){ // if sent message is SV CMD
|
|
|
|
|
|
|
|
//rcv_10_SV = true;
|
|
|
|
|
|
|
|
RS485_2_Rcv_SV[idx] = true;
|
|
|
|
|
|
|
|
for(int i = 0 ; i < RS485_1_Rcv_size ; i++){
|
|
|
|
|
|
|
|
RS485_2_Values_SV[i + idx*8] = data[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Serial.println("error 485 read");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int timeoutMC9_1(){
|
|
|
|
int addr;
|
|
|
|
int addr;
|
|
|
|
int idx = -1;
|
|
|
|
int idx = -1;
|
|
|
|
String msg, mode, cmd;
|
|
|
|
String msg, mode, cmd;
|
|
|
@ -222,12 +408,12 @@ int timeoutMC9(){
|
|
|
|
int crc;
|
|
|
|
int crc;
|
|
|
|
// Message parsing
|
|
|
|
// Message parsing
|
|
|
|
|
|
|
|
|
|
|
|
msg = latest_sent_msg.substring(1);
|
|
|
|
msg = latest_sent_msg_1.substring(1);
|
|
|
|
sscanf(msg.c_str(), "%2d%3s", &addr, &dummy);
|
|
|
|
sscanf(msg.c_str(), "%2d%3s", &addr, &dummy);
|
|
|
|
|
|
|
|
|
|
|
|
Serial.print("485 not responced... (Timeout) Req msg : " + latest_sent_msg);
|
|
|
|
//230721 Serial.print("485 not responced... (Timeout) Req msg : " + latest_sent_msg_1);
|
|
|
|
|
|
|
|
|
|
|
|
if (latest_sent_msg.indexOf("DRS") != -1) {
|
|
|
|
if (latest_sent_msg_1.indexOf("DRS") != -1) {
|
|
|
|
for(int i=0 ; i < 2 ; i++){ // RS485_1 has two rooms for two MC9s
|
|
|
|
for(int i=0 ; i < 2 ; i++){ // RS485_1 has two rooms for two MC9s
|
|
|
|
// Find idx of array
|
|
|
|
// Find idx of array
|
|
|
|
if(RS485_1_Addr[i] == addr){
|
|
|
|
if(RS485_1_Addr[i] == addr){
|
|
|
@ -236,23 +422,38 @@ int timeoutMC9(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If not matched, return error
|
|
|
|
return 0;
|
|
|
|
if(idx < 0){
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
Serial.println();
|
|
|
|
Serial.println();
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(latest_sent_msg.indexOf("DRS,08,0001") != -1){ // if sent message is PV CMD
|
|
|
|
}
|
|
|
|
RS485_1_Rcv_PV[idx] = false;
|
|
|
|
|
|
|
|
Serial.print(" >> PV @");
|
|
|
|
int timeoutMC9_2(){
|
|
|
|
Serial.println(idx);
|
|
|
|
int addr;
|
|
|
|
}
|
|
|
|
int idx = -1;
|
|
|
|
if(latest_sent_msg.indexOf("DRS,08,0011") != -1){ // if sent message is SV CMD
|
|
|
|
String msg, mode, cmd;
|
|
|
|
RS485_1_Rcv_SV[idx] = false;
|
|
|
|
char dummy[4];
|
|
|
|
|
|
|
|
int data[8];
|
|
|
|
|
|
|
|
int crc;
|
|
|
|
|
|
|
|
// Message parsing
|
|
|
|
|
|
|
|
|
|
|
|
Serial.print(" >> SV @");
|
|
|
|
msg = latest_sent_msg_2.substring(1);
|
|
|
|
Serial.println(idx);
|
|
|
|
sscanf(msg.c_str(), "%2d%3s", &addr, &dummy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//230721 Serial.print("485 not responced... (Timeout) Req msg : " + latest_sent_msg_1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (latest_sent_msg_2.indexOf("DRS") != -1) {
|
|
|
|
|
|
|
|
for(int i=0 ; i < 2 ; i++){ // RS485_1 has two rooms for two MC9s
|
|
|
|
|
|
|
|
// Find idx of array
|
|
|
|
|
|
|
|
if(RS485_2_Addr[i] == addr){
|
|
|
|
|
|
|
|
idx = i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -260,18 +461,6 @@ int timeoutMC9(){
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
if(latest_sent_msg == MC9_10_PV){
|
|
|
|
|
|
|
|
//rcv_10_PV = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(latest_sent_msg == MC9_10_SV){
|
|
|
|
|
|
|
|
//rcv_10_SV = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
Serial.println("error 485 read");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int parseMC9(const String& message, int& addr, String& mode, int data[8], int& crc) {
|
|
|
|
int parseMC9(const String& message, int& addr, String& mode, int data[8], int& crc) {
|
|
|
|