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.
If I try to write a zero value to a coil or a register, I get
ERROR: the index 'writeValues' does not existfrom 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 <- writeValuesbut expects thewriteValuesfield for any write operation.To fix this, it's enough to check
writeValues != nullthere. So zero value will pass this check too.