Skip to content

ModbusSlave library: ERROR: the index 'writeValues' does not exist #10

@ragrus-nbl

Description

@ragrus-nbl

If I try to write a zero value to a coil or a register, I get ERROR: the index 'writeValues' does not exist from the ModbusSlave library.

This is due to this incorrect check: https://github.com/electricimp/Modbus/blob/master/ModbusSlave/ModbusSlave.device.lib.nut#L171

If a zero value is provided, this code doesn't do result.writeValues <- writeValues but expects the writeValues field for any write operation.

To fix this, it's enough to check writeValues != null there. So zero value will pass this check too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions