Browse Source

Deleted unuseful code in check_crc16()

Stéphane Raimbault 18 years ago
parent
commit
26dc666aa7
1 changed files with 1 additions and 9 deletions
  1. 1 9
      src/modbus.c

+ 1 - 9
src/modbus.c

@@ -320,17 +320,9 @@ int check_crc16(modbus_param_t *mb_param,
 	if (mb_param->type_com == RTU) {
 		unsigned short crc_calc;
 		unsigned short crc_received;
-		unsigned char recv_crc_hi;
-		unsigned char recv_crc_lo;
 		
 		crc_calc = crc16(msg, msg_size - 2);
-		
-		recv_crc_hi = msg[msg_size - 2];
-		recv_crc_lo = msg[msg_size - 1];
-		
-		crc_received = msg[msg_size - 2];
-		crc_received = crc_received << 8;
-		crc_received = crc_received | msg[msg_size - 1];
+		crc_received = (msg[msg_size - 2] << 8) | msg[msg_size - 1];
 		
 		/* Check CRC of msg */
 		if (crc_calc == crc_received) {