Open civic9 opened 4 years ago
It looks like this was put in to fix a different reported bug where someone was trying to use this method for values between Short.MIN and Short.MAX instead of 0 to Modbus.MAX_REGISTER_VALUE. It definitely doesn't work to cast to short, and then check range between 0 and 65535.
https://github.com/kochedykov/jlibmodbus/blob/38fcf02f3dda8177372849b6cf3340164b8be437/src/com/intelligt/modbus/jlibmodbus/Modbus.java#L293
Why
value
is casted to short? Short is signed in java, and with such castings this method returns false for values above 32767. Is there any reason? I am not sure if I can fix this by removing that cast.