aldas / modbus-tcp-client

PHP client for Modbus TCP and Modbus RTU over TCP (can be used for serial)
Apache License 2.0
194 stars 56 forks source link

Unable to use Uint on F6 due validate() validates only int16. #39

Closed rfsales closed 5 years ago

rfsales commented 5 years ago

We are trying to set value '65534' on a Uint16 address but an exception occurred:

Uncaught ModbusTcpClient\Exception\InvalidArgumentException: value is not set or out of range (int16): 65534 in .../aldas/modbus-tcp-client/src/Packet/ModbusFunction/WriteSingleRegisterRequest.php:38

Function 6, file: src/Packet/ModbusFunction/WriteSingleRegisterRequest.php

public function validate() { parent::validate(); if ((null !== $this->value) && (($this->value >= Types::MIN_VALUE_INT16) && ($this->value <= Types::MAX_VALUE_INT16))) { return; } throw new InvalidArgumentException("value is not set or out of range (int16): {$this->value}"); }

aldas commented 5 years ago

fixed. created new bugfix version 1.1.2

rfsales commented 5 years ago

Aldas as always solving the world problems!!! Thanks a lot!