@@ -338,11 +338,12 @@ static esp_err_t mbc_tcp_master_get_parameter(void *ctx, uint16_t cid, uint8_t *
338338
339339 error = mbc_tcp_master_set_request (ctx , cid , MB_PARAM_READ , & request , & reg_info );
340340 if ((error == ESP_OK ) && (cid == reg_info .cid ) && (request .slave_addr != MB_SLAVE_ADDR_PLACEHOLDER )) {
341- mb_uid_info_t * paddr_info = mbm_port_tcp_get_slave_info (mbm_controller_iface -> mb_base -> port_obj ,
341+ mb_uid_info_t * paddr_info = mbm_port_tcp_get_slave_info (mbm_controller_iface -> mb_base -> port_obj ,
342342 request .slave_addr , MB_SOCK_STATE_CONNECTED );
343- MB_RETURN_ON_FALSE ((paddr_info ), ESP_ERR_NOT_FOUND , TAG ,
344- "mb can not send request for cid #%u with uid = %d." ,
345- (unsigned )reg_info .cid , (int )request .slave_addr );
343+ if (!paddr_info ) {
344+ ESP_LOGW (TAG , "Try to send request for cid #%u with uid = %d, node is disconnected." ,
345+ (unsigned )reg_info .cid , (int )request .slave_addr );
346+ }
346347 MB_MASTER_ASSERT (xPortGetFreeHeapSize () > (reg_info .mb_size << 1 ));
347348 // alloc buffer to store parameter data
348349 pdata = calloc (1 , (reg_info .mb_size << 1 ));
@@ -394,8 +395,10 @@ static esp_err_t mbc_tcp_master_get_parameter_with(void *ctx, uint16_t cid, uint
394395 // check that the requested uid is connected (call to port iface)
395396 mb_uid_info_t * paddr_info = mbm_port_tcp_get_slave_info (mbm_controller_iface -> mb_base -> port_obj ,
396397 uid , MB_SOCK_STATE_CONNECTED );
397- MB_RETURN_ON_FALSE ((paddr_info ), ESP_ERR_NOT_FOUND , TAG ,
398- "mb can not send request for cid #%u with uid=%d." , (unsigned )reg_info .cid , (int )uid );
398+ if (!paddr_info ) {
399+ ESP_LOGW (TAG , "Try to send request for cid #%u with uid = %d, node is disconnected." ,
400+ (unsigned )reg_info .cid , (int )request .slave_addr );
401+ }
399402 if (request .slave_addr != MB_SLAVE_ADDR_PLACEHOLDER ) {
400403 ESP_LOGD (TAG , "%s: override uid %d = %d for cid(%u)" ,
401404 __FUNCTION__ , (int )request .slave_addr , (int )uid , (unsigned )reg_info .cid );
@@ -449,11 +452,12 @@ static esp_err_t mbc_tcp_master_set_parameter(void *ctx, uint16_t cid, uint8_t *
449452
450453 error = mbc_tcp_master_set_request (ctx , cid , MB_PARAM_WRITE , & request , & reg_info );
451454 if ((error == ESP_OK ) && (cid == reg_info .cid ) && (request .slave_addr != MB_SLAVE_ADDR_PLACEHOLDER )) {
452- mb_uid_info_t * paddr_info = mbm_port_tcp_get_slave_info (mbm_controller_iface -> mb_base -> port_obj ,
455+ mb_uid_info_t * paddr_info = mbm_port_tcp_get_slave_info (mbm_controller_iface -> mb_base -> port_obj ,
453456 request .slave_addr , MB_SOCK_STATE_CONNECTED );
454- MB_RETURN_ON_FALSE ((paddr_info ), ESP_ERR_NOT_FOUND , TAG ,
455- "mb can not send request for cid #%u with uid=%d." ,
456- (unsigned )reg_info .cid , (int )request .slave_addr );
457+ if (!paddr_info ) {
458+ ESP_LOGW (TAG , "Try to send request for cid #%u with uid = %d, node is disconnected." ,
459+ (unsigned )reg_info .cid , (int )request .slave_addr );
460+ }
457461 MB_MASTER_ASSERT (xPortGetFreeHeapSize () > (reg_info .mb_size << 1 ));
458462 pdata = calloc (1 , (reg_info .mb_size << 1 )); // alloc parameter buffer
459463 if (!pdata ) {
@@ -503,9 +507,10 @@ static esp_err_t mbc_tcp_master_set_parameter_with(void *ctx, uint16_t cid, uint
503507 // check that the requested uid is connected (call to port iface)
504508 mb_uid_info_t * paddr_info = mbm_port_tcp_get_slave_info (mbm_controller_iface -> mb_base -> port_obj ,
505509 uid , MB_SOCK_STATE_CONNECTED );
506- MB_RETURN_ON_FALSE ((paddr_info ), ESP_ERR_NOT_FOUND , TAG ,
507- "mb can not send request for cid #%d with uid=%d." ,
508- (unsigned )reg_info .cid , (int )uid );
510+ if (!paddr_info ) {
511+ ESP_LOGW (TAG , "Try to send request for cid #%u with uid = %d, node is disconnected." ,
512+ (unsigned )reg_info .cid , (int )request .slave_addr );
513+ }
509514 if (request .slave_addr != MB_SLAVE_ADDR_PLACEHOLDER ) {
510515 ESP_LOGD (TAG , "%s: override uid %d = %d for cid(%u)" ,
511516 __FUNCTION__ , (int )request .slave_addr , (int )uid , (unsigned )reg_info .cid );
0 commit comments