Skip to content

Commit 44e031a

Browse files
committed
proc bytes fix bit flags... i hope
1 parent 5ab463e commit 44e031a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

classes/protocol_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ def process_register_bytes(self, registry : dict[int,bytes], entry : registry_ma
877877
elif entry.data_type == Data_Type.SHORT:
878878
value = int.from_bytes(register[:2], byteorder=self.byteorder, signed=True)
879879
elif entry.data_type == Data_Type._16BIT_FLAGS or entry.data_type == Data_Type._8BIT_FLAGS or entry.data_type == Data_Type._32BIT_FLAGS:
880+
val = int.from_bytes(register, byteorder=self.byteorder, signed=False)
880881
#16 bit flags
881882
start_bit : int = 0
882883
end_bit : int = 16 #default 16 bit
@@ -917,7 +918,6 @@ def process_register_bytes(self, registry : dict[int,bytes], entry : registry_ma
917918
else:
918919
flags : list[str] = []
919920
for i in range(start_bit, end_bit): # Iterate over each bit position (0 to 15)
920-
val = register[i]
921921
# Check if the i-th bit is set
922922
if (val >> i) & 1:
923923
flags.append("1")

0 commit comments

Comments
 (0)