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

    Function planCoilWrites

    • Packs coil writes into the fewest transactions that cover them.

      The planner sorts by address and groups coils into spans. A span grows while the next coil is within maxGap unrequested coils and the span stays within maxCoilsPerWrite. A span with at least minRunLength requested coils becomes one FC15 step. Other coils become one FC05 step each.

      When the same address appears more than once, the last write wins.

      Parameters

      • writes: readonly CoilWrite[]

        Requested writes, in any order.

      • options: PlanCoilWritesOptions = {}

        Device limits, the FC05/FC15 preference, and the gap tolerance.

      Returns readonly CoilWritePlanStep[]

      Transactions to issue, in ascending address order.

      RangeError - An address, a value, or an option is out of range.

      planCoilWrites(
      [
      { address: 10, value: true },
      { address: 12, value: false },
      { address: 11, value: true },
      { address: 40, value: true },
      ],
      );
      // [
      // { kind: 'multiple', address: 10, values: [true, true, false] },
      // { kind: 'single', address: 40, value: true },
      // ]