forked from espressif/esp-modbus
mb master, slave add custom fc handlers
This commit is contained in:
1 parent
a54f11355c
commit
fc8fc06fc5
23 files changed
+438
-84
No files matched your search
@@ -256,9 +256,19 @@ static esp_err_t mbc_serial_master_send_request(void *ctx, mb_param_request_t *r
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ESP_LOGE(TAG, "%s: Incorrect or unsupported function in request (%u) ",
|
||||
__FUNCTION__, 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 {
|
||||
|
||||
Reference in new issue
Block a user