forked from espressif/esp-modbus
Merge branch 'bugfix/fix_custom_command_guard' into 'main'
fix master compilation issue with mbm_rq_common See merge request idf/esp-modbus!122
This commit is contained in:
@@ -34,8 +34,6 @@
|
|||||||
#include "mb_slave.h"
|
#include "mb_slave.h"
|
||||||
#include "mb_master.h"
|
#include "mb_master.h"
|
||||||
|
|
||||||
#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED && MB_FUNC_OTHER_REP_SLAVEID_BUF
|
|
||||||
|
|
||||||
#define MB_PDU_BYTECNT_OFF (MB_PDU_DATA_OFF + 0)
|
#define MB_PDU_BYTECNT_OFF (MB_PDU_DATA_OFF + 0)
|
||||||
#define MB_PDU_FUNC_DATA_OFF (MB_PDU_DATA_OFF + 1)
|
#define MB_PDU_FUNC_DATA_OFF (MB_PDU_DATA_OFF + 1)
|
||||||
#define MB_CMD_SL_ID_LEN (1)
|
#define MB_CMD_SL_ID_LEN (1)
|
||||||
@@ -45,13 +43,13 @@
|
|||||||
mb_exception_t mb_error_to_exception(mb_err_enum_t error_code);
|
mb_exception_t mb_error_to_exception(mb_err_enum_t error_code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will request read coil.
|
* This helper function performs the custom request.
|
||||||
*
|
*
|
||||||
* @param uid slave address
|
* @param uid slave address
|
||||||
* @param fc custom function code
|
* @param fc custom function code
|
||||||
* @param buf additional data to send
|
* @param buf additional data to send
|
||||||
* @param buf_size size of data to send
|
* @param buf_size size of data to send
|
||||||
* @param timeout timeout (-1 will waiting forever)
|
* @param timeout timeout
|
||||||
*
|
*
|
||||||
* @return error code (mb_err_enum_t)
|
* @return error code (mb_err_enum_t)
|
||||||
*/
|
*/
|
||||||
@@ -77,6 +75,8 @@ mb_err_enum_t mbm_rq_custom(mb_base_t *inst, uint8_t uid, uint8_t fc, uint8_t *b
|
|||||||
return mb_port_event_wait_req_finish(inst->port_obj);
|
return mb_port_event_wait_req_finish(inst->port_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED && MB_FUNC_OTHER_REP_SLAVEID_BUF
|
||||||
|
|
||||||
mb_err_enum_t mbm_rq_report_slave_id(mb_base_t *inst, uint8_t slave_addr, uint32_t timeout)
|
mb_err_enum_t mbm_rq_report_slave_id(mb_base_t *inst, uint8_t slave_addr, uint32_t timeout)
|
||||||
{
|
{
|
||||||
uint8_t *mb_frame_ptr = NULL;
|
uint8_t *mb_frame_ptr = NULL;
|
||||||
|
@@ -22,11 +22,11 @@ mb_err_enum_t mbm_rq_read_discrete_inputs(mb_base_t *inst, uint8_t snd_addr, uin
|
|||||||
mb_err_enum_t mbm_rq_read_coils(mb_base_t *inst, uint8_t snd_addr, uint16_t coil_addr, uint16_t coil_num, uint32_t tout);
|
mb_err_enum_t mbm_rq_read_coils(mb_base_t *inst, uint8_t snd_addr, uint16_t coil_addr, uint16_t coil_num, uint32_t tout);
|
||||||
mb_err_enum_t mbm_rq_write_coil(mb_base_t *inst, uint8_t snd_addr, uint16_t coil_addr, uint16_t coil_data, uint32_t tout);
|
mb_err_enum_t mbm_rq_write_coil(mb_base_t *inst, uint8_t snd_addr, uint16_t coil_addr, uint16_t coil_data, uint32_t tout);
|
||||||
mb_err_enum_t mbm_rq_write_multi_coils(mb_base_t *inst, uint8_t snd_addr, uint16_t coil_addr, uint16_t coil_num, uint8_t *data_ptr, uint32_t tout);
|
mb_err_enum_t mbm_rq_write_multi_coils(mb_base_t *inst, uint8_t snd_addr, uint16_t coil_addr, uint16_t coil_num, uint8_t *data_ptr, uint32_t tout);
|
||||||
|
mb_err_enum_t mbm_rq_custom(mb_base_t *inst, uint8_t uid, uint8_t fc, uint8_t *buf, uint16_t buf_size, uint32_t tout);
|
||||||
|
|
||||||
#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED
|
#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED
|
||||||
mb_err_enum_t mbm_rq_report_slave_id(mb_base_t *inst, uint8_t slave_addr, uint32_t timeout);
|
mb_err_enum_t mbm_rq_report_slave_id(mb_base_t *inst, uint8_t slave_addr, uint32_t timeout);
|
||||||
mb_exception_t mbm_fn_report_slave_id(mb_base_t *inst, uint8_t * pframe, uint16_t *usLen);
|
mb_exception_t mbm_fn_report_slave_id(mb_base_t *inst, uint8_t * pframe, uint16_t *usLen);
|
||||||
mb_err_enum_t mbm_rq_custom(mb_base_t *inst, uint8_t uid, uint8_t fc, uint8_t *buf, uint16_t buf_size, uint32_t tout);
|
|
||||||
|
|
||||||
/*! \ingroup modbus_registers
|
/*! \ingroup modbus_registers
|
||||||
* \brief The common callback function used to transfer common data as bytes from command buffer in little endian format.
|
* \brief The common callback function used to transfer common data as bytes from command buffer in little endian format.
|
||||||
|
@@ -556,12 +556,6 @@ int port_scan_addr_string(char *buffer, mb_uid_info_t *pinfo)
|
|||||||
|
|
||||||
static int mdns_instance_count = 0;
|
static int mdns_instance_count = 0;
|
||||||
|
|
||||||
inline char *gen_id_str(char *service_name, char *node_id_str)
|
|
||||||
{
|
|
||||||
sprintf(node_id_str, "%s%02X%02X%02X%02X", service_name, MB_ID2STR(MB_DEVICE_ID));
|
|
||||||
return node_id_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function has limitation of working with IP6 address only
|
// This function has limitation of working with IP6 address only
|
||||||
esp_err_t port_start_mdns_service(char **ppdns_name, bool is_master, int uid, void *pnode_netif)
|
esp_err_t port_start_mdns_service(char **ppdns_name, bool is_master, int uid, void *pnode_netif)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user