Skip to content

Commit c861bfd

Browse files
committed
_read_channel_raw fix, longint support
1 parent 18fa0dc commit c861bfd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_hx711/hx711.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def _read_channel_raw(self, chan_gain: int) -> int:
122122
self._clock_pin.value = False
123123

124124
# Convert to 32-bit signed integer
125-
if value & 0x800000:
126-
value |= 0xFF000000
125+
if value & 0x80_00_00:
126+
value -= 0x1_00_00_00
127127

128128
return value
129129

0 commit comments

Comments
 (0)