|
@@ -42,13 +42,13 @@ class Input:
|
|
|
if remaining > 0:
|
|
|
time.sleep(remaining)
|
|
|
|
|
|
- def queue_ifm_from_bytes(self, timestamp, raw, channels = 16):
|
|
|
+ def queue_ifm_from_bytes(self, source, timestamp, raw, channels = 16):
|
|
|
data = struct.unpack(">" + "B" * 16 + "HHHHHBxH", raw)
|
|
|
current = tuple([x / 10 for x in data[0:channels]])
|
|
|
- status = tuple([data[17] & (1 << i) for i in range(channels)])
|
|
|
- overload = tuple([data[17] & (1 << i) for i in range(channels)])
|
|
|
- short_circuit = tuple([data[17] & (1 << i) for i in range(channels)])
|
|
|
- limit = tuple([data[17] & (1 << i) for i in range(channels)])
|
|
|
- pushbutton = tuple([data[17] & (1 << i) for i in range(channels)])
|
|
|
+ status = tuple([data[16] & (1 << i) > 0 for i in range(channels)])
|
|
|
+ overload = tuple([data[17] & (1 << i) > 0 for i in range(channels)])
|
|
|
+ short_circuit = tuple([data[18] & (1 << i) > 0 for i in range(channels)])
|
|
|
+ limit = tuple([data[19] & (1 << i) > 0 for i in range(channels)])
|
|
|
+ pushbutton = tuple([data[20] & (1 << i) > 0 for i in range(channels)])
|
|
|
voltage = data[22] / 100
|
|
|
- self._q.put(Measurement24v(timestamp, "AB", current, status, overload, short_circuit, limit, pushbutton, voltage))
|
|
|
+ self._q.put(Measurement24v(timestamp, source, current, status, overload, short_circuit, limit, pushbutton, voltage))
|