mb master, slave add custom fc handlers

This commit is contained in:
aleks committed 2025-03-10 16:09:03 +01:00
1 parent a54f11355c
commit fc8fc06fc5
23 files changed
+438 -84

No files matched your search

+13 -3
View File
@@ -255,9 +255,19 @@ static esp_err_t mbc_tcp_master_send_request(void *ctx, mb_param_request_t *requ
break;
#endif
default:
ESP_LOGE(TAG, "%s: Incorrect or unsupported function in request (%u) ",
__FUNCTION__, (unsigned)mb_command);
mb_error = MB_ENOREG;
mb_fn_handler_fp phandler = NULL;
// check registered function handler
mb_error = mbm_get_handler(mb_command, &phandler);
if (mb_error == MB_ENOERR) {
// send the request for custom command
mb_error = mbm_rq_custom(mbm_controller_iface->mb_base, mb_slave_addr, mb_command,
data_ptr, (uint16_t)(mb_size << 1),
pdMS_TO_TICKS(MB_MAX_RESP_DELAY_MS));
ESP_LOGD(TAG, "%s: Send custom request (%u), error = (0x%d) ", __FUNCTION__, mb_command, (int)mb_error);
} else {
ESP_LOGE(TAG, "%s: Incorrect or unsupported function in request (%u) ", __FUNCTION__, mb_command);
mb_error = MB_ENOREG;
}
break;
}
} else {