Merge branch 'bugfix/modbus_fix_start_after_destroy_issues' into 'master'

modbus: fix tcp slave destroy issues

Closes IDFGH-6568

See merge request espressif/esp-idf!16856
This commit is contained in:
Alex Lisitsyn 2022-03-03 16:34:33 +08:00
commit dcaac79380
10 changed files with 132 additions and 133 deletions

View File

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
* *
* SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
*/ */
/* /*
* FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
@ -229,6 +229,8 @@ BOOL xMBTCPPortInit( USHORT usTCPPort );
void vMBTCPPortClose( void ); void vMBTCPPortClose( void );
void vMBTCPPortEnable( void );
void vMBTCPPortDisable( void ); void vMBTCPPortDisable( void );
BOOL xMBTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength ); BOOL xMBTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength );
@ -242,6 +244,8 @@ BOOL xMBMasterTCPPortInit( USHORT usTCPPort );
void vMBMasterTCPPortClose( void ); void vMBMasterTCPPortClose( void );
void vMBMasterTCPPortEnable( void );
void vMBMasterTCPPortDisable( void ); void vMBMasterTCPPortDisable( void );
BOOL xMBMasterTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength ); BOOL xMBMasterTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength );

View File

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
* *
* SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
*/ */
/* /*
* FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
@ -93,12 +93,15 @@ eMBTCPDoInit( USHORT ucTCPPort )
void void
eMBTCPStart( void ) eMBTCPStart( void )
{ {
ESP_LOGD(MB_PORT_TAG, "TCP Slave port enable.");
vMBTCPPortEnable( );
} }
void void
eMBTCPStop( void ) eMBTCPStop( void )
{ {
/* Make sure that no more clients are connected. */ /* Make sure that no more clients are connected. */
ESP_LOGD(MB_PORT_TAG, "TCP Slave port disable.");
vMBTCPPortDisable( ); vMBTCPPortDisable( );
} }

