Skip to content

RTU Custom Request Mismatching Function Code #345

@EzekielDaun

Description

@EzekielDaun

Thanks for this awesome crate!

I can use read_holding_registers without issue. However, when I send a custom request with function code 0x03 (to mimic read_holding_registers), the call

let request = tokio_modbus::Request::Custom(3, Cow::Owned([0x01, 0x52, 0x00, 0x01].to_vec()));
ctx.call(request).await??;

returns:

Error: mismatching function codes: 3 Ok(ReadHoldingRegisters([47826]))

I skimmed through the source code but still couldn’t figure out where this mismatch is coming from. And the value 47826 is correct.

Am I misunderstanding how the custom request is supposed to be used?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions