77 lines
1.6 KiB
Markdown
77 lines
1.6 KiB
Markdown
# M1 Modbus Bug
|
||
|
||
When adding more than one register that uses the multiplier feature, there is an error in the processing of the value. This is logged to the console:
|
||
|
||
```python
|
||
error reading modbus value
|
||
No communication with the instrument (no answer)
|
||
Error reading register, retries exhausted
|
||
local variable 'val' referenced before assignment
|
||
Sending log to log-modbus: (X) Retries Exhausted: local variable 'val' referenced before assignment
|
||
```
|
||
|
||
## Steps to re-create the error
|
||
|
||
1. Set up a single channel with no multiplier value.
|
||
|
||
2. Set Modbus settings and Sync to Device.
|
||
|
||
```
|
||
here is the answer
|
||
<20><>
|
||
'\xf7\x03\x02\x13\x16\xfc\xaf'
|
||
'\xf7\x03\x02\x13\x16\xfc\xaf'
|
||
here is the payload from slave
|
||
|
||
'\x02\x13\x16'
|
||
here is the payload
|
||
|
||
'\x02\x13\x16'
|
||
success reading
|
||
4886
|
||
4886
|
||
```
|
||
|
||
3. Set up another channel with Multiplier parameter of "Divide" and Multiplier Value of "10".
|
||
|
||
4. Sync to Device.
|
||
|
||
on first register:
|
||
|
||
```
|
||
here is the answer
|
||
|
||
''
|
||
''
|
||
error reading modbus value
|
||
No communication with the instrument (no answer)
|
||
had an error on the modbus loop, retrying read
|
||
here is your period: 120
|
||
23.4706990719
|
||
here is your send value: False
|
||
getting int
|
||
writing 485: <20>,P<>
|
||
```
|
||
|
||
on second register:
|
||
|
||
```
|
||
here is the answer
|
||
|
||
''
|
||
''
|
||
error reading modbus value
|
||
No communication with the instrument (no answer)
|
||
Error reading register, retries exhausted
|
||
local variable 'val' referenced before assignment
|
||
here is your period: 120
|
||
1525193769.02
|
||
here is your send value: True
|
||
getting int
|
||
writing 485: <20>7 <20>
|
||
```
|
||
|
||
|
||
|
||
|