Commit 4d205479a86089e75ce2d2cd50bf107cca41cde4

Authored by Stéphane Raimbault
1 parent 94c9fcd9

Rename modbus_check_response to modbus_receive

Showing 1 changed file with 10 additions and 10 deletions
modbus/modbus.c
@@ -589,7 +589,7 @@ int receive_msg(modbus_param_t *mb_param, @@ -589,7 +589,7 @@ int receive_msg(modbus_param_t *mb_param,
589 } 589 }
590 590
591 591
592 -/* Checks the right response is returned with good checksum. 592 +/* Receives the response and checks values (and checksum in RTU).
593 593
594 Returns: 594 Returns:
595 - the numbers of values (bits or word) if success 595 - the numbers of values (bits or word) if success
@@ -597,9 +597,9 @@ int receive_msg(modbus_param_t *mb_param, @@ -597,9 +597,9 @@ int receive_msg(modbus_param_t *mb_param,
597 597
598 Note: all functions used to send or receive data with modbus return 598 Note: all functions used to send or receive data with modbus return
599 these values. */ 599 these values. */
600 -static int modbus_check_response(modbus_param_t *mb_param,  
601 - uint8_t *query,  
602 - uint8_t *response) 600 +static int modbus_receive(modbus_param_t *mb_param,
  601 + uint8_t *query,
  602 + uint8_t *response)
603 { 603 {
604 int response_length; 604 int response_length;
605 int response_length_computed; 605 int response_length_computed;
@@ -952,7 +952,7 @@ static int read_io_status(modbus_param_t *mb_param, int slave, int function, @@ -952,7 +952,7 @@ static int read_io_status(modbus_param_t *mb_param, int slave, int function,
952 int offset; 952 int offset;
953 int offset_length; 953 int offset_length;
954 954
955 - ret = modbus_check_response(mb_param, query, response); 955 + ret = modbus_receive(mb_param, query, response);
956 if (ret < 0) 956 if (ret < 0)
957 return ret; 957 return ret;
958 958
@@ -1042,7 +1042,7 @@ static int read_registers(modbus_param_t *mb_param, int slave, int function, @@ -1042,7 +1042,7 @@ static int read_registers(modbus_param_t *mb_param, int slave, int function,
1042 int offset; 1042 int offset;
1043 int i; 1043 int i;
1044 1044
1045 - ret = modbus_check_response(mb_param, query, response); 1045 + ret = modbus_receive(mb_param, query, response);
1046 1046
1047 offset = mb_param->header_length; 1047 offset = mb_param->header_length;
1048 1048
@@ -1111,7 +1111,7 @@ static int set_single(modbus_param_t *mb_param, int slave, int function, @@ -1111,7 +1111,7 @@ static int set_single(modbus_param_t *mb_param, int slave, int function,
1111 /* Used by force_single_coil and 1111 /* Used by force_single_coil and
1112 * preset_single_register */ 1112 * preset_single_register */
1113 uint8_t response[MIN_QUERY_LENGTH]; 1113 uint8_t response[MIN_QUERY_LENGTH];
1114 - ret = modbus_check_response(mb_param, query, response); 1114 + ret = modbus_receive(mb_param, query, response);
1115 } 1115 }
1116 1116
1117 return ret; 1117 return ret;
@@ -1190,7 +1190,7 @@ int force_multiple_coils(modbus_param_t *mb_param, int slave, @@ -1190,7 +1190,7 @@ int force_multiple_coils(modbus_param_t *mb_param, int slave,
1190 ret = modbus_send(mb_param, query, query_length); 1190 ret = modbus_send(mb_param, query, query_length);
1191 if (ret > 0) { 1191 if (ret > 0) {
1192 uint8_t response[MAX_MESSAGE_LENGTH]; 1192 uint8_t response[MAX_MESSAGE_LENGTH];
1193 - ret = modbus_check_response(mb_param, query, response); 1193 + ret = modbus_receive(mb_param, query, response);
1194 } 1194 }
1195 1195
1196 1196
@@ -1229,7 +1229,7 @@ int preset_multiple_registers(modbus_param_t *mb_param, int slave, @@ -1229,7 +1229,7 @@ int preset_multiple_registers(modbus_param_t *mb_param, int slave,
1229 ret = modbus_send(mb_param, query, query_length); 1229 ret = modbus_send(mb_param, query, query_length);
1230 if (ret > 0) { 1230 if (ret > 0) {
1231 uint8_t response[MAX_MESSAGE_LENGTH]; 1231 uint8_t response[MAX_MESSAGE_LENGTH];
1232 - ret = modbus_check_response(mb_param, query, response); 1232 + ret = modbus_receive(mb_param, query, response);
1233 } 1233 }
1234 1234
1235 return ret; 1235 return ret;
@@ -1258,7 +1258,7 @@ int report_slave_id(modbus_param_t *mb_param, int slave, @@ -1258,7 +1258,7 @@ int report_slave_id(modbus_param_t *mb_param, int slave,
1258 1258
1259 /* Byte count, slave id, run indicator status, 1259 /* Byte count, slave id, run indicator status,
1260 additional data */ 1260 additional data */
1261 - ret = modbus_check_response(mb_param, query, response); 1261 + ret = modbus_receive(mb_param, query, response);
1262 if (ret < 0) 1262 if (ret < 0)
1263 return ret; 1263 return ret;
1264 1264