|
@@ -24,7 +24,8 @@ class VariableType(RowClass):
|
24
|
24
|
def cast(self):
|
25
|
25
|
# Function to convert numbers > 2**15 to negative numbers (issue #30)
|
26
|
26
|
#complement = lambda x: x - (1 << 16 if x & (1 << 15) else 0)
|
27
|
|
- complement = lambda x: x - (1 << 16) if x >> 15 else x
|
|
27
|
+ #complement = lambda x: x - (1 << 16) if x >> 15 else x
|
|
28
|
+ complement = lambda x: int.from_bytes(bytes(x), 'big', signed=True)
|
28
|
29
|
|
29
|
30
|
if self.type == 'bool':
|
30
|
31
|
# returns a boolean
|
|
@@ -107,8 +108,11 @@ class VariableType(RowClass):
|
107
|
108
|
# Value is stored as integers in database
|
108
|
109
|
value = int(f_value)
|
109
|
110
|
|
|
111
|
+
|
|
112
|
+ """
|
110
|
113
|
if address not in range(self.start_address, self.end_address + 1):
|
111
|
114
|
continue
|
|
115
|
+ """
|
112
|
116
|
|
113
|
117
|
if not Variable(**{
|
114
|
118
|
'type': self,
|