@flux-control/effect-modbus-rs
    Preparing search index...

    Function encodeRegisterValue

    • Encodes a value to its unsigned 16-bit form, rejecting one that does not fit.

      Both step kinds carry the encoded value, so a plan writes the same bits whether the planner grouped an address into an FC06 or an FC16. Leaving the FC06 path unencoded would let Uint16Array truncate one path and not the other.

      Anything that compares a proposed value against a value already on the device must encode first, for the same reason: -1 and 65535 are the same register contents, and a comparison that says otherwise rewrites the register forever.

      Parameters

      • value: number

        Unsigned (0 to 65535) or two's-complement signed (-32768 to -1).

      Returns number

      The value as an unsigned 16-bit number.

      RangeError - The value is not an integer, or does not fit 16 bits.