Changes for conductivity
This commit is contained in:
parent
9102812a6f
commit
1aee1c012f
50
classCAN.py
50
classCAN.py
|
|
@ -177,8 +177,54 @@ class CANBackend:
|
|||
"MV09": data[7],
|
||||
})
|
||||
|
||||
elif cob_id == 0x2B2 and len(data) >= 1:
|
||||
self.latest_data[2]["PU2_STATE"] = data[0]
|
||||
# elif cob_id == 0x1B9 and len(data) >= 6:
|
||||
# self.latest_data[1].update({
|
||||
# "Conductivity_Feed": int.from_bytes(data[0:2], 'little'),
|
||||
# "Conductivity_Permeate": int.from_bytes(data[2:4], 'little'),
|
||||
# "Conductivity_Product": int.from_bytes(data[4:6], 'little'),
|
||||
# })
|
||||
|
||||
# elif cob_id == 0x1BA and len(data) >= 6:
|
||||
# self.latest_data[1].update({
|
||||
# "Temperature_Feed": int.from_bytes(data[0:2], 'little'),
|
||||
# "Temperature_Permeate": int.from_bytes(data[2:4], 'little'),
|
||||
# "Temperature_Product": int.from_bytes(data[4:6], 'little'),
|
||||
# })
|
||||
|
||||
# elif cob_id == 0x2B2 and len(data) >= 1:
|
||||
# self.latest_data[2]["PU2_STATE"] = data[0]
|
||||
|
||||
elif cob_id == 0x2B2 and len(data) >= 7:
|
||||
self.latest_data[2].update({
|
||||
"PU2_STATE" : data[0],
|
||||
"Conductivity_Feed" : int.from_bytes(data[1:3], 'little') / 100.0,
|
||||
"Conductivity_Permeate": int.from_bytes(data[3:5], 'little') / 100.0,
|
||||
"Conductivity_Product" : int.from_bytes(data[5:7], 'little') / 100.0,
|
||||
})
|
||||
|
||||
# # ========== PU1 DRIFT CHECK ==========
|
||||
# if cob_id in (0x2A6, 0x2A8): # FM1 or MV03_sp updates for PU1
|
||||
# mv03_sp = self.latest_data[1].get("MV03_sp")
|
||||
# qdrain = self.latest_data[1].get("FM1")
|
||||
# if mv03_sp is not None and qdrain is not None:
|
||||
# if mv03_sp <= 0 or qdrain <= 0:
|
||||
# print(f"🔇 Skipping PU1 drift check (idle) → MV03_sp: {mv03_sp:.2f}, Qdrain: {qdrain:.2f}")
|
||||
# elif detect_mv03_drift(mv03_sp, qdrain):
|
||||
# print(f"⚠️ Drift detected on PU1 → MV03_sp: {mv03_sp:.2f} vs Qdrain: {qdrain:.2f}")
|
||||
# else:
|
||||
# print(f"✅ No drift on PU1 → MV03_sp: {mv03_sp:.2f} vs Qdrain: {qdrain:.2f}")
|
||||
|
||||
# # ========== PU2 DRIFT CHECK ==========
|
||||
# if cob_id in (0x2AD, 0x2AF): # FM1 or MV03_sp updates for PU2
|
||||
# mv03_sp = self.latest_data[2].get("MV03_sp")
|
||||
# qdrain = self.latest_data[2].get("FM1")
|
||||
# if mv03_sp is not None and qdrain is not None:
|
||||
# if mv03_sp <= 0 or qdrain <= 0:
|
||||
# print(f"🔇 Skipping PU2 drift check (idle) → MV03_sp: {mv03_sp:.2f}, Qdrain: {qdrain:.2f}")
|
||||
# elif detect_mv03_drift(mv03_sp, qdrain):
|
||||
# print(f"⚠️ Drift detected on PU2 → MV03_sp: {mv03_sp:.2f} vs Qdrain: {qdrain:.2f}")
|
||||
# else:
|
||||
# print(f"✅ No drift on PU2 → MV03_sp: {mv03_sp:.2f} vs Qdrain: {qdrain:.2f}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"[TPDO PARSE ERROR] {e}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user