|
@@ -68,19 +68,19 @@ class Variable(RowClass):
|
68
|
68
|
|
69
|
69
|
@staticmethod
|
70
|
70
|
def getall_values_of_type(type: VariableType) -> dict:
|
71
|
|
- return Variable.getall_values_of_type_since(type, 0)
|
|
71
|
+ return Variable.getall_values_of_type_since(type, 0)
|
72
|
72
|
|
73
|
73
|
|
74
|
74
|
@staticmethod
|
75
|
75
|
def getall_values_of_type_since(type: VariableType, since: int) -> dict:
|
76
|
|
- floatcast = type
|
77
|
|
- cast_fct = floatcast if type.slabel == 'F' else lambda x: x
|
|
76
|
+ floatcast = lambda x: round(float(x) / 10, 2)
|
|
77
|
+ cast_fct = floatcast if type.slabel == 'A' else lambda x: x
|
78
|
78
|
|
79
|
|
- offset = 10000 if (type.slabel == 'D') else 0
|
|
79
|
+ #offset = 10000 if (type.slabel == 'D') else 0
|
80
|
80
|
return dict([
|
81
|
81
|
(row['address'], cast_fct(row['value']))
|
82
|
82
|
for row in sql(
|
83
|
|
- """SELECT (var.address + {}) as address, val.value
|
|
83
|
+ """SELECT var.address as address, val.value
|
84
|
84
|
FROM variable var
|
85
|
85
|
LEFT JOIN var_value val ON
|
86
|
86
|
var.type = val.type
|
|
@@ -91,7 +91,7 @@ class Variable(RowClass):
|
91
|
91
|
AND var.address >= {}
|
92
|
92
|
AND var.address <= {}
|
93
|
93
|
AND var.last_update > {}""".format(
|
94
|
|
- offset, type, type.start_address, type.end_address, since))
|
|
94
|
+ type, type.start_address, type.end_address, since))
|
95
|
95
|
])
|
96
|
96
|
|
97
|
97
|
|