Skip to content

Commit

Permalink
Fix Code quality check
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeRigaux committed Feb 28, 2024
1 parent 56f970b commit 2c15c72
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modbus2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,18 @@ def get_value(self, src):

if ((self.littleendian)):
# Read multiple bytes in little endian mode
h=""
h = ""
for i in range(0, self.length):
h = hex(rr.registers[i]).split('x')[-1].zfill(4) + h
log.debug(f"Got Value {h} from {self.typereg} register {self.start} with length {self.length} from unit {unitid} in little endian mode.")
val=int(h, 16)
val = int(h, 16)
else:
# Read multiple bytes in big endian mode
h=""
h = ""
for i in range(0, self.length):
h = h + hex(rr.registers[i]).split('x')[-1].zfill(4)
log.debug(f"Got Value {h} from {self.typereg} register {self.start} with length {self.length} from unit {unitid} in big endian mode.")
val=int(h, 16)
val = int(h, 16)

if self.signed and int(val) >= 32768:
val = int(val) - 65535
Expand Down

0 comments on commit 2c15c72

Please sign in to comment.