|
@@ -134,10 +134,14 @@ def write_holding_register(var_value):
|
134
|
134
|
)
|
135
|
135
|
|
136
|
136
|
try:
|
|
137
|
+ casted_value = int(var_value.value) + (1 << 16)
|
|
138
|
+ if (var_value.value < 0)
|
|
139
|
+ else int(var_value.value)
|
|
140
|
+
|
137
|
141
|
req_adu = rtu.write_single_register(
|
138
|
142
|
slave_id=1,
|
139
|
143
|
address=var_value.address,
|
140
|
|
- value=var_value.value)
|
|
144
|
+ value=casted_value)
|
141
|
145
|
response = rtu.send_message(req_adu, serial_conn)
|
142
|
146
|
logger.debug('write_holding_register, addres: %s, response: %s',
|
143
|
147
|
var_value.address, response)
|