View File

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
* *
* SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
*/ */
/* /*
* FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
@ -93,11 +93,15 @@ eMBMasterTCPDoInit( USHORT ucTCPPort )
void void
eMBMasterTCPStart( void ) eMBMasterTCPStart( void )
{ {
ESP_LOGD(MB_PORT_TAG, "TCP Master port enable.");
vMBMasterTCPPortEnable( );
} }
void void
eMBMasterTCPStop( void ) eMBMasterTCPStop( void )
{ {
ESP_LOGD(MB_PORT_TAG, "TCP Master port disable.");
vMBMasterTCPPortDisable( );
} }
eMBErrorCode eMBErrorCode

View File

@ -156,7 +156,10 @@ static esp_err_t mbc_tcp_master_start(void)
eMBPortProto proto = (comm_info->ip_mode == MB_MODE_TCP) ? MB_PROTO_TCP : MB_PROTO_UDP; eMBPortProto proto = (comm_info->ip_mode == MB_MODE_TCP) ? MB_PROTO_TCP : MB_PROTO_UDP;
eMBPortIpVer ip_ver = (comm_info->ip_addr_type == MB_IPV4) ? MB_PORT_IPV4 : MB_PORT_IPV6; eMBPortIpVer ip_ver = (comm_info->ip_addr_type == MB_IPV4) ? MB_PORT_IPV4 : MB_PORT_IPV6;
vMBTCPPortMasterSetNetOpt(comm_info->ip_netif_ptr, ip_ver, proto); vMBTCPPortMasterSetNetOpt(comm_info->ip_netif_ptr, ip_ver, proto);
vMBTCPPortMasterTaskStart();
status = eMBMasterEnable();
MB_MASTER_CHECK((status == MB_ENOERR), ESP_ERR_INVALID_STATE,
"mb stack set slave ID failure, eMBMasterEnable() returned (0x%x).", (uint32_t)status);
// Add slave IP address for each slave to initialize connection // Add slave IP address for each slave to initialize connection
mb_slave_addr_entry_t *p_slave_info; mb_slave_addr_entry_t *p_slave_info;
@ -169,10 +172,6 @@ static esp_err_t mbc_tcp_master_start(void)
// Add end of list condition // Add end of list condition
(void)xMBTCPPortMasterAddSlaveIp(0xFF, NULL, 0xFF); (void)xMBTCPPortMasterAddSlaveIp(0xFF, NULL, 0xFF);
status = eMBMasterEnable();
MB_MASTER_CHECK((status == MB_ENOERR), ESP_ERR_INVALID_STATE,
"mb stack set slave ID failure, eMBMasterEnable() returned (0x%x).", (uint32_t)status);
// Wait for connection done event // Wait for connection done event
bool start = (bool)xMBTCPPortMasterWaitEvent(mbm_opts->mbm_event_group, bool start = (bool)xMBTCPPortMasterWaitEvent(mbm_opts->mbm_event_group,
@ -274,44 +273,44 @@ static esp_err_t mbc_tcp_master_send_request(mb_param_request_t* request, void*
{ {
case MB_FUNC_READ_COILS: case MB_FUNC_READ_COILS:
mb_error = eMBMasterReqReadCoils((UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqReadCoils((UCHAR)mb_slave_addr, (USHORT)mb_offset,
(USHORT)mb_size , (LONG)MB_RESPONSE_TIMEOUT ); (USHORT)mb_size, (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_WRITE_SINGLE_COIL: case MB_FUNC_WRITE_SINGLE_COIL:
mb_error = eMBMasterReqWriteCoil((UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqWriteCoil((UCHAR)mb_slave_addr, (USHORT)mb_offset,
*(USHORT*)data_ptr, (LONG)MB_RESPONSE_TIMEOUT ); *(USHORT *)data_ptr, (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_WRITE_MULTIPLE_COILS: case MB_FUNC_WRITE_MULTIPLE_COILS:
mb_error = eMBMasterReqWriteMultipleCoils((UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqWriteMultipleCoils((UCHAR)mb_slave_addr, (USHORT)mb_offset,
(USHORT)mb_size, (UCHAR*)data_ptr, (USHORT)mb_size, (UCHAR *)data_ptr,
(LONG)MB_RESPONSE_TIMEOUT); (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_READ_DISCRETE_INPUTS: case MB_FUNC_READ_DISCRETE_INPUTS:
mb_error = eMBMasterReqReadDiscreteInputs((UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqReadDiscreteInputs((UCHAR)mb_slave_addr, (USHORT)mb_offset,
(USHORT)mb_size, (LONG)MB_RESPONSE_TIMEOUT ); (USHORT)mb_size, (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_READ_HOLDING_REGISTER: case MB_FUNC_READ_HOLDING_REGISTER:
mb_error = eMBMasterReqReadHoldingRegister((UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqReadHoldingRegister((UCHAR)mb_slave_addr, (USHORT)mb_offset,
(USHORT)mb_size, (LONG)MB_RESPONSE_TIMEOUT ); (USHORT)mb_size, (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_WRITE_REGISTER: case MB_FUNC_WRITE_REGISTER:
mb_error = eMBMasterReqWriteHoldingRegister( (UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqWriteHoldingRegister((UCHAR)mb_slave_addr, (USHORT)mb_offset,
*(USHORT*)data_ptr, (LONG)MB_RESPONSE_TIMEOUT ); *(USHORT *)data_ptr, (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_WRITE_MULTIPLE_REGISTERS: case MB_FUNC_WRITE_MULTIPLE_REGISTERS:
mb_error = eMBMasterReqWriteMultipleHoldingRegister( (UCHAR)mb_slave_addr, mb_error = eMBMasterReqWriteMultipleHoldingRegister((UCHAR)mb_slave_addr,
(USHORT)mb_offset, (USHORT)mb_size, (USHORT)mb_offset, (USHORT)mb_size,
(USHORT*)data_ptr, (LONG)MB_RESPONSE_TIMEOUT ); (USHORT *)data_ptr, (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_READWRITE_MULTIPLE_REGISTERS: case MB_FUNC_READWRITE_MULTIPLE_REGISTERS:
mb_error = eMBMasterReqReadWriteMultipleHoldingRegister( (UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqReadWriteMultipleHoldingRegister((UCHAR)mb_slave_addr, (USHORT)mb_offset,
(USHORT)mb_size, (USHORT*)data_ptr, (USHORT)mb_size, (USHORT *)data_ptr,
(USHORT)mb_offset, (USHORT)mb_size, (USHORT)mb_offset, (USHORT)mb_size,
(LONG)MB_RESPONSE_TIMEOUT ); (LONG)MB_RESPONSE_TIMEOUT);
break; break;
case MB_FUNC_READ_INPUT_REGISTER: case MB_FUNC_READ_INPUT_REGISTER:
mb_error = eMBMasterReqReadInputRegister( (UCHAR)mb_slave_addr, (USHORT)mb_offset, mb_error = eMBMasterReqReadInputRegister((UCHAR)mb_slave_addr, (USHORT)mb_offset,
(USHORT)mb_size, (LONG) MB_RESPONSE_TIMEOUT ); (USHORT)mb_size, (LONG)MB_RESPONSE_TIMEOUT);
break; break;
default: default:
ESP_LOGE(TAG, "%s: Incorrect function in request (%u) ", ESP_LOGE(TAG, "%s: Incorrect function in request (%u) ",
@ -578,8 +577,7 @@ static esp_err_t mbc_tcp_master_set_parameter(uint16_t cid, char* name, uint8_t*
* @return result * @return result
*/ */
// Callback function for reading of MB Input Registers // Callback function for reading of MB Input Registers
eMBErrorCode eMBRegInputCBTcpMaster(UCHAR * pucRegBuffer, USHORT usAddress, eMBErrorCode eMBRegInputCBTcpMaster(UCHAR* pucRegBuffer, USHORT usAddress, USHORT usNRegs)
USHORT usNRegs)
{ {
MB_MASTER_ASSERT(mbm_interface_ptr != NULL); MB_MASTER_ASSERT(mbm_interface_ptr != NULL);
mb_master_options_t* mbm_opts = &mbm_interface_ptr->opts; mb_master_options_t* mbm_opts = &mbm_interface_ptr->opts;
@ -614,36 +612,40 @@ eMBErrorCode eMBRegInputCBTcpMaster(UCHAR * pucRegBuffer, USHORT usAddress,
*/ */
// Callback function for reading of MB Holding Registers // Callback function for reading of MB Holding Registers
// Executed by stack when request to read/write holding registers is received // Executed by stack when request to read/write holding registers is received
eMBErrorCode eMBRegHoldingCBTcpMaster(UCHAR * pucRegBuffer, USHORT usAddress, eMBErrorCode eMBRegHoldingCBTcpMaster(UCHAR *pucRegBuffer, USHORT usAddress,
USHORT usNRegs, eMBRegisterMode eMode) USHORT usNRegs, eMBRegisterMode eMode)
{ {
MB_MASTER_ASSERT(mbm_interface_ptr != NULL); MB_MASTER_ASSERT(mbm_interface_ptr != NULL);
mb_master_options_t* mbm_opts = &mbm_interface_ptr->opts; mb_master_options_t *mbm_opts = &mbm_interface_ptr->opts;
MB_MASTER_ASSERT(pucRegBuffer != NULL); MB_MASTER_ASSERT(pucRegBuffer != NULL);
USHORT usRegHoldingNregs = (USHORT)mbm_opts->mbm_reg_buffer_size; USHORT usRegHoldingNregs = (USHORT)mbm_opts->mbm_reg_buffer_size;
UCHAR* pucHoldingBuffer = (UCHAR*)mbm_opts->mbm_reg_buffer_ptr; UCHAR *pucHoldingBuffer = (UCHAR *)mbm_opts->mbm_reg_buffer_ptr;
eMBErrorCode eStatus = MB_ENOERR; eMBErrorCode eStatus = MB_ENOERR;
USHORT usRegs = usNRegs; USHORT usRegs = usNRegs;
// Check input and configuration parameters for correctness // Check input and configuration parameters for correctness
if ((pucHoldingBuffer != NULL) if ((pucHoldingBuffer != NULL) && (usRegHoldingNregs == usNRegs) && (usNRegs >= 1))
&& (usRegHoldingNregs == usNRegs) {
&& (usNRegs >= 1)) { switch (eMode)
switch (eMode) { {
case MB_REG_WRITE: case MB_REG_WRITE:
while (usRegs > 0) { while (usRegs > 0)
{
_XFER_2_RD(pucRegBuffer, pucHoldingBuffer); _XFER_2_RD(pucRegBuffer, pucHoldingBuffer);
usRegs -= 1; usRegs -= 1;
}; };
break; break;
case MB_REG_READ: case MB_REG_READ:
while (usRegs > 0) { while (usRegs > 0)
{
_XFER_2_WR(pucHoldingBuffer, pucRegBuffer); _XFER_2_WR(pucHoldingBuffer, pucRegBuffer);
pucHoldingBuffer += 2; pucHoldingBuffer += 2;
usRegs -= 1; usRegs -= 1;
}; };
break; break;
} }
} else { }
else
{
eStatus = MB_ENOREG; eStatus = MB_ENOREG;
} }
return eStatus; return eStatus;
@ -660,7 +662,7 @@ eMBErrorCode eMBRegHoldingCBTcpMaster(UCHAR * pucRegBuffer, USHORT usAddress,
* @return result * @return result
*/ */
// Callback function for reading of MB Coils Registers // Callback function for reading of MB Coils Registers
eMBErrorCode eMBRegCoilsCBTcpMaster(UCHAR* pucRegBuffer, USHORT usAddress, eMBErrorCode eMBRegCoilsCBTcpMaster(UCHAR *pucRegBuffer, USHORT usAddress,
USHORT usNCoils, eMBRegisterMode eMode) USHORT usNCoils, eMBRegisterMode eMode)
{ {
MB_MASTER_ASSERT(mbm_interface_ptr != NULL); MB_MASTER_ASSERT(mbm_interface_ptr != NULL);

View File

@ -249,11 +249,6 @@ void vMBTCPPortMasterSetNetOpt(void* pvNetIf, eMBPortIpVer xIpVersion, eMBPortPr
xMbPortConfig.eMbIpVer = xIpVersion; xMbPortConfig.eMbIpVer = xIpVersion;
} }
void vMBTCPPortMasterTaskStart(void)
{
vTaskResume(xMbPortConfig.xMbTcpTaskHandle);
}
// Function returns time left for response processing according to response timeout // Function returns time left for response processing according to response timeout
static int64_t xMBTCPPortMasterGetRespTimeLeft(MbSlaveInfo_t* pxInfo) static int64_t xMBTCPPortMasterGetRespTimeLeft(MbSlaveInfo_t* pxInfo)
{ {
@ -891,23 +886,13 @@ extern void vMBMasterPortEventClose(void);
extern void vMBMasterPortTimerClose(void); extern void vMBMasterPortTimerClose(void);
void void
vMBMasterTCPPortDisable(void) vMBMasterTCPPortEnable(void)
{ {
for (USHORT ucCnt = 0; ucCnt < MB_TCP_PORT_MAX_CONN; ucCnt++) { vTaskResume(xMbPortConfig.xMbTcpTaskHandle);
MbSlaveInfo_t* pxInfo = xMbPortConfig.pxMbSlaveInfo[ucCnt];
if (pxInfo) {
xMBTCPPortMasterCloseConnection(pxInfo);
if (pxInfo->pucRcvBuf) {
free(pxInfo->pucRcvBuf);
}
free(pxInfo);
xMbPortConfig.pxMbSlaveInfo[ucCnt] = NULL;
}
}
} }
void void
vMBMasterTCPPortClose(void) vMBMasterTCPPortDisable(void)
{ {
// Try to exit the task gracefully, so select could release its internal callbacks // Try to exit the task gracefully, so select could release its internal callbacks
// that were allocated on the stack of the task we're going to delete // that were allocated on the stack of the task we're going to delete
@ -921,8 +906,23 @@ vMBMasterTCPPortClose(void)
vSemaphoreDelete(xShutdownSemaphore); vSemaphoreDelete(xShutdownSemaphore);
xShutdownSemaphore = NULL; xShutdownSemaphore = NULL;
} }
vMBMasterTCPPortDisable(); for (USHORT ucCnt = 0; ucCnt < MB_TCP_PORT_MAX_CONN; ucCnt++) {
MbSlaveInfo_t* pxInfo = xMbPortConfig.pxMbSlaveInfo[ucCnt];
if (pxInfo) {
xMBTCPPortMasterCloseConnection(pxInfo);
if (pxInfo->pucRcvBuf) {
free(pxInfo->pucRcvBuf);
}
free(pxInfo);
xMbPortConfig.pxMbSlaveInfo[ucCnt] = NULL;
}
}
free(xMbPortConfig.pxMbSlaveInfo); free(xMbPortConfig.pxMbSlaveInfo);
}
void
vMBMasterTCPPortClose(void)
{
vQueueDelete(xMbPortConfig.xConnectQueue); vQueueDelete(xMbPortConfig.xConnectQueue);
vMBMasterPortTimerClose(); vMBMasterPortTimerClose();
// Release resources for the event queue. // Release resources for the event queue.

View File

@ -132,13 +132,6 @@ BOOL xMBTCPPortMasterWaitEvent(EventGroupHandle_t xEventHandle, EventBits_t xEve
*/ */
void vMBTCPPortMasterSetNetOpt(void* pvNetIf, eMBPortIpVer xIpVersion, eMBPortProto xProto); void vMBTCPPortMasterSetNetOpt(void* pvNetIf, eMBPortIpVer xIpVersion, eMBPortProto xProto);
/**
* Resume TCP/UDP Master processing task
*
* @return None
*/
void vMBTCPPortMasterTaskStart(void);
#ifdef __cplusplus #ifdef __cplusplus
PR_END_EXTERN_C PR_END_EXTERN_C
#endif #endif

View File

@ -79,7 +79,6 @@ static esp_err_t mbc_tcp_slave_start(void)
eMBPortProto proto = (mbs_opts->mbs_comm.ip_mode == MB_MODE_TCP) ? MB_PROTO_TCP : MB_PROTO_UDP; eMBPortProto proto = (mbs_opts->mbs_comm.ip_mode == MB_MODE_TCP) ? MB_PROTO_TCP : MB_PROTO_UDP;
eMBPortIpVer ip_ver = (mbs_opts->mbs_comm.ip_addr_type == MB_IPV4) ? MB_PORT_IPV4 : MB_PORT_IPV6; eMBPortIpVer ip_ver = (mbs_opts->mbs_comm.ip_addr_type == MB_IPV4) ? MB_PORT_IPV4 : MB_PORT_IPV6;
vMBTCPPortSlaveSetNetOpt(mbs_opts->mbs_comm.ip_netif_ptr, ip_ver, proto, (char*)mbs_opts->mbs_comm.ip_addr); vMBTCPPortSlaveSetNetOpt(mbs_opts->mbs_comm.ip_netif_ptr, ip_ver, proto, (char*)mbs_opts->mbs_comm.ip_addr);
vMBTCPPortSlaveStartServerTask();
status = eMBEnable(); status = eMBEnable();
MB_SLAVE_CHECK((status == MB_ENOERR), ESP_ERR_INVALID_STATE, MB_SLAVE_CHECK((status == MB_ENOERR), ESP_ERR_INVALID_STATE,
@ -110,7 +109,7 @@ static esp_err_t mbc_tcp_slave_destroy(void)
(void)vQueueDelete(mbs_opts->mbs_notification_queue_handle); (void)vQueueDelete(mbs_opts->mbs_notification_queue_handle);
(void)vEventGroupDelete(mbs_opts->mbs_event_group); (void)vEventGroupDelete(mbs_opts->mbs_event_group);
(void)vMBTCPPortClose(); (void)vMBTCPPortClose();
mbs_interface_ptr = NULL;
vMBPortSetMode((UCHAR)MB_PORT_INACTIVE); vMBPortSetMode((UCHAR)MB_PORT_INACTIVE);
return ESP_OK; return ESP_OK;
} }

View File

@ -177,11 +177,6 @@ void vMBTCPPortSlaveSetNetOpt(void* pvNetIf, eMBPortIpVer xIpVersion, eMBPortPro
xConfig.pcBindAddr = pcBindAddrStr; xConfig.pcBindAddr = pcBindAddrStr;
} }
void vMBTCPPortSlaveStartServerTask(void)
{
vTaskResume(xConfig.xMbTcpTaskHandle);
}
static int xMBTCPPortAcceptConnection(int xListenSockId, char** pcIPAddr) static int xMBTCPPortAcceptConnection(int xListenSockId, char** pcIPAddr)
{ {
MB_PORT_CHECK(pcIPAddr, -1, "Wrong IP address pointer."); MB_PORT_CHECK(pcIPAddr, -1, "Wrong IP address pointer.");
@ -656,6 +651,11 @@ vMBTCPPortClose( )
vMBPortEventClose( ); vMBPortEventClose( );
} }
void vMBTCPPortEnable( void )
{
vTaskResume(xConfig.xMbTcpTaskHandle);
}
void void
vMBTCPPortDisable( void ) vMBTCPPortDisable( void )
{ {
@ -668,6 +668,7 @@ vMBTCPPortDisable( void )
xConfig.pxMbClientInfo[i] = NULL; xConfig.pxMbClientInfo[i] = NULL;
} }
} }
free(xConfig.pxMbClientInfo);
close(xListenSock); close(xListenSock);
xListenSock = -1; xListenSock = -1;
vMBTCPPortRespQueueDelete(xConfig.xRespQueueHandle); vMBTCPPortRespQueueDelete(xConfig.xRespQueueHandle);

View File

@ -101,13 +101,6 @@ typedef struct {
*/ */
void vMBTCPPortSlaveSetNetOpt(void* pvNetIf, eMBPortIpVer xIpVersion, eMBPortProto xProto, CHAR* pcBindAddr); void vMBTCPPortSlaveSetNetOpt(void* pvNetIf, eMBPortIpVer xIpVersion, eMBPortProto xProto, CHAR* pcBindAddr);
/**
* Resume TCP Slave processing task
*
* @return None
*/
void vMBTCPPortSlaveStartServerTask(void);
#ifdef __cplusplus #ifdef __cplusplus
PR_END_EXTERN_C PR_END_EXTERN_C
#endif #endif

View File

@ -98,7 +98,7 @@ static void start_mdns_service(void)
ESP_ERROR_CHECK(mdns_init()); ESP_ERROR_CHECK(mdns_init());
//set mDNS hostname (required if you want to advertise services) //set mDNS hostname (required if you want to advertise services)
ESP_ERROR_CHECK(mdns_hostname_set(hostname)); ESP_ERROR_CHECK(mdns_hostname_set(hostname));
ESP_LOGI(SLAVE_TAG, "mdns hostname set to: [%s]", hostname); ESP_LOGI(TAG, "mdns hostname set to: [%s]", hostname);
//set default mDNS instance name //set default mDNS instance name
ESP_ERROR_CHECK(mdns_instance_name_set(MB_MDNS_INSTANCE("esp32_"))); ESP_ERROR_CHECK(mdns_instance_name_set(MB_MDNS_INSTANCE("esp32_")));