Browse Source

[variable_type] reset HEAD~1 models/variable_type.py

Maxime Alves LIRMM@home 3 years ago
parent
commit
0a09d59ac3
1 changed files with 1 additions and 5 deletions
  1. 1
    5
      pyheatpump/models/variable_type.py

+ 1
- 5
pyheatpump/models/variable_type.py View File

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

Loading…
Cancel
Save