Currently two different error management approaches are used. One uses return modbus_lib_send_error(MBUS_RESPONSE_SERVICE_DEVICE_FAILURE) and other uses return MBUS_RESPONSE_SERVICE_DEVICE_FAILURE in modbus_lib_read_handler and modbus_lib_write_handler respectively.
Proper approach might be using modbus_lib_send_error() for both of them (reverse the #4 changes) or create a relevant error function for each error code in order to get rid of writing modbus_lib_send_error, which will become:
return MBUS_RESPONSE_SERVICE_DEVICE_FAILURE();
Currently two different error management approaches are used. One uses
return modbus_lib_send_error(MBUS_RESPONSE_SERVICE_DEVICE_FAILURE)and other usesreturn MBUS_RESPONSE_SERVICE_DEVICE_FAILUREinmodbus_lib_read_handlerandmodbus_lib_write_handlerrespectively.Proper approach might be using
modbus_lib_send_error()for both of them (reverse the #4 changes) or create a relevant error function for each error code in order to get rid of writingmodbus_lib_send_error, which will become: